From 064d613e9a1185f2dd86d33240517a814125c7e5 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Fri, 6 Nov 2020 13:17:06 +0100
Subject: [PATCH] FEAT #15350 TIME 1:30 final clean useless code (core + apps)

---
 apps/maarch_entreprise/LICENSE.txt            |  674 ---
 .../class_business_app_tools_Abstract.php     |  378 +-
 .../class/class_list_show.php                 |   43 -
 .../class/class_list_show_Abstract.php        | 1404 ------
 .../class/class_list_show_with_template.php   |   40 -
 ...class_list_show_with_template_Abstract.php |  842 ----
 apps/maarch_entreprise/class/class_lists.php  |   41 -
 .../class/class_lists_Abstract.php            | 3801 -----------------
 apps/maarch_entreprise/class/class_pdf.php    |   34 -
 .../class/class_pdf_Abstract.php              |  115 -
 apps/maarch_entreprise/index.php              |   14 -
 apps/maarch_entreprise/lang/en.php            |    7 -
 apps/maarch_entreprise/lang/fr.php            |    7 -
 apps/maarch_entreprise/lang/nl.php            |    6 -
 apps/maarch_entreprise/security_message.php   |   58 -
 ci/php.ini                                    |    4 +-
 core/admin_tools.php                          |  104 -
 core/class/Action.php                         |   55 -
 core/class/ActionControler.php                |  138 -
 core/class/ExportControler.php                |  161 -
 core/class/SecurityControler.php              |  159 +-
 core/class/Service.php                        |   49 +-
 core/class/ServiceControler.php               |  172 -
 core/class/Status.php                         |   55 -
 core/class/StatusControler.php                |  405 --
 core/class/class_core_tools.php               |  773 +---
 core/class/class_db.php                       |  286 +-
 core/class/class_db_pdo.php                   |  123 +-
 core/class/class_functions.php                |  179 +-
 core/class/class_history.php                  |   23 -
 core/class/class_manage_status.php            |  125 -
 core/class/class_portal.php                   |   40 +-
 core/class/class_request.php                  |  301 +-
 core/class/class_resource.php                 |  409 +-
 core/class/class_security.php                 |  422 +-
 core/class/docserver_types_controler.php      |  206 +-
 core/class/docservers_controler.php           |  473 +-
 core/class/usergroups.php                     |   57 -
 core/class/usergroups_controler.php           |  640 ---
 core/class/users_controler.php                |   56 +-
 core/core_tables.php                          |   25 +-
 core/docservers_tools.php                     |   92 +-
 core/init.php                                 |   66 +-
 core/manage_action.php                        |  383 --
 core/xml/config.xml                           |    2 -
 core/xml/config.xml.default                   |    2 -
 .../app/save-numeric-package.component.ts     |    1 -
 47 files changed, 346 insertions(+), 13104 deletions(-)
 delete mode 100755 apps/maarch_entreprise/LICENSE.txt
 delete mode 100755 apps/maarch_entreprise/class/class_list_show.php
 delete mode 100755 apps/maarch_entreprise/class/class_list_show_Abstract.php
 delete mode 100755 apps/maarch_entreprise/class/class_list_show_with_template.php
 delete mode 100755 apps/maarch_entreprise/class/class_list_show_with_template_Abstract.php
 delete mode 100755 apps/maarch_entreprise/class/class_lists.php
 delete mode 100755 apps/maarch_entreprise/class/class_lists_Abstract.php
 delete mode 100755 apps/maarch_entreprise/class/class_pdf.php
 delete mode 100755 apps/maarch_entreprise/class/class_pdf_Abstract.php
 delete mode 100755 apps/maarch_entreprise/security_message.php
 delete mode 100755 core/admin_tools.php
 delete mode 100755 core/class/Action.php
 delete mode 100755 core/class/ActionControler.php
 delete mode 100755 core/class/ExportControler.php
 delete mode 100755 core/class/ServiceControler.php
 delete mode 100755 core/class/Status.php
 delete mode 100755 core/class/StatusControler.php
 delete mode 100755 core/class/class_manage_status.php
 delete mode 100755 core/class/usergroups.php
 delete mode 100755 core/class/usergroups_controler.php
 delete mode 100755 core/manage_action.php

diff --git a/apps/maarch_entreprise/LICENSE.txt b/apps/maarch_entreprise/LICENSE.txt
deleted file mode 100755
index 94a9ed024d3..00000000000
--- a/apps/maarch_entreprise/LICENSE.txt
+++ /dev/null
@@ -1,674 +0,0 @@
-                    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
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php
index 6b8a253a5d9..64f606da08b 100755
--- a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php
+++ b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*    Copyright 2008-2017 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -116,13 +103,11 @@ abstract class business_app_tools_Abstract extends Database
             } else {
                 $_SESSION['config']['showfooter'] = 'true';
             }
-            //$_SESSION['config']['databaseworkspace'] = (string) $config->databaseworkspace;
 
             $tablename = $xmlconfig->TABLENAME;
             $_SESSION['tablename']['doctypes_first_level']  = (string) $tablename->doctypes_first_level;
             $_SESSION['tablename']['doctypes_second_level'] = (string) $tablename->doctypes_second_level;
             $_SESSION['tablename']['doctypes_indexes']      = (string) $tablename->doctypes_indexes;
-            $_SESSION['tablename']['saved_queries']         = (string) $tablename->saved_queries;
             $_SESSION['tablename']['tags']                  = (string) $tablename->tags;
             
             $_SESSION['config']['tmppath'] = \SrcCore\models\CoreConfigModel::getTmpPath();
@@ -228,7 +213,6 @@ abstract class business_app_tools_Abstract extends Database
             $_SESSION['history']['docserversdel']   = (string) $history->docserversdel;
             $_SESSION['history']['docserversallow'] = (string) $history->docserversallow;
             $_SESSION['history']['docserversban']   = (string) $history->docserversban;
-            //$_SESSION['history']['docserversclose'] = (string) $history->docserversclose;
             $_SESSION['history']['docserverslocationsadd']   = (string) $history->docserverslocationsadd;
             $_SESSION['history']['docserverslocationsdel']   = (string) $history->docserverslocationsdel;
             $_SESSION['history']['docserverslocationsallow'] = (string) $history->docserverslocationsallow;
@@ -257,7 +241,6 @@ abstract class business_app_tools_Abstract extends Database
             foreach ($xmlconfig->MODULES as $modules) {
                 $_SESSION['modules'][$i] = array(
                     'moduleid' => (string) $modules->moduleid,
-                    //,"comment" => (string) $MODULES->comment
                 );
                 $i ++;
             }
@@ -399,359 +382,4 @@ abstract class business_app_tools_Abstract extends Database
             }
         }
     }
-
-    public static function _loadEntrepriseVar()
-    {
-        $core = new core_tools();
-        if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-            . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR
-            . 'apps'.DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-            . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR
-            . 'entreprise.xml'
-        )
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom'
-                . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR
-                . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml'
-                . DIRECTORY_SEPARATOR . 'entreprise.xml';
-        } else {
-            $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-                . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR
-                . 'entreprise.xml';
-        }
-        $xmlfile = simplexml_load_file($path);
-        $langPath = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-            . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR
-            . $_SESSION['config']['lang'] . '.php';
-
-        $_SESSION['attachment_types'] = array();
-        $_SESSION['attachment_types_with_chrono'] = array();
-        $_SESSION['attachment_types_show'] = array();
-        $_SESSION['attachment_types_with_process'] = array();
-        $_SESSION['attachment_types_with_delay'] = array();
-        $_SESSION['attachment_types_reconciliation'] = array(); //NCH01
-        $attachmentTypes = $xmlfile->attachment_types;
-        if (count($attachmentTypes) > 0) {
-            foreach ($attachmentTypes->type as $type) {
-                $label = (string) $type->label;
-                $with_chrono = (string) $type['with_chrono'];
-                $get_chrono = (string) $type['get_chrono'];
-                $attach_in_mail = (string) $type['attach_in_mail'];
-                $show_attachment_type = (string) $type['show'];
-                $delay = (string) $type['with_delay'];
-                $select_in_reconciliation = (string) $type['select_in_reconciliation']; //NCH01
-                $process = (string) $type->process_mode;
-                if (!empty($label) && defined($label)
-                    && constant($label) <> null
-                ) {
-                    $label = constant($label);
-                }
-
-                $array_get_chrono = explode(',', $get_chrono);
-                $_SESSION['attachment_types'][(string) $type->id] = $label;
-                $_SESSION['attachment_types_with_chrono'][(string) $type->id] = $with_chrono;
-                $_SESSION['attachment_types_show'][(string) $type->id] = $show_attachment_type;
-                $_SESSION['attachment_types_get_chrono'][(string) $type->id] = $array_get_chrono;
-                $_SESSION['attachment_types_attach_in_mail'][(string) $type->id] = $attach_in_mail;
-                $_SESSION['attachment_types_with_process'][(string) $type->id] = $process;
-                $_SESSION['attachment_types_with_delay'][(string) $type->id] = $delay;
-                $_SESSION['attachment_types_reconciliation'][(string) $type->id] = $select_in_reconciliation; //NCH01
-            }
-        }
-
-        $_SESSION['mail_priorities']            = [];
-        $_SESSION['mail_priorities_id']         = [];
-        $_SESSION['mail_priorities_attribute']  = [];
-        $_SESSION['mail_priorities_wdays']      = [];
-        $_SESSION['mail_priorities_color']      = [];
-        $_SESSION['default_mail_priority']      = 0;
-
-        $priorities = \Priority\models\PriorityModel::get(['orderBy' => ['"order" NULLS LAST']]);
-        $i = 0;
-        foreach ($priorities as $priority) {
-            $_SESSION['mail_priorities'][$i] = $priority['label'];
-            $_SESSION['mail_priorities_id'][$i] = $priority['id'];
-            $_SESSION['mail_priorities_attribute'][$i] = ($priority['delays'] == null ? 'false' : $priority['delays']);
-            $_SESSION['mail_priorities_wdays'][$i] = ($priority['working_days'] ? 'true' : 'false');
-            $_SESSION['mail_priorities_color'][$i] = $priority['color'];
-            if ($priority['default_priority']) {
-                $_SESSION['default_mail_priority'] = $i;
-            }
-            $i++;
-        }
-
-        $mailPriorities = $xmlfile->priorities;
-        if (count($mailPriorities) > 0) {
-            $_SESSION['default_sve_priority'] = (string) $mailPriorities->default_sve_priority;
-        }
-
-        $contact_check = $xmlfile->contact_check;
-        if (count($contact_check) > 0) {
-            $_SESSION['check_days_before'] = (string) $contact_check->check_days_before;
-        }
-
-        $_SESSION['mail_titles'] = array();
-        $mailTitles = $xmlfile->titles;
-        if (count($mailTitles) > 0) {
-            $i = 0;
-            foreach ($mailTitles->title as $title) {
-                $label = (string) $title->label;
-                if (!empty($label) && defined($label)
-                    && constant($label) <> null
-                ) {
-                    $label = constant($label);
-                }
-                $_SESSION['mail_titles'][(string)$title->id] = $label;
-            }
-            $_SESSION['default_mail_title'] = (string) $mailTitles->default_title;
-        }
-    }
-
-    public function load_features($xmlFeatures)
-    {
-        $_SESSION['features'] = array();
-        //Defines all features by  default at 'false'
-        $_SESSION['features']['search_notes']                    = "false";
-        $_SESSION['features']['show_types_tree']                 = "false";
-        $_SESSION['features']['watermark']                       = array();
-        $_SESSION['features']['watermark']['enabled']            = "false";
-        if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-            . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR
-            . $xmlFeatures
-        )
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom'
-                  . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                  . DIRECTORY_SEPARATOR . $xmlFeatures;
-        } else {
-            $path = $xmlFeatures;
-        }
-
-        $xmlfeatures = simplexml_load_file($path);
-        if ($xmlfeatures) {
-            $feats = $xmlfeatures->FEATURES;
-            $_SESSION['features']['search_notes']                    = (string) $feats->search_notes;
-            $_SESSION['features']['show_types_tree']                 = (string) $feats->show_types_tree;
-            $watermark = $feats->watermark;
-            $_SESSION['features']['watermark']['enabled']    = (string) $watermark->enabled;
-            $_SESSION['features']['watermark']['text']       = (string) $watermark->text;
-            $_SESSION['features']['watermark']['position']   = (string) $watermark->position;
-            $_SESSION['features']['watermark']['font']       = (string) $watermark->font;
-            $_SESSION['features']['watermark']['text_color'] = (string) $watermark->text_color;
-            $_SESSION['features']['type_calendar']           = (string) $feats->type_calendar;
-            $send_to_contact_with_mandatory_attachment       = (string) $feats->send_to_contact_with_mandatory_attachment;
-            if (strtoupper($send_to_contact_with_mandatory_attachment) == 'TRUE') {
-                $_SESSION['features']['send_to_contact_with_mandatory_attachment'] = true;
-            } elseif (strtoupper($send_to_contact_with_mandatory_attachment) == 'FALSE') {
-                $_SESSION['features']['send_to_contact_with_mandatory_attachment'] = false;
-            }
-            if (!empty($feats->notes_in_print_page->label)) {
-                foreach ($feats->notes_in_print_page->label as $value) {
-                    $_SESSION['features']['notes_in_print_page'][] = (string) $value;
-                }
-            }
-        }
-    }
-
-    /**
-    * Loads app specific vars in session
-    *
-    */
-    public function load_app_var_session($userData = '')
-    {
-        $this->_loadEntrepriseVar();
-        $this->load_features(
-            'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-            . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'features.xml'
-        );
-        
-        $this->_loadListsConfig();
-    }
-
-    protected function _loadListsConfig()
-    {
-        if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-            . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps'
-            . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-            . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR
-            . 'lists_parameters.xml'
-        )
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom'
-                  . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                  . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR
-                  . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR .'xml'
-                  . DIRECTORY_SEPARATOR . 'lists_parameters.xml';
-        } else {
-            $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-            . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR
-            . 'lists_parameters.xml';
-        }
-        $xmlfile = simplexml_load_file($path);
-        
-        //Load filters
-        $_SESSION['filters'] = array();
-        foreach ($xmlfile->FILTERS as $filtersObject) {
-            foreach ($filtersObject as $filter) {
-                $desc = (string) $filter->LABEL;
-                if (!empty($desc) && defined($desc) && constant($desc) <> null) {
-                    $desc = constant($desc);
-                }
-                $id = (string) $filter->ID;
-                $enabled = (string) $filter->ENABLED;
-                if (trim($enabled) == 'true') {
-                    $_SESSION['filters'][$id] = array(
-                        'ID'      => $id,
-                        'LABEL'   => $desc,
-                        'ENABLED' => $enabled,
-                        'VALUE'   => '',
-                        'CLAUSE'  => ''
-                    );
-                }
-            }
-        }
-        
-        //Init
-        $_SESSION['html_templates'] = array();
-        
-        //Default list (no template)
-        $_SESSION['html_templates']['none'] = array(
-            'ID'        =>  'none',
-            'LABEL'     =>  _DOCUMENTS_LIST,
-            'IMG'       =>  'fa fa-list-alt fa-2x',
-            'ENABLED'   =>  'true',
-            'PATH'      =>  '',
-            'GOTOLIST'  =>  ''
-        );
-        
-        //Load templates
-        foreach ($xmlfile->TEMPLATES as $templatesObject) {
-            foreach ($templatesObject as $template) {
-                $desc = (string) $template->LABEL;
-                if (!empty($desc) && defined($desc) && constant($desc) <> null) {
-                    $desc = constant($desc);
-                }
-                $id         = (string) $template->ID;
-                $enabled    = (string) $template->ENABLED;
-                $name       = (string) $template->NAME;
-                $origin     = (string) $template->ORIGIN;
-                $module     = (string) $template->MODULE;
-                $listObject = $template->GOTOLIST;
-
-                $pathToList = '';
-                if (!empty($listObject)) {
-                    foreach ($listObject as $list) {
-                        $listId = (string) $list->ID;
-                        $listName = (string) $list->NAME;
-                        $listOrigin = (string) $list->ORIGIN;
-                        $listModule = (string) $list->MODULE;
-                        
-                        // The page is in the apps
-                        if (strtoupper($listOrigin) == 'APPS'
-                        ) {
-                            if (file_exists(
-                                $_SESSION['config']['corepath'].'custom' . DIRECTORY_SEPARATOR
-                                . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps'
-                                . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-                                . DIRECTORY_SEPARATOR . $listName . '.php'
-                            ) ||
-                                file_exists(
-                                    'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-                                . DIRECTORY_SEPARATOR . $listName.'.php'
-                                )
-                            ) {
-                                $pathToList = $_SESSION['config']['businessappurl']
-                                            . 'index.php?display=true&page='. $listName;
-                            }
-                        } elseif (strtoupper(
-                            $listOrigin
-                        ) == "MODULE"
-                        ) {
-                            // The page is in a module
-                            $core = new core_tools();
-                            // Error : The module name is empty or the module is not loaded
-                            if (empty($listModule)
-                                || ! $core->is_module_loaded(
-                                    $listModule
-                                )
-                            ) {
-                                $pathToList = '';
-                            } else {
-                                if (
-                                    file_exists(
-                                        $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-                                    . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules'
-                                    . DIRECTORY_SEPARATOR . $listModule . DIRECTORY_SEPARATOR . $listName . '.php'
-                                    ) ||
-                                    file_exists(
-                                        'modules' . DIRECTORY_SEPARATOR . $listModule
-                                        . DIRECTORY_SEPARATOR . $listName . '.php'
-                                    )
-                                ) {
-                                    $pathToList = $_SESSION['config']['businessappurl']
-                                        . 'index.php?display=true&page=' . $listName
-                                        . '&module=' . $listModule;
-                                }
-                            }
-                        }
-                    }
-                }
-                
-                //Path to template
-                if ($origin == "apps") { //Origin apps
-                    if (file_exists(
-                        $_SESSION['config']['corepath'].'custom' . DIRECTORY_SEPARATOR
-                        . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps'
-                        . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-                        . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR
-                        . $name . '.html'
-                    )
-                    ) {
-                        $path = $_SESSION['config']['corepath'] . 'custom'
-                        . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                        . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR
-                        . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR
-                        . "template" . DIRECTORY_SEPARATOR . $name . '.html';
-                    } else {
-                        $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-                        . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . $name.'.html';
-                    }
-                } elseif ($origin == "module") { //Origin module
-                    if (file_exists(
-                        $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-                        . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules'
-                        . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'template'
-                        . DIRECTORY_SEPARATOR .  $name . '.html'
-                    )
-                    ) {
-                        $path = $_SESSION['config']['corepath'] . 'custom'
-                        . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                        . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
-                        . $module . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR
-                        .  $name . '.html';
-                    } else {
-                        $path = 'modules' . DIRECTORY_SEPARATOR . $module
-                        . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR
-                        .  $name . '.html';
-                    }
-                }
-                
-                //Values of html_templates array
-                if (trim($enabled) == 'true') {
-                    $_SESSION['html_templates'][$id] = array(
-                        'ID'       => $id,
-                        'LABEL'    => $desc,
-                        'IMG'      => (string) $template->IMG,
-                        'ENABLED'  => $enabled,
-                        'PATH'     => $path,
-                        'GOTOLIST' => $pathToList
-                    );
-                }
-            }
-        }
-    }
 }
diff --git a/apps/maarch_entreprise/class/class_list_show.php b/apps/maarch_entreprise/class/class_list_show.php
deleted file mode 100755
index 151c7203808..00000000000
--- a/apps/maarch_entreprise/class/class_list_show.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/*
- *    Copyright 2008,2015 Maarch
- *
- *  This file is part of Maarch Framework.
- *
- *   Maarch Framework 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.
- *
- *   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
-* List Show Class
-*
-*  Contains all the function to manage and show list
-*
-* @package  Maarch
-* @version 2.1
-* @since 10/2005
-* @license GPL
-* @author  Claire Figueras  <dev@maarch.org>
-* @author  Loïc Vinet  <dev@maarch.org>
-* @author  Laurent Giovannoni  <dev@maarch.org>
-*
-*/
-
-require_once 'apps/'. $_SESSION['config']['app_id'] .'/class/class_list_show_Abstract.php';
-
-class list_show extends list_show_Abstract
-{
-    // custom
-}
-
diff --git a/apps/maarch_entreprise/class/class_list_show_Abstract.php b/apps/maarch_entreprise/class/class_list_show_Abstract.php
deleted file mode 100755
index 0b985056507..00000000000
--- a/apps/maarch_entreprise/class/class_list_show_Abstract.php
+++ /dev/null
@@ -1,1404 +0,0 @@
-<?php
-
-/*
- *    Copyright 2008,2015 Maarch
- *
- *  This file is part of Maarch Framework.
- *
- *   Maarch Framework 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.
- *
- *   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * List Show Class.
- *
- *  Contains all the function to manage and show list
- *
- * @version 2.1
- *
- * @since 10/2005
- *
- * @license GPL
- * @author  Claire Figueras  <dev@maarch.org>
- * @author  Loïc Vinet  <dev@maarch.org>
- * @author  Laurent Giovannoni  <dev@maarch.org>
- */
-class list_show_Abstract extends functions
-{
-    /**
-     * Show the document list in result of the search.
-     *
-     * @param array  $listarr
-     * @param int    $nb_total               total number of documents
-     * @param string $title
-     * @param string $what                   search expression
-     * @param string $name                   "search" by default, the calling page
-     * @param string $key                    the key seach for the form
-     * @param string $detail_destination     the link to detail page
-     * @param bool   $bool_view_document     boolean to view document or not
-     * @param bool   $bool_radio_form        boolean to add radio to select row
-     * @param string $method                 method of the select form
-     * @param string $action                 action of the select form
-     * @param string $button_label           label(session var) of the button of the select form
-     * @param bool   $bool_detail            boolean to show the detail page link or not
-     * @param bool   $bool_order             boolean to show the order icons or not
-     * @param bool   $bool_frame             true if calling by frame
-     * @param bool   $bool_export            true if we activate the list export (obsolete => to delete)
-     * @param bool   $show_close             true : the close window button is showed
-     * @param bool   $show_big_title         true : the title is displayed in the title container
-     * @param bool   $show_full_list         true : the list takes all the screen, otherwise it is addforms2 class
-     * @param bool   $bool_check_form        true : add checkbox to select row
-     * @param string $res_link               obsolete (to delete)
-     * @param string $module                 module name if the function is called in a module
-     * @param bool   $bool_show_listletters  true : show list letters, search on the elements of the list possible
-     * @param string $all_sentence           string  : all item
-     * @param string $whatname               name of the element to search
-     * @param string $used_css               css used in the list
-     * @param string $comp_link              url link complement
-     * @param string $link_in_line
-     * @param string $bool_show_actions_list true : shows the possible actions of the list on a combo list
-     * @param array  $actions                list of the elements of the actions combo list
-     * @param string $hidden_fields          hidden fields in the form
-     */
-    public function list_doc(
-    $result,
-    $nb_total,
-    $title,
-    $what,
-    $name = 'search',
-    $key,
-    $detail_destination,
-    $bool_view_document,
-    $bool_radio_form,
-    $method,
-    $action,
-    $button_label,
-    $bool_detail,
-    $bool_order,
-    $bool_frame = false,
-    $bool_export = false,
-    $show_close = false,
-    $show_big_title = true,
-    $show_full_list = true,
-    $bool_check_form = false,
-    $res_link = '',
-    $module = '',
-    $bool_show_listletters = false,
-    $all_sentence = '',
-    $whatname = '',
-    $used_css = 'listing spec',
-    $comp_link = '',
-    $link_in_line = false,
-    $bool_show_actions_list = false,
-    $actions = array(),
-    $hidden_fields = '',
-    $actions_json = '{}',
-    $do_action = false,
-    $id_action = '',
-    $open_details_popup = true,
-    $do_actions_arr = array(),
-    $template = false,
-    $template_list = array(),
-    $actual_template = '',
-    $mode_string = false,
-    $hide_standard_list = false
-    ) {
-        //echo $actual_template;exit;
-        if ($template && $actual_template != '') {
-            $str = '';
-            $str .= '<div style="text-align: right;"><input type="button" onclick="window.open(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&page=export\', \'_blank\');" class="button" name="submit" value="'._EXPORT_LIST.'" /></div>';
-            require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_list_show_with_template.php';
-            $list_temp = new list_show_with_template();
-
-            $str .= $list_temp->list_doc_by_template($result, $nb_total, $title,$what,$name,$key,$detail_destination,$bool_view_document,$bool_radio_form,$method,$action,
-            $button_label, $bool_detail, $bool_order, $bool_frame,$bool_export, $show_close, $show_big_title,
-            $show_full_list, $bool_check_form, $res_link, $module, $bool_show_listletters, $all_sentence,
-            $whatname, $used_css , $comp_link, $link_in_line, $bool_show_actions_list , $actions,
-            $hidden_fields, $actions_json, $do_action, $id_action, $open_details_popup, $do_actions_arr, $template, $template_list, $actual_template, true, $hide_standard_list);
-            $str .= '<div style="text-align: right;"><input type="button" onclick="window.open(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&page=export\', \'_blank\');" class="button" name="submit" value="'._EXPORT_LIST.'" /></div>';
-            if ($mode_string) {
-                return $str;
-            } else {
-                echo $str;
-            }
-        } else {
-            $str = '';
-            if ($bool_export) {
-                $str .= '<div style="text-align: right;"><input type="button" onclick="window.open(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&page=export\', \'_blank\');" class="button" name="submit" value="'._EXPORT_LIST.'" /></div>';
-            }
-            require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_list_show_with_template.php';
-            //show the document list in result of the search
-            $page_list1 = '';
-            $page_list2 = '';
-            $link = '';
-            $str .= '';
-            //$listvalue = array();
-            $listcolumn = array();
-            $listshow = array();
-            $listformat = array();
-            $ordercol = array();
-            if (isset($_REQUEST['start']) && $_REQUEST['start'] > $nb_total) {
-                $_REQUEST['start'] = 0;
-            }
-            // put in tab the different label of the column
-            for ($j = 0; $j < count($result[0]); ++$j) {
-                if (isset($result[0][$j]['label'])) {
-                    array_push($listcolumn, $result[0][$j]['label']);
-                } else {
-                    array_push($listcolumn, '');
-                }
-                if (isset($result[0][$j]['show'])) {
-                    array_push($listshow, $result[0][$j]['show']);
-                } else {
-                    array_push($listshow, false);
-                }
-                if (isset($result[0][$j]['order'])) {
-                    array_push($ordercol, $result[0][$j]['order']);
-                } else {
-                    array_push($ordercol, '');
-                }
-            }
-
-            $func = new functions();
-
-            if ($bool_frame) {
-                $link = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;page='.$name.'&amp;search='.$what;
-                //$link = $name.".php?search=".$what;
-            } else {
-                $link = $_SESSION['config']['businessappurl'].'index.php?page='.$name.'&amp;search='.$what;
-            }
-            if (isset($_SESSION['where'])) {
-                for ($i = 0; $i < count($_SESSION['where']); ++$i) {
-                    $link .= '&amp;where[]='.$_SESSION['where'][$i];
-                }
-            }
-            if (!empty($module)) {
-                $link .= '&amp;module='.$module;
-            }
-            if (isset($_REQUEST['what'])) {
-                $link .= '&amp;what='.strip_tags($_REQUEST['what']);
-            }
-            if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
-                $start = strip_tags($_REQUEST['start']);
-            } else {
-                $start = 0;
-            }
-
-            if (isset($_REQUEST['order'])) {
-                $orderby = strip_tags($_REQUEST['order']);
-            } else {
-                //$orderby = 'asc';
-                $orderby = '';
-            }
-            if (!preg_match('/order=/', $comp_link)) {  //&& $order <> ''
-                $link .= '&amp;order='.$orderby;
-            }
-            if (isset($_REQUEST['order_field'])) {
-                $orderfield = strip_tags($_REQUEST['order_field']);
-            } else {
-                $orderfield = '';
-            }
-            if (!preg_match('/order_field=/', $comp_link) && $orderfield != '') {
-                $link .= '&amp;order_field='.$orderfield;
-            }
-            $link .= $comp_link;
-
-            $nb_show = $_SESSION['config']['nblinetoshow'];
-            $nb_pages = ceil($nb_total / $nb_show);
-            $end = count($result);
-
-            if ($actual_template != '') {
-                $link .= '&amp;template='.$actual_template;
-            } else {
-                $link .= '&amp;template=';
-            }
-
-            //########################
-            $disp_dc = '';
-            $core = new core_tools();
-            if ($core->is_module_loaded('doc_converter') && $bool_export) {
-                $_SESSION['doc_convert'] = array();
-                require_once 'modules'.DIRECTORY_SEPARATOR.'doc_converter'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php';
-                $doc_converter = new doc_converter();
-                $disp_dc = $doc_converter->convert_list($result, true);
-            }
-            //########################
-
-            $tdeto = '';
-            if ($template == true) {
-                require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_list_show_with_template.php';
-                $template_object = new list_show_with_template();
-                $tdeto = $template_object->display_template_for_user($template_list, $link);
-            }
-
-            // if they are more 1 page we do pagination with 2 forms
-            $previous = '';
-            $next = '';
-            if ($nb_pages > 1) {
-                $next_start = 0;
-                //$search_form = "<div class='list_show_page'><form name=\"newpage1\" method=\"get\" >";
-                $page_list1 = _GO_TO_PAGE." <select id=\"startpage_list\" name=\"startpage\" onchange=\"window.location.href='".$link."&amp;start='+this.value;\">";
-                $lastpage = 0;
-                for ($i = 0; $i != $nb_pages; ++$i) {
-                    $page_name = $i + 1;
-                    $the_line = $i + 1;
-                    if ($start == $next_start) {
-                        $page_list1 .= '<option value="'.$next_start.'" selected="selected">'.$the_line.'</option>';
-                    } else {
-                        $page_list1 .= '<option value="'.$next_start.'">'.$the_line.'</option>';
-                    }
-                    $next_start = $next_start + $nb_show;
-                    $lastpage = $next_start;
-                }
-                $page_list1 .= '</select>';
-                $lastpage = $lastpage - $nb_show;
-
-                if ($start > 0) {
-                    $start_prev = $start - $nb_show;
-                    $previous = ' <a id="previous_items" href="'.$link.'&amp;start='.$start_prev.'"><i class="fa fa-backward" title="'._PREVIOUS.'"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;';
-                }
-
-                if ($start != $lastpage) {
-                    $start_next = $start + $nb_show;
-                    $next = ' <a id="next_items" href="'.$link.'&amp;start='.$start_next.'"><i class="fa fa-forward" title="'._NEXT.'"></i></a>';
-                }
-            }
-            $page_list1 = '<div class="block" style="height:30px;vertical" align="center" ><table width="100%" border="0" summary=""><tr><td align="center" width="15%"><b>'.$previous.'</b></td><td align="center" width="15%"><b>'.$next.'</b></td><td width="10px">|</td><td align="center" width="30%">'.$page_list1.'</td><td width="10px">|</td><td width="210px" align="center">'.$disp_dc.'</td><td width="10px">|</td><td align="right">'.$tdeto.'</td></tr></table></b></div>';
-
-            if ($show_big_title) {
-                $str .= '<h1>';
-                if (!empty($picto_path)) {
-                    $str .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';
-                }
-                $str .= $title.'</h1>';
-            } else {
-                $str .= '<b>';
-                if (!empty($picto_path)) {
-                    $str .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';
-                }
-                $str .= $title.'</b>';
-            }
-            if ($bool_show_listletters) {
-                $str .= self::listletters($link, $name, $all_sentence, _SEARCH.' '.$whatname, _ALPHABETICAL_LIST, false, false, array(), true);
-            }
-            $str .= $page_list1;
-            $str .= ' <div align="center">';
-            if ($bool_radio_form || $bool_check_form || ($do_action && !empty($id_action))) {
-                $temp = '<form name="form_select" id="form_select" action="'.$action.'" method="'.$method.'" class="forms';
-                if (!$show_full_list) {
-                    $temp .= ' addforms2" >';
-                } else {
-                    $temp .= '" >';
-                }
-                $str .= $temp;
-                $str .= $hidden_fields;
-            }
-            if ((($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) || ($do_action && !empty($id_action))) {
-                $str .= '<script type="text/javascript">';
-                $str .= 'var arr_actions = '.$actions_json.';';
-                $str .= ' var arr_msg_error = {\'confirm_title\' : \''._ACTION_CONFIRM.'\',';
-                $str .= ' \'validate\' : \''._VALIDATE.'\',';
-                $str .= ' \'cancel\' : \''._CANCEL.'\',';
-                $str .= ' \'choose_action\' : \''._CHOOSE_ACTION.'\',';
-                $str .= ' \'choose_one_doc\' : \''._CHOOSE_ONE_DOC.'\'';
-                $str .= ' };';
-                $str .= ' valid_form=function(mode, res_id, id_action)';
-                $str .= '{';
-                $str .= 'if(!isAlreadyClick){';
-                $str .= ' var val = \'\';';
-                $str .= ' var action_id = \'\';';
-                $str .= ' var table = \'\';';
-                $str .= ' var coll_id = \'\';';
-                $str .= ' var module = \'\';';
-                $str .= ' var thisfrm = document.getElementById(\'form_select\');';
-                $str .= ' if(thisfrm)';
-                $str .= ' {';
-                $str .= ' for(var i=0; i < thisfrm.elements.length; i++)';
-                $str .= ' {';
-
-                $str .= ' if(thisfrm.elements[i].name = \'field\' && thisfrm.elements[i].checked == true)';
-                $str .= ' {';
-                $str .= ' val += thisfrm.elements[i].value+\',\';';
-                $str .= ' }';
-                $str .= ' else if(thisfrm.elements[i].id == \'action\')';
-                $str .= '   {';
-                $str .= ' action_id = thisfrm.elements[i].options[thisfrm.elements[i].selectedIndex].value;';
-                $str .= ' }';
-                $str .= ' else if(thisfrm.elements[i].id == \'table\')';
-                $str .= ' {';
-                $str .= ' table = thisfrm.elements[i].value;';
-                $str .= ' }';
-                $str .= ' else if(thisfrm.elements[i].id == \'coll_id\')';
-                $str .= ' {';
-                $str .= ' coll_id = thisfrm.elements[i].value;';
-                $str .= ' }';
-                $str .= ' else if(thisfrm.elements[i].id == \'module\')';
-                $str .= ' {';
-                $str .= ' module = thisfrm.elements[i].value;';
-                $str .= ' }';
-                $str .= ' }';
-                $str .= ' val = val.substr(0, val.length -1);';
-                $str .= ' var val_frm = {\'values\' : val,  \'action_id\' : action_id, \'table\' : table, \'coll_id\' : coll_id, \'module\' : module};';
-                $str .= ' if(res_id && res_id != \'\')';
-                $str .= ' {';
-                $str .= ' val_frm[\'values\'] = res_id;';
-                $str .= ' }';
-                $str .= ' if(id_action && id_action != \'\')';
-                $str .= ' {';
-                $str .= ' val_frm[\'action_id\'] = id_action;';
-                $str .= ' }';
-
-                $str .= ' action_send_first_request(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&page=manage_action&module=core\', mode,  val_frm[\'action_id\'], val_frm[\'values\'], val_frm[\'table\'], val_frm[\'module\'], val_frm[\'coll_id\']);';
-                $str .= ' }';
-                $str .= ' else';
-                $str .= ' {';
-                $str .= ' alert(\'Validation form error\');';
-                $str .= ' }';
-
-                $str .= 'if (mode == \'mass\')';
-                $str .= '{';
-                $str .= '   isAlreadyClick = false;';
-                $str .= '}';
-                $str .= 'else';
-                $str .= '{';
-                $str .= '   isAlreadyClick = true;';
-                $str .= '}';
-
-                $str .= '}';
-                $str .= ' }';
-                $str .= ' </script>';
-            }
-            $str .= ' <table border="0" cellspacing="0" class="'.$used_css.'" summary="">';
-            $str .= ' <thead>';
-            $str .= ' <tr>';
-            if ($bool_view_document) {
-                $str .= ' <th style="width:3%;">&nbsp;</th>';
-            }
-            if ($bool_radio_form || $bool_check_form) {
-                $str .= ' <th style="width:3%;">&nbsp;</th>';
-            }
-
-            for ($count_column = 0; $count_column < count($listcolumn); ++$count_column) {
-                if ($listshow[$count_column] == true) {
-                    $str .= ' <th style="width:'.$result[0][$count_column]['size'].'%;" valign="'.$result[0][$count_column]['valign'].'"  align="'.$result[0][$count_column]['label_align'].'" ><span>'.$listcolumn[$count_column];
-
-                    if ($bool_order) {
-                        $str .= ' <br/><br/> <a class="order_items" href="'.$link.'&amp;start='.$start.'&amp;order=desc&amp;order_field='.$ordercol[$count_column].'" title="'._DESC_SORT.'"><i class="fa fa-angle-down fa-2x" title="'._DESC_SORT.'" ></i> </a> <a class="order_items" href="'.$link.'&amp;start='.$start.'&amp;order=asc&amp;order_field='.$ordercol[$count_column].'" title="'._ASC_SORT.'"> <i class="fa fa-angle-up fa-2x" title="'._ASC_SORT.'" ></i></a>';
-                    }
-                    $str .= ' </span></th>';
-                }
-            }
-            if ($bool_detail) {
-                $str .= ' <th style="width:4%;" valign="bottom" >&nbsp; </th>';
-            }
-            $str .= '</tr>';
-            $str .= ' </thead>';
-            $str .= ' <tbody>';
-            $color = '';
-
-            for ($theline = 0; $theline < $end; ++$theline) {
-                if ($color == ' class="col"') {
-                    $color = '';
-                } else {
-                    $color = ' class="col"';
-                }
-
-                $str .= ' <tr '.$color.'>';
-
-                if ($bool_radio_form || $bool_check_form) {
-                    $str .= ' <td style="width:3%;">';
-                    $str .= ' <div align="center">';
-
-                    if ($bool_radio_form) {
-                        if (count($do_actions_arr) == 0
-                             || $do_actions_arr[$theline] == true
-                         ) {
-                            $str .= '<input type="radio"  class="check" name="field" value="'.$result[$theline][0]['value'].'" class="check" />&nbsp;&nbsp;';
-                        } else {
-                            $str .= '<i class="fa fa-lock fa-2x" title="'._DOC_LOCKED.'"></i>';
-                        }
-                    } elseif ($bool_check_form) {
-                        if (!$bool_show_actions_list) {
-                            $str .= '<input type="checkbox"  class="check" name="field[]" class="check" value="'.$result[$theline][0]['value'].'" />&nbsp;&nbsp;';
-                        } else {
-                            if (count($do_actions_arr) == 0
-                                || $do_actions_arr[$theline] == true
-                            ) {
-                                $str .= '<input type="checkbox"  class="check" name="field" class="check" value="'.$result[$theline][0]['value'].'" />&nbsp;&nbsp;';
-                            } else {
-                                $str .= '<i class="fa fa-lock fa-2x" title="'._DOC_LOCKED.'"></i>';
-                            }
-                        }
-                    }
-                    $str .= ' </div>';
-                    $str .= ' </td>';
-                }
-                if ($bool_view_document) {
-                    $str .= ' <td style="width:3%;">';
-                    $str .= ' <div align="center">';
-                    if ($bool_view_document) {
-                        $str .= '<a href="'.$_SESSION['config']['businessappurl'].'index.php?display=true&amp;dir=indexing_searching&amp;page=view_resource_controler&amp;id='.$result[$theline][0][$key].'" target="_blank" title="'._VIEW_DOC.'">';
-                        $str .= ' <i class="fa fa-download fa-2x" title="'._VIEW_DOC.'"></i></a>';
-                    }
-                    $str .= ' </div>';
-                    $str .= ' </td>';
-                }
-                for ($count_column = 0; $count_column < count($listcolumn); ++$count_column) {
-                    if (isset($result[$theline][$count_column]['show'])
-                        && $result[$theline][$count_column]['show'] == true
-                    ) {
-                        if ($do_action && !empty($id_action)
-                            && (count($do_actions_arr) == 0
-                                || $do_actions_arr[$theline] == true)
-                        ) {
-                            $str .= ' <td style="width:'
-                                 .$result[$theline][$count_column]['size']
-                                 .'%;" align="'
-                                 .$result[$theline][$count_column]['align']
-                                 .'" onclick="valid_form( \'page\', \''
-                                 .$result[$theline][0]['value'].'\', \''
-                                 .$id_action.'\');" ';
-                            if (isset($result[$theline][$count_column]['css_style'])) {
-                                $str .= $result[$theline][$count_column]['css_style'];
-                            }
-                            $str .= '>'.functions::show_str(
-                                     self::thisword(
-                                         $result[$theline][$count_column]['value'],
-                                         $what
-                                     )
-                                 ).'</td>';
-                        } elseif ($do_action && !empty($id_action) && $do_actions_arr[$theline] == false) {
-                            $str .= ' <td style="width:'.$result[$theline][$count_column]['size'].'%;" align="'.$result[$theline][$count_column]['align'].'" '.$result[$theline][$count_column]['css_style'].'><em>'.functions::show_str(self::thisword($result[$theline][$count_column]['value'], $what)).'</em></td>';
-                        } elseif ($link_in_line) {
-                            $str .= ' <script type="text/javascript">';
-                            $str .= ' var window2 = null;';
-                            $str .= ' function openpopup(linkpage)';
-                            $str .= ' {';
-                            $str .= ' if(window2 == null)';
-                            $str .= ' {';
-                            $str .= ' window2=window.open(linkpage);';
-                            $str .= ' }';
-                            $str .= ' else';
-                            $str .= ' {';
-                            $str .= ' window2.close();';
-                            $str .= ' window2 = 0;';
-                            $str .= ' window2 = window.open(linkpage);';
-                            $str .= ' }';
-                            $str .= ' }';
-                            $str .= ' </script>';
-
-                            $str .= ' <td style="width:'.$result[$theline][$count_column]['size'].'%;" align="'.$result[$theline][$count_column]['align'].'" onclick="openpopup(\''.$detail_destination.'?id='.$result[$theline][0]['value'].'\');" '.$result[$theline][$count_column]['css_style'].'>'.functions::show_str(self::thisword($result[$theline][$count_column]['value'], $what)).'</td>';
-                        } else {
-                            $str .= ' <td style="width:'.$result[$theline][$count_column]['size'].'%;" align="'.$result[$theline][$count_column]['align'].'" ';
-                            if (isset($result[$theline][$count_column]['css_style'])) {
-                                $str .= $result[$theline][$count_column]['css_style'];
-                            }
-                            $str .= '>'.functions::show_str(self::thisword($result[$theline][$count_column]['value'], $what)).'</td>';
-                        }
-                    }
-                }
-                if ($bool_detail) {
-                    if ($bool_frame && $open_details_popup) {
-                        $str .= ' <td style="width:4%;"  align="center"><div align="right">';
-                        $str .= ' <a href="javascript:window.open(\''.$_SESSION['config']['businessappurl'].'index.php?page='.$detail_destination.'&amp;id='.$result[$theline][0][$key].'\',\'_parent\',\'_parent\');" title="'._DETAILS.'"><i class="fa fa-info-circle fa-2x" title="'._DETAILS.'"></i></a></div>';
-                        $str .= ' </td>';
-                    } elseif ($bool_frame && !$open_details_popup) {
-                        $str .= '<td style="width:4%;"  align="center">';
-                        $str .= '<a href="#" title="'._DETAILS.'" onclick="javascript:window.top.location=\''.$_SESSION['config']['businessappurl'].'index.php?page='.$detail_destination.'&amp;id='.$result[$theline][0][$key].'\';return false;"><i class="fa fa-info-circle fa-2x" title="'._DETAILS.'"></a>';
-                        $str .= ' </td>';
-                    } else {
-                        $str .= ' <td style="width:4%;"  align="center"><div align="right">
-                                <a href="'.$_SESSION['config']['businessappurl'].'index.php?page='.$detail_destination.'&amp;id='.$result[$theline][0][$key].'" title="'._DETAILS.'"><i class="fa fa-info-circle fa-2x" title="'._DETAILS.'"></i></a></div>';
-                        $str .= ' </td>';
-                    }
-                }
-                $str .= ' </tr>';
-            }
-            $str .= '</tbody>';
-            $str .= ' </table>';
-            $str .= ' <br/>';
-            if (($bool_radio_form || $bool_check_form) && count($result) > 0 && !$bool_show_actions_list) {
-                $str .= ' <p align="center">';
-                $str .= ' <input class="button" type="submit" value="'.$button_label.'"  />';
-                if ($show_close) {
-                    $str .= ' <input type="button" class="button" name="cancel" value="'._CLOSE_WINDOW.'" onclick="window.top.close();" />';
-                }
-                $str .= ' </p>';
-                $str .= ' </form>';
-                $str .= ' <br/>';
-            } elseif (($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) {
-                $str .= ' <p align="center">';
-                $str .= ' <b>'._ACTIONS.' :</b>';
-                $str .= ' <select name="action" id="action">';
-                $str .= ' <option value="">'._CHOOSE_ACTION.'</option>';
-                for ($ind_act = 0; $ind_act < count($actions); ++$ind_act) {
-                    $str .= ' <option value="'.$actions[$ind_act]['VALUE'].'">'.$actions[$ind_act]['LABEL'].'</option>';
-                }
-                $str .= ' </select>';
-                $str .= ' <input type="button" name="send" id="send" value="'._VALIDATE.'" onclick="valid_form(\'mass\');" class="button" />';
-                $str .= ' </p>';
-                $str .= ' </form>';
-                $str .= ' <br/>';
-            } elseif ($do_action) {
-                $str .= ' </form>';
-            } elseif ($show_close) {
-                $str .= ' <input type="button" class="button" name="cancel" value="'._CLOSE_WINDOW.'" onclick="window.top.close();" />';
-            }
-            if ($bool_export) {
-                $str .= '<div style="text-align: right;"><input type="button" onclick="window.open(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&page=export\', \'_blank\');" class="button" name="submit" value="'._EXPORT_LIST.'" /></div>';
-            }
-            if ($mode_string) {
-                return $str;
-            } else {
-                echo $str;
-            }
-        }
-    }
-
-    /**
-     * Mark with a color background the word you're searching in the detail of the row.
-     *
-     * @param string $words
-     * @param string $need
-     *
-     * @return string $words
-     * @return string $size
-     */
-    protected static function thisword($words, $need, $is_split = false, $size = 70)
-    {
-        // mark with a color background the word you're searching in the detail of the row
-        if (!$is_split || strlen($words) < $size) {
-            if (strlen($need) > 3) {
-                $ar_need = explode(' ', $need);
-
-                for ($i = 0; $i < count($ar_need); ++$i) {
-                    $save_ar_need = '';
-                    $pos = stripos($words, $ar_need[$i]);
-
-                    if ($pos !== false) {
-                        $save_ar_need = substr($words, $pos, strlen($ar_need[$i]));
-                    }
-
-                    $words = preg_replace('/('.$ar_need[$i].')/i', '<span class="thisword">'.$save_ar_need.'</span>', $words);
-                }
-            }
-        } else {
-            $i = 0;
-            $newwords = '';
-            if (preg_match('/@/', $words)) {
-                $tab_words = preg_split('/@/', $words);
-                $newwords = $tab_words[0].'@<br/>'.$tab_words[1];
-            } elseif (!preg_match('/ /', $words)) {
-                while (true) {
-                    if (strlen(substr($words, $i)) > $size) {
-                        $newwords .= '<br/>'.substr($words, $i, $size);
-
-                        $i = $i + $size;
-                    } else {
-                        $newwords .= '<br/>'.substr($words, $i);
-                        break;
-                    }
-                }
-            } else {
-                $newwords = $words;
-            }
-            /*while(true)
-            {
-                if(strlen(substr($words, $i)) > $size)
-                {
-                    $newwords .= '<br/>'.substr($words,$i,  $size);
-
-                    $i = $i + $size ;
-                }
-                else
-                {
-                    $newwords .= '<br/>'.substr($words,$i);
-                    break;
-                }
-
-            }*/
-            $words = $newwords;
-            //$words = $words. '<br/>[...]';
-        }
-
-        return $words;
-    }
-
-    /* *
-    * show the alphabetical list
-    *
-    * @param string $page the page (users, groups,...)
-    * @param string $all_text txt to say all item
-    * @param string $button_text text of button
-    * @param string $alpha_text text of the alphabetical list
-    */
-    public static function listletters($link, $page, $all_text, $button_text, $alpha_list_text, $show_searchbox = true, $autoCompletion = false, $autoCompletionArray2 = array(), $whatinput = 'what', $whatListinput = 'whatList')
-    {
-        $link = preg_replace('/(&(?!amp;))/', '&amp;', $link); ?>
-        <div id="list_letter">
-        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="forms" summary="">
-          <tr>
-            <td >
-                <strong><?php echo $alpha_list_text; ?></strong> :
-                <?php  for ($i = ord('A'); $i <= ord('Z'); ++$i) {
-            ?>
-                    <a  href="<?php echo $link; ?>&amp;<?php functions::xecho($whatinput); ?>=<?php echo chr($i); ?>"><?php echo chr($i); ?></a>
-                    <?php
-        } ?>
-                - <a href="<?php echo $link; ?>&amp;<?php functions::xecho($whatinput); ?>="><?php echo $all_text; ?></a>
-            </td>
-            <td  align="right">
-            <?php
-            if ($show_searchbox) {
-                ?>
-                <form action="<?php echo $link; ?>" method="post" id="frmletters">
-                    <div>
-                    <input name="<?php functions::xecho($whatinput); ?>" id="<?php functions::xecho($whatinput); ?>" type="text" size="15"/>
-                    <?php
-                    if ($autoCompletion) {
-                        //preg_replace("/(&(?!amp;))/", "&amp;",$autoCompletionArray2['list_script_url']) ?>
-                        <div id="<?php functions::xecho($whatListinput); ?>" class="autocomplete"></div>
-                        <script type="text/javascript">
-                        <?php if ($autoCompletionArray2['searchBoxAutoCompletionUpdate']) {
-                            ?>
-                                launch_autocompleter_update('<?php echo $autoCompletionArray2['list_script_url']; ?>', '<?php functions::xecho($whatinput); ?>', '<?php functions::xecho($whatListinput); ?>', '<?php functions::xecho($autoCompletionArray2['number_to_begin']); ?>', 'selectedObject')
-                            <?php
-                        } else {
-                            ?>
-                                initList('<?php functions::xecho($whatinput); ?>', '<?php functions::xecho($whatListinput); ?>', '<?php echo $autoCompletionArray2['list_script_url']; ?>', 'what', '<?php functions::xecho($autoCompletionArray2['number_to_begin']); ?>');
-                            <?php
-                        } ?>
-                        </script>
-                        <input type="hidden" name="selectedObject" id="selectedObject" />
-                        <?php
-                    } ?>
-                    <input name="Submit" class="button" type="submit" value="<?php functions::xecho($button_text); ?>"/>
-                </div>
-                </form>
-                <?php
-            } else {
-                echo '&nbsp;&nbsp;';
-            } ?>
-            </td>
-          </tr>
-        </table>
-        </div>
-        <?php
-    }
-
-    /* *
-    * show an administration list
-    * @param array $result result of a request
-    * @param integer $nb_total total number of items
-    * @param string $title list title
-    * @param string $expr search expression
-    * @param string $name  the calling page
-    * @param string $key the key seach for the form
-    * @param boolean $bool_order boolean to show the order icons or not
-    * @param boolean $page_name_up modification page
-    * @param boolean $page_name_val validation page
-    * @param boolean $page_name_ban suspend page
-    * @param boolean $page_name_del delete page
-    * @param boolean $page_name_add  page to add a new item
-    * @param boolean $label_add
-    * @param boolean $bool_history FALSE by default, is the list an hisory list ?
-    * @param boolean $bool_simple_list FALSE by default, shows or not the radio or checkbox
-    * @param string $all_sentence
-    * @param string $whatname
-    * @param string $picto_path
-    * @param string $is_part_of_module
-    * @param string $show_big_title
-    * @param string $flag_not_admin
-    */
-    public static function admin_list($result, $nb_total, $title, $expr, $name, $admin, $key, $bool_order, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, $bool_history = false, $bool_simple_list = false, $all_sentence = '', $whatname = '', $picto_path = '', $is_part_of_module = false, $show_big_title = true, $flag_not_admin = false, $show_listletters = true, $what = '', $autoCompletion = false, $autoCompletionArray = array(), $is_in_apps_dir = false, $is_del_page_popup = false, $whatinput = 'what', $whatListinput = 'whatList')
-    {
-        // show the document list in result of the search
-        $page_list1 = '';
-        $page_list2 = '';
-        $link = '';
-        //$listvalue = array();
-        $listcolumn = array();
-        $listshow = array();
-        $ordercol = array();
-        for ($i = 0; $i < 1; ++$i) {
-            if (isset($result[$i])) {
-                for ($j = 0; $j < count($result[$i]); ++$j) {
-                    if (isset($result[$i][$j]['label'])) {
-                        array_push($listcolumn, $result[$i][$j]['label']);
-                    } else {
-                        array_push($listcolumn, '');
-                    }
-                    if (isset($listshow,$result[$i][$j]['show'])) {
-                        array_push($listshow, $result[$i][$j]['show']);
-                    } else {
-                        array_push($listshow, true);
-                    }
-                    if (isset($result[$i][$j]['order'])) {
-                        array_push($ordercol, $result[$i][$j]['order']);
-                    } else {
-                        array_push($ordercol, '');
-                    }
-                }
-            }
-        }
-
-        $func = new functions();
-        $param_comp = '';
-  
-        $start = $_REQUEST['start'];
-      
-        $param_comp .= '&amp;start=0';
-        if ($name == 'structures' || $name == 'subfolders' || $name == 'types' || $name == 'contact_types' || $name == 'contact_purposes' || $name == 'contacts_v2' || $name == 'contacts_v2_up' || $name == 'contact_addresses_list') {
-            $link = $_SESSION['config']['businessappurl'].'index.php?page='.$name;
-        } else {
-            if ($is_part_of_module == false && $is_in_apps_dir == false) {
-                $link = $_SESSION['config']['businessappurl'].'index.php?page='.$name.'&amp;admin='.$admin;
-            } elseif ($is_in_apps_dir) {
-                $link = $_SESSION['config']['businessappurl'].'index.php?page='.$name.'&amp;dir='.$admin;
-            } else {
-                $link = $_SESSION['config']['businessappurl'].'index.php?page='.$name.'&amp;module='.$admin;
-            }
-        }
-
-        if (isset($_REQUEST['order'])) {
-            $orderby = strip_tags($_REQUEST['order']);
-        } else {
-            $orderby = 'asc';
-        }
-        $param_comp .= '&amp;order='.$orderby;
-        $link .= '&amp;order='.$orderby;
-
-        if (isset($_REQUEST['order_field'])) {
-            $orderfield = strip_tags($_REQUEST['order_field']);
-        } else {
-            $orderfield = '';
-        }
-        $link .= '&amp;order_field='.$orderfield;
-        $param_comp .= '&amp;order_field='.$orderfield;
-        if (isset($_REQUEST['what'])) {
-            $get_what = strip_tags($_REQUEST['what']);
-            $get_what = str_replace('"', '%22', $get_what);
-        } else {
-            $get_what = '';
-        }
-        $link .= '&amp;what='.$get_what;
-        $param_comp .= '&amp;what='.$what;
-        // define the defaults values
-        $nb_show = $_SESSION['config']['nblinetoshow'];
-        $current_page = ceil((int)$start / $nb_show)+1;
-        $nb_pages = ceil($nb_total / $nb_show);
-
-        if ($nb_pages > 500) {
-            $nb_pages = 500;
-        }
-        if (!empty($what)) {
-            $link .= '&amp;what='.$what;
-        }
-
-        $link = preg_replace('/(&(?!amp;))/', '&amp;', $link);
-        // if they are more 1 page we do pagination with 2 forms
-        if ($nb_pages > 1) {
-            $next_start = 0;
-
-            $page_list1 = '<form  id="newpage1" method="get" action="'.urldecode($link).'" >
-            <p>
-                <label for="startpage">'._GO_TO_PAGE.'</label>
-                <select name="startpage" id="startpage" class="small" onchange="window.location.href=\''.$link.'&amp;start=\'+$(\'newpage1\').startpage.value;">';
-
-            $lastpage = 0;
-
-            for ($i = 0; $i != $nb_pages; ++$i) {
-                $page_name = $i + 1;
-
-                $the_line = $i + 1;
-                if ($current_page == $the_line) {
-                    $page_list1 .= '<option value="'.$next_start.'" selected="selected">'.$the_line.'</option>';
-                    $page_list2 .= '<option value="'.$next_start.'"  selected="selected">'.$the_line.'</option>';
-                } else {
-                    $page_list1 .= '<option value="'.$next_start.'">'.$the_line.'</option>';
-                    $page_list2 .= '<option value="'.$next_start.'">'.$the_line.'</option>';
-                }
-
-                $next_start = $next_start + $nb_show;
-                $lastpage = $next_start;
-            }
-
-            $lastpage = $lastpage - $nb_show;
-
-            $previous = '';
-            $next = '';
-            $page_list1 = $page_list1.'</select>';
-            if ($start > 0) {
-                $start_prev = $start - $nb_show;
-                $previous = '<a href="'.$link.'&amp;start='.$start_prev.'"><i class="fa fa-backward" title="'._PREVIOUS.'"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;';
-            }
-
-            if ($start != $lastpage) {
-                $start_next = $start + $nb_show;
-                $next = ' <a href="'.$link.'&amp;start='.$start_next.'"><i class="fa fa-forward" title="'._NEXT.'"></i></a>';
-            }
-
-            $page_list1 .= $previous.' '.$next.'</p></form>';
-        }
-        if ($show_big_title) {
-            echo '<h1>';
-            if (!empty($picto_path)) {
-                echo '<i class="fa fa-'.$picto_path.' fa-2x"></i> ';
-            }
-            echo $title.'</h1>'; ?><div id="inner_content" class="clearfix"><?php
-        } else {
-            echo '<h2>';
-            if (!empty($picto_path)) {
-                echo '<i class="fa fa-'.$picto_path.' fa-2x"></i> ';
-            }
-            echo $title.'</h2>';
-            echo ' <div class="text-align">';
-        }
-
-        if (!$bool_history) {
-            if ($show_listletters) {
-                if (!$autoCompletion) {
-                    self::listletters($link, $name, $all_sentence, _SEARCH.' '.$whatname, _ALPHABETICAL_LIST);
-                } else {
-                    self::listletters($link, $name, $all_sentence, _SEARCH.' '.$whatname, _ALPHABETICAL_LIST, true, $autoCompletion, $autoCompletionArray, $whatinput, $whatListinput);
-                }
-            }
-        }
-        echo $page_list1; ?>
-        <table width="100%" border="0" cellspacing="0" class="listing spec" summary="">
-            <thead>
-                <tr>
-            <?php
-
-                for ($count_column = 0; $count_column < count($listcolumn); ++$count_column) {
-                    if ($listshow[$count_column] == true) {
-                        ?>
-                        <th <?php if (isset($result[0][$count_column]['size'])) {
-                            ?>style="width:<?php functions::xecho($result[0][$count_column]['size']); ?>%;"<?php
-                        }
-                        if (isset($result[0][$count_column]['valign'])) {
-                            ?> valign="<?php functions::xecho($result[0][$count_column]['valign']); ?>"<?php
-                        }
-                        if (isset($result[0][$count_column]['label_align'])) {
-                            ?> align="<?php functions::xecho($result[0][$count_column]['label_align']); ?>"<?php
-                        } ?>
-                         ><span>&nbsp;<?php echo $listcolumn[$count_column]; ?>
-                         <?php  if ($bool_order && !empty($ordercol[$count_column])) {
-                            ?> <br/> <a href="<?php echo $link; ?>&amp;start=<?php functions::xecho($start); ?>&amp;order=desc&amp;order_field=<?php functions::xecho($result['0'][$count_column]['column']); ?>" title="<?php echo _DESC_SORT; ?>"><i class="fa fa-angle-down fa-2x" title="<?php echo _DESC_SORT; ?>" ></i> </a> <a href="<?php echo $link; ?>&amp;start=<?php functions::xecho($start); ?>&amp;order=asc&amp;order_field=<?php functions::xecho($result['0'][$count_column]['column']); ?>" title="<?php echo _ASC_SORT; ?>"> <i class="fa fa-angle-up fa-2x" title="<?php echo _ASC_SORT; ?>" ></i></a> <?php
-                        } ?></span></th>
-                        <?php
-                    }
-                } ?>
-                </tr>
-            </thead>
-
-            <?php
-            if (!$bool_history && !$bool_simple_list) {
-                if (!$is_part_of_module && !$flag_not_admin && !$is_in_apps_dir) {
-                    $path_add = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_add.'&amp;admin='.$admin;
-                } elseif ($flag_not_admin && !$is_in_apps_dir) {
-                    $path_add = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_add;
-                } elseif ($is_in_apps_dir) {
-                    $path_add = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_add.'&amp;dir='.$admin;
-                } else {
-                    $path_add = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_add.'&amp;module='.$admin;
-                }
-                if (!empty($page_name_add)) {
-                    $path_add = preg_replace('/(&(?!amp;))/', '&amp;', $path_add); ?>
-                <tfoot>
-                    <tr>
-                        <td colspan="9" class="price">
-                            <!--<span class="add clearfix">
-                                <a href="<?php echo $path_add.$param_comp; ?>">
-                                    <span>
-                                        <?php functions::xecho($label_add); ?>
-                                    </span>
-                                </a>
-                            </span>-->
-                            <a href="<?php echo $path_add.$param_comp; ?>">
-                                <i class="fa fa-plus-square fa-3x" title="<?php functions::xecho($label_add); ?>"></i>
-                            </a>
-                        </td>
-                    </tr>
-                </tfoot>
-                <?php
-                }
-            } elseif ($bool_simple_list) {
-                $width = '450';
-                if ($name == 'structures') {
-                    $height = '570';
-                    $width = '600';
-                } elseif ($page_name_up == 'contrat_up' || $name == 'contacts_v2') {
-                    $height = '750';
-                } elseif ($name == 'types') {
-                    $height = '650';
-                } else {
-                    $height = '250';
-                }
-                if ($admin == 'types' || $admin == 'structures' || $admin == 'subfolders' || $admin == 'contact_types' || $admin == 'contact_purposes' || $admin == 'contacts_v2' || $admin == 'contact_addresses' || $admin == 'contact_addresses_list') {
-                    //$path_root = $_SESSION['config']['businessappurl']."admin/architecture/".$admin."/";
-                    $path_root = $_SESSION['config']['businessappurl'].'index.php?display=true';
-                } else {
-                    if (!$is_part_of_module) {
-                        //$path_root = $_SESSION['config']['businessappurl']."admin/".$admin."/";
-                        $path_root = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;admin='.$admin;
-                    } else {
-                        //$path_root = $_SESSION['urltomodules'].$admin."/";
-                        $path_root = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;module='.$admin;
-                    }
-                }
-                if (!empty($page_name_add)) {
-                    ?>
-                    <tfoot>
-                         <tr>
-                            <td colspan="<?php  if ($name != 'types') {
-                        echo'7';
-                    } else {
-                        echo '5';
-                    } ?>" class="price">
-                                <!--<span class="add clearfix">
-                                    <a href="javascript://" onclick="window.open('<?php 
-                                        echo $path_root;
-                    if ($name != 'types' && $name != 'contacts_v2' && $name != 'contact_addresses') {
-                        echo '&amp;page='.$page_name_up; ?>&amp;mode=add<?php
-                    } else {
-                        echo  '&amp;page='.$page_name_add;
-                    } ?>','add','height=250, width=500, resizable=yes, scrollbars=yes');" >
-                                        <span><?php functions::xecho($label_add); ?></span>
-                                    </a>
-                                </span>-->
-                                <a href="javascript://" onclick="window.open('<?php 
-                                    echo $path_root;
-                    if ($name != 'types' && $name != 'contacts_v2' && $name != 'contact_addresses') {
-                        echo '&amp;page='.$page_name_up; ?>&amp;mode=add<?php
-                    } else {
-                        echo  '&amp;page='.$page_name_add;
-                    } ?>','add','height=<?php functions::xecho($height); ?>, width=<?php functions::xecho($width); ?>, resizable=yes, scrollbars=yes');" >
-                                    <i class="fa fa-plus-square fa-3x" title="<?php functions::xecho($label_add); ?>"></i>
-                                </a>
-                            </td>
-                        </tr>
-                    </tfoot>
-                    <?php
-                }
-            } ?>
-        <tbody>
-        <?php
-        $color = '';
-        for ($theline = 0; $theline < count($result); ++$theline) {
-            // background color
-            if ($color == ' class="col"') {
-                $color = '';
-            } else {
-                $color = ' class="col"';
-            } ?>
-            <tr <?php echo $color; ?>>
-                    <?php
-                    $enabled = '';
-            if (isset($page_name) && $page_name == 'users') {
-                $complete_name = '';
-            } else {
-                $admin_id = '';
-            }
-            $can_modify = true;
-            $can_delete = true;
-            for ($count_column = 0; $count_column < count($listcolumn); ++$count_column) {
-                if (isset($result[$theline][$count_column]['show']) && $result[$theline][$count_column]['show'] == true) {
-                    ?>
-                           <td style="width:<?php functions::xecho($result[$theline][$count_column]['size']); ?>%;" align="<?php functions::xecho($result[$theline][$count_column]['align']); ?>">
-
-                            <?php
-                                if ($result[$theline][$count_column]['column'] == 'enabled') {
-                                    $enabled = $result[$theline][$count_column]['enabled'];
-
-                                    if ($result[$theline][$count_column]['enabled'] == 'N') {
-                                        ?>
-                                    <i class="fa fa-pause fa-2x" title="<?php echo _NOT_ENABLED; ?>"></i>
-                                    <?php
-                                    } elseif ($result[$theline][$count_column]['enabled'] == 'Y') {
-                                        ?>
-                                    <i class="fa fa-check fa-2x" title="<?php echo _ENABLED; ?>"></i>
-                                    <?php
-                                    }
-                                } else {
-                                    if (isset($page_name) && $page_name == 'users') {
-                                        if ($result[$theline][$count_column]['column'] == 'lastname' || $result[$theline][$count_column]['column'] == 'firstname') {
-                                            $complete_name .= ' '.$result[$theline][$count_column]['value'];
-                                        }
-                                    } else {
-                                        $admin_id = $result[$theline][0][$key];
-                                    }
-                                    if ($name == 'types' || $name == 'groups' || $name == 'contrat' || $name == 'sous_dossiers' || $name == 'hist') {
-                                        echo $result[$theline][$count_column]['value'];
-                                    } else {
-                                        echo functions::show_str($result[$theline][$count_column]['value']);
-                                    }
-                                } ?>
-                                </td>
-                    <?php
-                } elseif (isset($result[$theline][$count_column]['can_modify']) && $result[$theline][$count_column]['can_modify'] == 'false') {
-                    $can_modify = false;
-                } elseif (
-                            isset($result[$theline][$count_column]['can_delete'])
-                            && ($result[$theline][$count_column]['can_delete'] == 'false'
-                            || $result[$theline][$count_column]['can_delete'] == 'N')) {
-                    $can_delete = false;
-                }
-            }
-            if (!$bool_history && !$bool_simple_list) {
-                $valeur = str_replace('&#039;', "'", $result[$theline][0][$key]);
-                $valeur = str_replace('&', '%26', $valeur);
-                $valeur = str_replace('#', '%23', $valeur);
-
-                if (!$is_part_of_module && !$flag_not_admin && !$is_in_apps_dir) {
-                    $path_up = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_up.'&amp;admin='.$admin.'&amp;id='.$valeur;
-                } elseif ($flag_not_admin && !$is_in_apps_dir) {
-                    $path_up = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_up.'&amp;id='.$valeur;
-                } elseif ($is_in_apps_dir) {
-                    $path_up = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_up.'&amp;dir='.$admin.'&amp;id='.$valeur;
-                } else {
-                    $path_up = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_up.'&amp;module='.$admin.'&amp;id='.$valeur;
-                } ?>
-
-                    <td class="action">
-                        <?php
-                        if ($can_modify == false) {
-                            echo '&nbsp;';
-                        } else {
-                            $path_up = preg_replace('/(&(?!amp;))/', '&amp;', $path_up); ?>
-                        <a href="<?php echo $path_up.$param_comp; ?>" class="actionList"><i class="fa fa-edit fa-2x" title="<?php echo _MODIFY; ?>"></i><?php //echo _MODIFY;?></a>
-                        <?php
-                        } ?>
-                    </td>
-                    <?php  if ($name != 'types') {
-                            ?>
-                    <td class="action">
-                    <?php
-                            if ($enabled == 'N') {
-                                if (!$is_part_of_module) {
-                                    //$path_auth = $_SESSION['config']['businessappurl'].'admin/'.$admin.'/'.$page_name_val.".php?id=".$result[$theline][0][$key];
-                                    if (strpos($page_name_val, 'contacts_v2_status') !== false || strpos($page_name_ban, 'contact_addresses_status') !== false) {
-                                        $path_auth = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_val.'&amp;id='.$result[$theline][0][$key];
-                                    } else {
-                                        $path_auth = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;admin='.$admin.'&amp;page='.$page_name_val.'&amp;id='.$result[$theline][0][$key];
-                                    }
-                                } else {
-                                    //$path_auth = $_SESSION['urltomodules'].$admin.'/'.$page_name_val.".php?id=".$result[$theline][0][$key];
-                                    $path_auth = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;module='.$admin.'&amp;page='.$page_name_val.'&amp;id='.$result[$theline][0][$key];
-                                }
-                                if ($name == 'users' && $result[$theline][0][$key] == 'superadmin') {
-                                    echo '&nbsp;';
-                                } else {
-                                    $path_auth = preg_replace('/(&(?!amp;))/', '&amp;', $path_auth); ?>
-                                <a href="<?php echo $path_auth.$param_comp; ?>" class="actionList" onclick="return(confirm('<?php echo _REALLY_AUTHORIZE.' ';
-                                    if (isset($page_name) && $page_name == 'users') {
-                                        echo $complete_name;
-                                    } else {
-                                        echo $admin_id;
-                                    } ?> ?'));"><i class="fa fa-check fa-2x" title="<?php echo _AUTHORIZE; ?>"></i></a>
-                                <?php
-                                }
-                            } else {
-                                if (!empty($page_name_ban)) {
-                                    if (!$is_part_of_module) {
-                                        if (strpos($page_name_ban, 'contacts_v2_status') !== false || strpos($page_name_ban, 'contact_addresses_status') !== false) {
-                                            $path_ban = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_ban.'&amp;id='.$result[$theline][0][$key];
-                                        } else {
-                                            // $path_ban = $_SESSION['config']['businessappurl'].'admin/'.$admin.'/'.$page_name_ban.".php?id=".$result[$theline][0][$key];
-                                            $path_ban = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;admin='.$admin.'&amp;page='.$page_name_ban.'&id='.$result[$theline][0][$key];
-                                        }
-                                    } else {
-                                        //$path_ban = $_SESSION['urltomodules'].$admin.'/'.$page_name_ban.".php?id=".$result[$theline][0][$key];
-                                        $path_ban = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;module='.$admin.'&amp;page='.$page_name_ban.'&amp;id='.$result[$theline][0][$key];
-                                    }
-                                    if ($name == 'users' && $result[$theline][0][$key] == 'superadmin') {
-                                        echo '&nbsp;';
-                                    } else {
-                                        $path_ban = preg_replace('/(&(?!amp;))/', '&amp;', $path_ban);
-                                        $item_mode = null;
-                                        if ($_REQUEST['page'] == 'users_management_controler') {
-                                        } else {
-                                                ?>
-                                        <a href="<?php echo $path_ban.$param_comp; ?>" class="actionList" onclick="return(confirm('<?php echo _REALLY_SUSPEND.' ';
-                                                if (isset($page_name) && $page_name == 'users') {
-                                                    echo $complete_name;
-                                                } else {
-                                                    echo $admin_id;
-                                                } ?> ?'));"><i class="fa fa-pause fa-2x" title="<?php echo _SUSPEND; ?>"></i></a>
-
-
-                                        <?php
-                                            }
-                                    }
-                                }
-                            } ?>
-                    </td>
-                    <?php
-                        } ?>
-                    <td class="action" >
-                    <?php
-                    if (!empty($page_name_del)) {
-                        if (!$is_part_of_module && !$flag_not_admin && !$is_in_apps_dir) {
-                            //$path_del = $_SESSION['config']['businessappurl'].'admin/'.$admin.'/'.$page_name_del.".php?id=".$result[$theline][0][$key]."&amp;admin=".$admin;
-                            $path_del = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_del.'&amp;id='.$result[$theline][0][$key].'&amp;admin='.$admin;
-                        } elseif ($flag_not_admin && !$is_in_apps_dir) {
-                            $is_del_page_popup = true;
-                            //$path_del = "index.php?page=".$page_name_del."&id=".$result[$theline][0][$key];
-                            $path_del = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_del.'&amp;id='.$result[$theline][0][$key];
-                        } elseif ($is_in_apps_dir) {
-                            //$path_del = $_SESSION['config']['businessappurl'].$admin.'/'.$page_name_del.".php?id=".$result[$theline][0][$key]."&amp;dir=".$admin;
-                            $path_del = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_del.'&amp;id='.$result[$theline][0][$key].'&amp;dir='.$admin;
-                        } else {
-                            //$path_del = $_SESSION['urltomodules'].$admin.'/'.$page_name_del.".php?id=".$result[$theline][0][$key]."&amp;module=".$admin;
-                            $path_del = $_SESSION['config']['businessappurl'].'index.php?page='.$page_name_del.'&amp;id='.$result[$theline][0][$key].'&amp;module='.$admin;
-                        }
-                        if (!$is_del_page_popup) {
-                            $path_del .= '&amp;display=true';
-                        }
-                        if ($can_delete == false || $name == 'users' && $result[$theline][0][$key] == 'superadmin') {
-                            echo '&nbsp;';
-                        } else {
-                            $path_del = preg_replace('/(&(?!amp;))/', '&amp;', $path_del); ?>
-                            <a href="<?php echo $path_del.$param_comp; ?>"  class="actionList"
-                        onclick="return(confirm('<?php echo _REALLY_DELETE.' ';
-                            if (isset($page_name) && $page_name == 'users') {
-                                echo $complete_name;
-                            } else {
-                                echo $admin_id;
-                            } ?> ?\n\r\n\r<?php echo _DEFINITIVE_ACTION; ?>'));"><i class="fa fa-times fa-2x" title="<?php echo _DELETE; ?>"></i></a>
-                        <?php
-                        }
-                    } ?>
-                    </td>
-                    <?php
-            } elseif ($bool_simple_list) {
-                $width = '450';
-                if ($name == 'structures') {
-                    $height = '570';
-                    $width = '600';
-                } elseif ($page_name_up == 'contrat_up') {
-                    $height = '750';
-                } elseif ($name == 'types') {
-                    $height = '650';
-                } else {
-                    $height = '250';
-                }
-
-                if ($admin == 'types' || $admin == 'structures' || $admin == 'subfolders' || $admin == 'contact_types' || $admin == 'contact_purposes' || $admin == 'contacts_v2' || $admin == 'contact_addresses' || $admin == 'contact_addresses_list') {
-                    $path_up2 = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;page='.$page_name_up.'&amp;mode=up&amp;id='.$result[$theline][0][$key];
-                    $path_del2 = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;page='.$page_name_del.'&amp;id='.$result[$theline][0][$key];
-                } elseif (!$is_part_of_module) {
-                    $path_up2 = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;page='.$page_name_up.'&amp;mode=up&amp;id='.$result[$theline][0][$key].'&amp;admin='.$admin;
-                    $path_del2 = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;page='.$page_name_del.'&amp;id='.$result[$theline][0][$key].'&amp;admin='.$admin;
-                } else {
-                    $path_up2 = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;page='.$page_name_up.'&amp;mode=up&amp;id='.$result[$theline][0][$key].'&amp;module='.$admin;
-                    $path_del2 = $_SESSION['config']['businessappurl'].'index.php?display=true&amp;page='.$page_name_del.'.&amp;id='.$result[$theline][0][$key].'&amp;module='.$admin;
-                }
-                $path_up2 = preg_replace('/(&(?!amp;))/', '&amp;', $path_up2);
-                $path_del2 = preg_replace('/(&(?!amp;))/', '&amp;', $path_del2); ?>
-                        <td class="action">
-                        <a  href="javascript://" class="actionList" onclick="window.open('<?php echo $path_up2; ?>','','height=<?php functions::xecho($height); ?>, width=<?php functions::xecho($width); ?>,scrollbars=yes,resizable=yes');" ><i class="fa fa-edit fa-2x" title="<?php echo _MODIFY; ?>"></i></a>
-                    </td>
-
-                    <td class="action" >
-                        <a href="<?php echo $path_del2.$param_comp; ?>" class="actionList"
-                    onclick="return(confirm('<?php echo _REALLY_DELETE;
-                if (isset($page_name) && $page_name == 'users') {
-                    echo $complete_name;
-                } else {
-                    echo ' '.$admin_id;
-                } ?> ?\n\r\n\r<?php echo _DEFINITIVE_ACTION; ?>'));"><i class="fa fa-times fa-2x" title="<?php echo _DELETE; ?>"></i></a>
-                    </td>
-                    <?php
-            } ?>
-              </tr>
-
-
-        <?php
-        } ?>  </tbody>
-
-        </table><br/>
-        </div>
-        <?php
-        $core = new core_tools();
-        if ($core->is_module_loaded('doc_converter')) {
-            $_SESSION['doc_convert'] = array();
-            require_once 'modules'.DIRECTORY_SEPARATOR.'doc_converter'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php';
-            $doc_converter = new doc_converter();
-            $doc_converter->convert_list($result);
-        } ?>
-
-        <script>
-            $j('#container').attr('style', 'width: 90%; min-width: 1000px;');
-            $j('#content').attr('style', 'width: auto; min-width: 1000px;');
-            $j('#inner_content').attr('style', 'width: auto; min-width: 1000px;');
-            $j('table.listing').attr('style', 'width: 100%; min-width: 900px;');
-        </script>
-
-<?php
-    }
-
-    public static function define_order($order, $field)
-    {
-        // configure the sql argument order by
-        $orderby = '';
-
-        if (isset($field) && !empty($field) && (empty($order) || $order == 'asc' || $order == 'desc')) {
-            $orderby = 'order by '.$field.' '.$order;
-        }
-
-        return $orderby;
-    }
-
-    public function list_simple(
-        $result,
-        $nb_total,
-        $title,
-        $what,
-        $key,
-        $bool_view_document,
-        $page_view = '',
-        $used_css = 'listing spec',
-        $page_modify = '',
-        $height_page_modify = 400,
-        $width_page_modify = 500,
-        $page_del = '',
-        $modeString = false
-    ) {
-        //self::show_array($result);
-        $listcolumn = array();
-        $listshow = array();
-        $listformat = array();
-        $start = 0;
-        $end = $nb_total;
-        $str = '';
-        // put in tab the different label of the column
-        if (isset($result[0])) {
-            for ($j = 0; $j < count($result[0]); ++$j ) {
-                if (isset($result[0][$j]['label'])) {
-                    array_push($listcolumn, $result[0][$j]['label']);
-                } else {
-                    array_push($listcolumn, '');
-                }
-                if (isset($result[0][$j]['show'])) {
-                    array_push($listshow, $result[0][$j]['show']);
-                } else {
-                    array_push($listshow, false);
-                }
-            }
-        }
-        //self::show_array($listcolumn);
-        //self::show_array($listshow);
-        $func = new functions();
-        $nb_show = $_SESSION['config']['nblinetoshow'];
-        $str .= '<b>';
-        if (!empty($picto_path)) {
-            $str .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';
-        }
-        $str .= $title.'</b>';
-        $str .= ' <div align="center">';
-
-        $str .= '<table border="0" cellspacing="0" class="'.$used_css.'">';
-        $str .= '<thead>';
-        $str .= '<tr>';
-        if ($bool_view_document) {
-            $str .= '<th style="width:3%;">&nbsp;</th>';
-        }
-        for ($count_column = 0; $count_column < count($listcolumn); ++$count_column) {
-            if ($listshow[$count_column] == true) {
-                $str .= '<th style="width:'.$result[0][$count_column]['size']
-                                .'%;" valign="'.$result[0][$count_column]['valign']
-                                .'"  align="'.$result[0][$count_column]['label_align']
-                                .'" ><span>'.$listcolumn[$count_column].'</span>';
-            }
-        }
-        $str .= '<th style="width:4%;" valign="bottom" >&nbsp; </th>';
-        $str .= '</tr>';
-        $str .= '</thead>';
-        $str .= '<tbody>';
-        $color = '';
-        for ($theline = $start; $theline < $end; ++$theline) {
-            if ($color == ' class="col"') {
-                $color = '';
-            } else {
-                $color = ' class="col"';
-            }
-            $str .= '<tr '.$color.'>';
-            if ($bool_view_document) {
-                $str .= " <td><a href='".$page_view.'&amp;id='
-                        .$result[$theline][0][$key]
-                        ."' target=\"_blank\" title='"._VIEW_DOC."'>"
-                        .'<i class="fa fa-download fa-2x" title="'._VIEW_DOC.'"></i>'
-                        .'</a></td>';
-            }
-            $bool_modify = false;
-            $bool_del = false;
-            for ($count_column = 0; $count_column < count($listcolumn); ++$count_column ) {
-                if (isset($result[$theline][$count_column]['show'])
-                        && $result[$theline][$count_column]['show'] == true
-                    ) {
-                    $str .= '<td style="width:'
-                                .$result[$theline][$count_column]['size']
-                                .'%;" align="'
-                                .$result[$theline][$count_column]['align']
-                                .'">'
-                                .functions::show_str(self::thisword($result[$theline][$count_column]['value'], $what))
-                                .'</td>';
-                } else {
-                    if ($result[$theline][$count_column]['column'] == 'modify_item' && $result[$theline][$count_column]['value'] == true) {
-                        $bool_modify = true;
-                    }
-                    if ($result[$theline][$count_column]['column'] == 'delete_item' && $result[$theline][$count_column]['value'] == true) {
-                        $bool_del = true;
-                    }
-                }
-            }
-            if ($bool_modify) {
-                $str .= '<td class="action">';
-                $str .= '<a  href="javascript://" class="actionList" onclick="window.open(\''
-                            .$page_modify;
-                if (preg_match('/\?/', $page_modify)) {
-                    $str .= '&amp;';
-                } else {
-                    $str .= '?';
-                }
-                $str .= 'id='.$result[$theline][0][$key].'\',\'\',\'height='
-                            .$height_page_modify.', width='.$width_page_modify
-                            .',scrollbars=yes,resizable=yes\');">'
-                            .'<i class="fa fa-edit fa-2x" title="'._MODIFY.'"></i></a>';
-                $str .= '</td>';
-            } else {
-                $str .= '<td class="action">&nbsp;</td>';
-            }
-            if ($bool_del) {
-                $str .= '<td class="action">';
-                $str .= '<a href="'.$page_del.'&id='.$result[$theline][0][$key].'" class="delete"'
-                            .'onclick="return(confirm(\''._REALLY_DELETE.' ?\n\r\n\r'
-                            ._DEFINITIVE_ACTION.'\'));">'
-                            ._DELETE.'</a>';
-                $str .= '</td>';
-            } else {
-                $str .= '<td class="action">&nbsp;</td>';
-            }
-            $str .= '</tr>';
-        }
-        $str .= '</tbody>';
-        $str .= '</table>';
-        $str .= '</div>';
-        if ($modeString) {
-            return $str;
-        } else {
-            echo $str;
-        }
-    }
-}
diff --git a/apps/maarch_entreprise/class/class_list_show_with_template.php b/apps/maarch_entreprise/class/class_list_show_with_template.php
deleted file mode 100755
index 277d035ad80..00000000000
--- a/apps/maarch_entreprise/class/class_list_show_with_template.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/*
- *    Copyright 2008,2015 Maarch
- *
- *  This file is part of Maarch Framework.
- *
- *   Maarch Framework 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.
- *
- *   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
-* List Show Class
-*
-*  Contains all the function to manage and show list
-*
-* @package  Maarch
-* @version 3.0
-* @since 10/2005
-* @license GPL
-* @author  Loïc Vinet  <dev@maarch.org>
-*
-*/
-
-require_once 'apps/'. $_SESSION['config']['app_id'] .'/class/class_list_show_with_template_Abstract.php';
-
-class list_show_with_template extends list_show_with_template_Abstract
-{
-    // custom
-}
diff --git a/apps/maarch_entreprise/class/class_list_show_with_template_Abstract.php b/apps/maarch_entreprise/class/class_list_show_with_template_Abstract.php
deleted file mode 100755
index fcf25495b11..00000000000
--- a/apps/maarch_entreprise/class/class_list_show_with_template_Abstract.php
+++ /dev/null
@@ -1,842 +0,0 @@
-<?php
-
-/*
- *    Copyright 2008,2015 Maarch
- *
- *  This file is part of Maarch Framework.
- *
- *   Maarch Framework 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.
- *
- *   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * List Show Class.
- *
- *  Contains all the function to manage and show list
- *
- * @version 3.0
- *
- * @since 10/2005
- *
- * @license GPL
- * @author  Loïc Vinet  <dev@maarch.org>
- */
-abstract class list_show_with_template_Abstract extends list_show
-{
-    //Public variables
-
-    public $actual_line_css;
-    public $the_start;
-    public $the_link;
-    public $detail_destination;
-    public $bool_radio_form;
-    public $bool_check_form;
-    public $bool_view_document;
-    public $bool_detail;
-    public $do_action;
-    public $id_action;
-    public $do_action_arr;
-    public $hide_standard_list;
-
-    //Load value from db with $result tab
-    public function tmplt_load_value($actual_string, $theline, $result)
-    {
-        $my_explode = explode('|', $actual_string);
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            $to_share = $my_explode[1];
-            for ($stand = 0; $stand <= count($result[$theline]); ++$stand) {
-                if (isset($result[$theline][$stand]['column'])
-                    && $result[$theline][$stand]['column'] == $to_share
-                ) {
-                    return $result[$theline][$stand]['value'];
-                }
-            }
-        }
-    }
-
-    //Load value from db with $result tab
-    public function tmplt_load_date($actual_string, $theline, $result)
-    {
-        $my_explode = explode('|', $actual_string);
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            $to_share = $my_explode[1];
-            for ($stand = 0; $stand <= count($result[$theline]); ++$stand) {
-                if (isset($result[$theline][$stand]['column'])
-                    && $result[$theline][$stand]['column'] == $to_share
-                ) {
-                    return $this->format_date($result[$theline][$stand]['value']);
-                }
-            }
-        }
-    }
-
-    //Load css defined in $actual_string
-    public function tmplt_load_css($actual_string)
-    {
-        $my_explode = explode('|', $actual_string);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            return $my_explode[1];
-        }
-    }
-
-    //Load image from apps defined in $actual_string
-    public function tmplt_load_img($actual_string)
-    {
-        $my_explode = explode('|', $actual_string);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            return '<i class="fa fa-'.$my_explode[1].'"></i>';
-        }
-    }
-
-    //Load radio form if this parameters is loaded in list_show and list_show_with_template
-    public function tmplt_load_external_script($actual_string, $theline, $result, $key)
-    {
-        $external = '';
-        $my_explode = explode('|', $actual_string);
-        if (count($my_explode) != 3) {
-            return  _WRONG_PARAM_FOR_LOAD_VALUE;
-        }
-
-        $module_id = $my_explode[1];
-        $file_name = $my_explode[2];
-
-        include 'modules'.DIRECTORY_SEPARATOR.$module_id.DIRECTORY_SEPARATOR.$file_name;
-
-        return $external;
-    }
-
-    //Load function order from templated list
-    public function tmplt_order_link($actual_string)
-    {
-        $my_explode = explode('|', $actual_string);
-
-        if (count($my_explode) != 3) {
-            return  _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            $my_link = $this->the_link.'&amp;start='.$this->the_start.'&amp;order='.$my_explode[2].'&amp;order_field='.$my_explode[1];
-
-            return $my_link;
-        }
-    }
-
-    //Generate link to view the document
-    public function url_docview($actual_string, $theline, $result, $key)
-    {
-        $return = $_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='.$result[$theline][0][$key];
-
-        return $return;
-    }
-
-    //Generate link to view detail page
-    public function tmplt_url_docdetail($actual_string, $theline, $result, $key)
-    {
-        $return = $_SESSION['config']['businessappurl'].'index.php?page='.$this->detail_destination.'&amp;id='.$result[$theline][0][$key];
-
-        return $return;
-    }
-
-    //Load radio form if this parameters is loaded in list_show and list_show_with_template
-    public function tmplt_func_bool_radio_form($actual_string, $theline, $result, $key)
-    {
-        if ($this->bool_radio_form == true) {
-            $return = '<input type="radio"  class="check" name="field" value="'.$result[$theline][0]['value'].'" class="check" />';
-
-            return $return;
-        }
-    }
-
-    //Load check form if this parameters is loaded in list_show and list_show_with_template
-    public function tmplt_func_bool_check_form($actual_string, $theline, $result, $key)
-    {
-        if ($this->bool_check_form == true) {
-            $return = '<input type="checkbox"  name="field" value="'.$result[$theline][0]['value'].'" class="check" />';
-
-            return $return;
-        }
-    }
-
-    //onclick="valid_form( \'page\', \''.$result[$theline][0]['value'].'\', \''.$id_action.'\');
-
-    //Load check form if this parameters is loaded in list_show and list_show_with_template
-    public function tmplt_func_click_form($actual_string, $theline, $result, $key)
-    {
-        if ($this->do_action && !empty($this->id_action)
-            &&
-            (!isset($this->do_actions_arr) || count($this->do_actions_arr) == 0
-                || (isset($this->do_actions_arr)
-                && $this->do_actions_arr[$theline] == true))
-        ) {
-            $return = '//onclick="valid_form( \'page\', \''.$result[$theline][0]['value'].'\', \''.$this->id_action.'\');" onmouseover="this.style.cursor=\'pointer\';"';
-
-            return $return;
-        }
-    }
-
-    //Load view_doc if this parameters is loaded in list_show and list_show_with_template
-    public function tmplt_func_bool_detail_doc($actual_string, $theline, $result, $key)
-    {
-        if ($this->bool_detail == true) {
-            $return = "<a href='".$_SESSION['config']['businessappurl'].'index.php?page='
-            .$this->detail_destination.'&amp;id='.$result[$theline][0][$key]
-            ."' title='"._DETAILS."'><i class='fa fa-info-circle fa-2x' title='"._DETAILS."'></i></a>";
-
-            return $return;
-        }
-    }
-
-    //Show img.eye if attachments on the doc
-    public function tmplt_func_bool_see_attachments($actual_string, $theline, $result, $key)
-    {
-        $return = '';
-        if ($result[$theline][0]['aDesReps']) {
-            $return .= '<i ';
-            $return .= 'class="fa fa-cogs fa-2x" ';
-            $return .= 'style="';
-            $return .= 'cursor: pointer;';
-            $return .= '" ';
-            $return .= 'onclick=" ';
-            $return .= 'loadRepList(';
-            $return .= $result[$theline][0]['value'];
-            $return .= ');';
-            $return .= '" ';
-            $return .= '></i>';
-        }
-
-        return $return;
-    }
-
-    public function tmplt_func_bool_see_items($actual_string, $theline, $result, $key)
-    {
-        $return = '';
-        //if ($result[$theline][0]['aDesReps']) {
-        $return .= '<i ';
-        $return .= 'class="fa fa-info-circle fa-2x" ';
-        $return .= 'style="';
-        $return .= 'cursor: pointer;';
-        $return .= '" title="'._VIEW_ARCHIVES.'"';
-        $return .= 'onclick="';
-        $return .= 'ArchiveTransferBasket__loadItemList(';
-        $return .= $result[$theline][0]['value'];
-        $return .= ');';
-        $return .= '" ';
-        $return .= '></i>';
-        //}
-        return $return;
-    }
-
-    public function tmplt_func_see_persistent($actual_string, $theline, $result, $key)
-    {
-        if (isset($result[$theline][0]['isPersistent']) && $result[$theline][0]['isPersistent']) {
-            $return = '<i class="fa fa-lock fa-2x" title="persistance activée"></i>';
-        } else {
-            $return = '<i class="fa fa-unlock fa-2x" title="persistance désactivée"></i>';
-        }
-
-        return $return;
-    }
-
-    //Load check form if this parameters is loaded in list_show and list_show_with_template
-    public function tmplt_func_bool_view_doc($actual_string, $theline, $result, $key)
-    {
-        if ($this->bool_view_document == true) {
-            $return = "<a href='".$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='.$result[$theline][0][$key]."' target=\"_blank\" title='"._VIEW_DOC."'>
-                       <i class='fa fa-download fa-2x' title='"._VIEW_DOC."'></i></a>";
-
-            return $return;
-        }
-    }
-
-    //Load check form if this parameters is loaded in list_show and list_show_with_template
-    public function tmplt_include_by_module($actual_string, $theline, $result, $key, $string_to_module)
-    {
-        $my_explode = explode('|', $actual_string);
-        if (count($my_explode) != 2) {
-            return  _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            $core_tools = new core_tools();
-            $module_id = $my_explode[1];
-            if ($core_tools->is_module_loaded($module_id) == true) {
-                $temp = $string_to_module;
-                preg_match_all('/##(.*?)##/', $temp, $out);
-
-                for ($i = 0; $i < count($out[0]); ++$i) {
-                    $remplacement = $this->load_var_sys($out[1][$i], $theline, $result, $key);
-                    $temp = str_replace($out[0][$i], $remplacement, $temp);
-                }
-                $string_to_module = $temp;
-
-                return $string_to_module;
-            } else {
-                return '';
-            }
-        }
-    }
-
-    //Reload last css parameter defined for the result list
-    public function tmplt_css_line_reload($actual_string)
-    {
-        return $this->actual_line_css;
-    }
-
-    //Load constant from lang file
-    public function tmplt_define_lang($actual_string)
-    {
-        $my_explode = explode('|', $actual_string);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            return constant($my_explode[1]);
-        }
-    }
-
-    //Load css for actual line. For the next line, arg1 is swith by arg2
-    public function tmplt_css_line($actual_string)
-    {
-        $my_explode = explode('|', $actual_string);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            if (count($my_explode) == 2) {
-                return $my_explode[1];
-            } elseif (count($my_explode) == 3) {
-                if ($this->actual_line_css == '') {
-                    $this->actual_line_css = $my_explode[1];
-
-                    return $this->actual_line_css;
-                } elseif ($this->actual_line_css == $my_explode[1]) {
-                    $this->actual_line_css = $my_explode[2];
-
-                    return $this->actual_line_css;
-                } elseif ($this->actual_line_css == $my_explode[2]) {
-                    $this->actual_line_css = $my_explode[1];
-
-                    return $this->actual_line_css;
-                } else {
-                    return _WRONG_PARAM_FOR_LOAD_VALUE;
-                }
-            } else {
-                return _WRONG_PARAM_FOR_LOAD_VALUE;
-            }
-        }
-    }
-
-    //Load string ans search all function defined in this string
-    public function load_var_sys($actual_string, $theline, $result = array(), $key = 'empty', $include_by_module = '')
-    {
-        //#load_value|arg1##: load value in the db; arg1= column's value identifier
-        if (preg_match("/^load_value\|/", $actual_string)) {
-            //elseif($actual_string == "load_value")
-            $my_var = $this->tmplt_load_value($actual_string, $theline, $result);
-        }
-        //#load_value|arg1##: load value in the db; arg1= column's value identifier
-        elseif (preg_match("/^load_date\|/", $actual_string)) {
-            $my_var = $this->tmplt_load_date($actual_string, $theline, $result);
-        }
-        //#load_css|arg1## : load css style - arg1= name of this class
-        elseif (preg_match("/^load_css\|/", $actual_string)) {
-            $my_var = $this->tmplt_load_css($actual_string);
-        }
-        //#css_line|coll|nonecoll## : load css style for line arg1,arg2 : switch beetwin style on line one or line two
-        elseif (preg_match('/^css_line_reload$/', $actual_string)) {
-            $my_var = $this->tmplt_css_line_reload($actual_string);
-        }
-        //#css_line|coll|nonecoll## : load css style for line arg1,arg2 : switch beetwin style on line one or line two
-        elseif (preg_match("/^css_line\|/", $actual_string)) {
-            $my_var = $this->tmplt_css_line($actual_string);
-        }
-        //#load_img|arg1## : show loaded image; arg1= name of img file
-        elseif (preg_match("/^load_img\|/", $actual_string)) {
-            $my_var = $this->tmplt_load_img($actual_string);
-        }
-        //#order_link|arg1|arg2## : reload list and change order;  arg1=type; arg2=sort
-        elseif (preg_match("/^order_link\|/", $actual_string)) {
-            $my_var = $this->tmplt_order_link($actual_string);
-        }
-        //#url_docview## : view the file
-        elseif (preg_match('/^url_docview$/', $actual_string)) {
-            $my_var = $this->url_docview($actual_string, $theline, $result, $key);
-        }
-        //#define_lang|arg1## : define constant by the lang file; arg1 = constant of lang.php
-        elseif (preg_match("/^define_lang\|/", $actual_string)) {
-            $my_var = $this->tmplt_define_lang($actual_string);
-        }
-        //#url_docdetail## : load page detail for this file
-        elseif (preg_match('/^url_docdetail$/', $actual_string)) {
-            $my_var = $this->tmplt_url_docdetail($actual_string, $theline, $result, $key);
-        }
-        //#func_bool_radio_form## : Activate parameters in class list show
-        elseif (preg_match('/^func_bool_radio_form$/', $actual_string)) {
-            $my_var = $this->tmplt_func_bool_radio_form($actual_string, $theline, $result, $key);
-        }
-        //#func_bool_check_form## : Activate parameters in class list show
-        elseif (preg_match('/^func_bool_check_form$/', $actual_string)) {
-            $my_var = $this->tmplt_func_bool_check_form($actual_string, $theline, $result, $key);
-        }
-        //#func_bool_view_doc## : Activate parameters in class list show
-        elseif (preg_match('/^func_bool_view_doc$/', $actual_string)) {
-            $my_var = $this->tmplt_func_bool_view_doc($actual_string, $theline, $result, $key);
-        }
-        //#func_bool_detail_doc## : Activate parameters in class list show
-        elseif (preg_match('/^func_bool_detail_doc$/', $actual_string)) {
-            $my_var = $this->tmplt_func_bool_detail_doc($actual_string, $theline, $result, $key);
-        } elseif (preg_match('/^func_bool_detail_rm$/', $actual_string)) {
-            $my_var = $this->tmplt_func_bool_detail_rm($actual_string, $theline, $result, $key);
-        } elseif (preg_match('/^func_bool_detail_io$/', $actual_string)) {
-            $my_var = $this->tmplt_func_bool_detail_io($actual_string, $theline, $result, $key);
-        } elseif (preg_match('/^func_click_form$/', $actual_string)) {
-            $my_var = $this->tmplt_func_click_form($actual_string, $theline, $result, $key);
-        } elseif (preg_match("/^func_include_by_module\|/", $actual_string)) {
-            $my_var = $this->tmplt_include_by_module($actual_string, $theline, $result, $key, $include_by_module);
-        } elseif (preg_match("/^func_load_external_script\|/", $actual_string)) {
-            $my_var = $this->tmplt_load_external_script($actual_string, $theline, $result, $key, $include_by_module);
-        } elseif (preg_match('/^func_bool_see_attachments$/', $actual_string)) {
-            $my_var = $this->tmplt_func_bool_see_attachments($actual_string, $theline, $result, $key, $include_by_module);
-        } elseif (preg_match('/^func_bool_see_items$/', $actual_string)) {
-            $my_var = $this->tmplt_func_bool_see_items($actual_string, $theline, $result, $key, $include_by_module);
-        } elseif (preg_match('/^func_see_persitent$/', $actual_string)) {
-            $my_var = $this->tmplt_func_see_persistent($actual_string, $theline, $result, $key);
-        } else {
-            $my_var = _WRONG_FUNCTION_OR_WRONG_PARAMETERS;
-        }
-
-        return $my_var;
-    }
-
-    //Get template and remove all comments
-    public function get_template($this_file)
-    {
-        //Ouverture du fichier
-        $list_trait = file_get_contents($this_file);
-        //Suppression des commantaires dans la page
-        $list_trait = preg_replace('/(<!--.*?-->)/s', '', $list_trait);
-
-        return $list_trait;
-    }
-
-    //show obect to switch in another lists
-    public function display_template_for_user($template_list, $link)
-    {
-        /* $template_list : list of template
-         *                               [name] : name of template file
-         *                           [img] : html img to use for this template
-         *                           [label] : label to show in alt tag or title tag
-         */
-        if ($this->hide_standard_list == true) {
-            $standard = '';
-        } else {
-            $standard = "<a href='".$link."&template='><img src='"
-                .$_SESSION['config']['businessappurl'].'static.php?filename'
-                ."=standard_list.gif' alt='"._ACCESS_LIST_STANDARD
-                ."' ></a>";
-        }
-        $extend = '';
-        foreach ($template_list as $temp) {
-            $extend .= "&nbsp;<a href='".$link.'&amp;template='
-                    .$temp['name']."'> <i class='".$temp['img']."' title='".$temp['label']."'></i></a>";
-        }
-
-        return $standard.' '.$extend.'';
-    }
-
-    /**
-     * Show the document list in result of the search.
-     *
-     * @param array  $listarr
-     * @param int    $nb_total               total number of documents
-     * @param string $title
-     * @param string $what                   search expression
-     * @param string $name                   "search" by default, the calling page
-     * @param string $key                    the key seach for the form
-     * @param string $detail_destination     the link to detail page
-     * @param bool   $bool_view_document     boolean to view document or not
-     * @param bool   $bool_radio_form        boolean to add radio to select row
-     * @param string $method                 method of the select form
-     * @param string $action                 action of the select form
-     * @param string $button_label           label(session var) of the button of the select form
-     * @param bool   $bool_detail            boolean to show the detail page link or not
-     * @param bool   $bool_order             boolean to show the order icons or not
-     * @param bool   $bool_frame             true if calling by frame
-     * @param bool   $bool_export            true if we activate the list export (obsolete => to delete)
-     * @param bool   $show_close             true : the close window button is showed
-     * @param bool   $show_big_title         true : the title is displayed in the title container
-     * @param bool   $show_full_list         true : the list takes all the screen, otherwise it is addforms2 class
-     * @param bool   $bool_check_form        true : add checkbox to select row
-     * @param string $res_link               obsolete (to delete)
-     * @param string $module                 module name if the function is called in a module
-     * @param bool   $bool_show_listletters  true : show list letters, search on the elements of the list possible
-     * @param string $all_sentence           string  : all item
-     * @param string $whatname               name of the element to search
-     * @param string $used_css               css used in the list
-     * @param string $comp_link              url link complement
-     * @param string $link_in_line
-     * @param string $bool_show_actions_list true : shows the possible actions of the list on a combo list
-     * @param array  $actions                list of the elements of the actions combo list
-     * @param string $hidden_fields          hidden fields in the form
-     */
-    public function list_doc_by_template(
-    $result, $nb_total, $title,
-    $what, $name = 'search', $key, $detail_destination, $bool_view_document,
-    $bool_radio_form, $method, $action, $button_label, $bool_detail, $bool_order,
-    $bool_frame = false, $bool_export = false, $show_close = false, $show_big_title = true,
-    $show_full_list = true, $bool_check_form = false, $res_link = '', $module = '',
-    $bool_show_listletters = false, $all_sentence = '', $whatname = '',
-    $used_css = 'listing spec', $comp_link = '', $link_in_line = false,
-    $bool_show_actions_list = false, $actions = array(), $hidden_fields = '',
-    $actions_json = '{}', $do_action = false, $id_action = '',
-    $open_details_popup = true, $do_actions_arr = array(), $template = false,
-    $template_list = array(), $actual_template = '', $mode_string = false,
-    $hide_standard_list = false)
-    {
-        $core_tools = new core_tools();
-        $core_tools->load_lang();
-        $list_title = '';
-        $str = '';
-        $this->detail_destination = $detail_destination;
-        $this->bool_radio_form = $bool_radio_form;
-        $this->bool_check_form = $bool_check_form;
-        $this->bool_view_document = $bool_view_document;
-        $this->bool_detail = $bool_detail;
-        $this->do_action = $do_action;
-        $this->id_action = $id_action; /*To keep value for extended simples script =>*/ $_SESSION['extended_template']['id_default_action'] = $this->id_action;
-        $this->do_action_arr = $do_actions_arr;
-        $this->hide_standard_list = $hide_standard_list;
-        if (isset($_REQUEST['start']) && $_REQUEST['start'] > $nb_total) {
-            $_REQUEST['start'] = 0;
-        }
-        if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
-            $start = strip_tags($_REQUEST['start']);
-        } else {
-            $start = 0;
-        }
-        /* ---------------------- */
-        if (file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$actual_template.'.html')) {
-            $file = $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$actual_template.'.html';
-        } else {
-            $file = 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$actual_template.'.html';
-        }
-
-        //##############################################################
-        $list_trait = $this->get_template($file);
-        $tmp = explode('#!#', $list_trait);
-        //Generate link for reloading file
-        if ($bool_frame) {
-            //$link = $name.".php?search=".$what;
-            $link = $_SESSION['config']['businessappurl'].'index.php?display=true&page='.$name.'&amp;search='.$what;
-        } else {
-            $link = $_SESSION['config']['businessappurl'].'index.php?page='.$name.'&amp;search='.$what;
-        }
-        if (isset($_SESSION['where'])) {
-            for ($i = 0; $i < count($_SESSION['where']); ++$i ) {
-                $link .= '&amp;where[]='.$_SESSION['where'][$i];
-            }
-        }
-        if (!empty($module)) {
-            $link .= '&amp;module='.$module;
-        }
-        if (isset($_GET['what'])) {
-            $link .= '&amp;what='.strip_tags($_GET['what']);
-        }
-        if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
-            $start = strip_tags($_REQUEST['start']);
-        } else {
-            $start = 0;
-        }
-        $this->the_start = $start;
-        $findme = 'order_field';
-        $pos = stripos($name, $findme);
-        if ($pos === false) {
-            if (isset($_GET['order'])) {
-                $orderby = strip_tags($_GET['order']);
-            } else {
-                $orderby = 'asc';
-            }
-            $link .= '&amp;order='.$orderby;
-            if (isset($_GET['order_field'])) {
-                $orderfield = strip_tags($_GET['order_field']);
-            } else {
-                $orderfield = '';
-            }
-            $link .= '&amp;order_field='.$orderfield;
-        }
-        //echo $link;exit;
-        $link .= $comp_link;
-        if (isset($actual_template) && $actual_template != '') {
-            $link .= '&amp;template='.$actual_template;
-        } else {
-            $link .= '&amp;template=';
-        }
-        // Load object to switch template
-        if (isset($template) && $template == true) {
-            $tdeto = $this->display_template_for_user($template_list, $link);
-            //$tdeto = _DISPLAY." : ".$tdeto;
-        }
-        //########################
-        //require_once("core/class/class_core_tools.php");
-        $core_tools = new core_tools();
-        $disp_dc = '';
-        if ($core_tools->is_module_loaded('doc_converter') && $bool_export) {
-            $_SESSION['doc_convert'] = array();
-             require_once('modules'.DIRECTORY_SEPARATOR.'doc_converter'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_modules_tools.php');
-            $doc_converter = new doc_converter();
-            $disp_dc = $doc_converter->convert_list($result, true);
-        }
-        //########################
-        $page_list1 = '';
-        $this->the_link = $link;
-        $nb_show = $_SESSION['config']['nblinetoshow'];
-        $nb_pages = ceil($nb_total / $nb_show);
-        $end = count($result);
-
-        if ($show_big_title) {
-            $list_title .= '<h1>';
-            if (!empty($picto_path)) {
-                $list_title .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';
-            }
-            $list_title .= $title.'</h1>';
-        } else {
-            $list_title .= '<b>';
-            if (!empty($picto_path)) {
-                $list_title .= '<img src="'.$picto_path.'" alt="" class="title_img" /> ';
-            }
-            $list_title .= $title.'</b>';
-        }
-        $theline = 0;
-        // CHECK ALL IF ANY ACTION
-        if ($bool_radio_form || $bool_check_form) {
-            //$disp_dc .= '<input type="checkbox">';
-            $disp_dc .= '<a href="#" onclick="checkAll();" >'._CHECK_ALL.'</a>';
-            $disp_dc .= '&nbsp;<a href="#" onclick="uncheckAll();" >'._UNCHECK_ALL.'</a>';
-            //$disp_dc .= '&nbsp;&nbsp;<input type="checkbox"><a href="#" onclick="reverseCheck();" >' . _REVERSE_CHECK . '</a>';
-        }
-        //if they are more 1 page we do pagination with 2 forms
-        if ($nb_pages > 1) {
-            $next_start = 0;
-            //$search_form = "<form name=\"newpage1\" method=\"get\" >";
-            $page_list1 = _GO_TO_PAGE." <select name=\"startpage\" onchange=\"window.location.href='".$link."&amp;start='+this.value;\">";
-            $lastpage = 0;
-
-            for ($i = 0; $i != $nb_pages; ++$i) {
-                $page_name = $i + 1;
-                $the_line = $i + 1;
-                if ($start == $next_start) {
-                    $page_list1 .= '<option value="'.$next_start.'" selected="selected">'.$the_line.'</option>';
-                } else {
-                    $page_list1 .= '<option value="'.$next_start.'">'.$the_line.'</option>';
-                }
-                $next_start = $next_start + $nb_show;
-                $lastpage = $next_start;
-            }
-            $page_list1 .= '</select>';
-            $lastpage = $lastpage - $nb_show;
-            $previous = '';
-            $next = '';
-            if ($start > 0) {
-                $start_prev = $start - $nb_show;
-                $previous = '<a href="'.$link.'&amp;start='.$start_prev.'"><i class="fa fa-backward" title="'._PREVIOUS.'"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;';
-            }
-            if ($start != $lastpage) {
-                $start_next = $start + $nb_show;
-                //$next = " <div class='list_next' ><a href=\"".$link."&amp;start=".$start_next."\">"._NEXT."</a> ></div>";
-                $next = '<a href="'.$link.'&amp;start='.$start_next.'"><i class="fa fa-forward" title="'._NEXT.'"></i></a>';
-            }
-            $page_list1 = '<div class="block" style="height:30px;vertical" '
-                    .'align="center" ><table width="100%" border="0"><tr>'
-                    .'<td align="center" width="15%"><b>'.$previous
-                    .'</b></td><td align="center" width="15%"><b>'.$next
-                    .'</b></td><td width="10px">|</td><td align="center" '
-                    .'width="30%">'.$page_list1.'</td><td width="10px">|'
-                    .'</td><td width="210px" align="center">'.$disp_dc
-                    .'</td><td width="5px">|</td><td align="right">'.$tdeto
-                    .'</td></tr></table></b></div>';
-        } else {
-            $page_list1 = '<div class="block" style="height:30px;vertical" '
-                    .'align="center" ><table width="100%" border="0"><tr>'
-                    .'<td align="center" width="15%"><b>&nbsp;'
-                    .'</b></td><td align="center" width="15%"><b>&nbsp;'
-                    .'</b></td><td width="10px">|</td><td align="center" '
-                    .'width="30%">&nbsp;</td><td width="10px">|'
-                    .'</td><td width="210px" align="center">'.$disp_dc
-                    .'</td><td width="5px">|</td><td align="right">'.$tdeto
-                    .'</td></tr></table></b></div>';
-        }
-        //Script for action
-        //#################
-        if ($bool_radio_form || $bool_check_form || ($do_action && !empty($id_action))) {
-            $temp = '<form name="form_select" id="form_select" action="'.$action.'" method="'.$method.'" class="forms';
-            if (!$show_full_list) {
-                $temp .= ' addforms2" >';
-            } else {
-                $temp .= '" >';
-            }
-            $str .= $temp;
-            $str .= $hidden_fields;
-        }
-        //Exploding template to lunch funtion in load_var_sys()
-        $table = '';
-        $head = '';
-        $content = '';
-        $footer = '';
-        foreach ($tmp as $ac_tmp) {
-            if (substr($ac_tmp, 0, 5) == 'TABLE') {
-                $table = substr($ac_tmp, 5);
-                $true_table = $table;
-                //appel des fonctions de remplacement;
-                preg_match_all('/##(.*?)##/', $true_table, $out);
-
-                for ($i = 0; $i < count($out[0]); ++$i) {
-                    $remplacement_table = $this->load_var_sys(
-                        $out[1][$i], $theline, '', '', $including_table
-                    );
-                    $table = str_replace($out[0][$i], $remplacement_table, $true_table);
-                }
-            } elseif (substr($ac_tmp, 0, 4) == 'HEAD') {
-                $head = substr($ac_tmp, 4);
-                $true_head = $head;
-                preg_match_all('/##(.*?)##/', $true_head, $out);
-
-                for ($i = 0; $i < count($out[0]); ++$i) {
-                    $remplacement_head = $this->load_var_sys($out[1][$i], $theline, '', '', $including_head);
-                    $true_head = str_replace($out[0][$i], $remplacement_head, $true_head);
-                }
-                $head = $true_head;
-            } elseif (substr($ac_tmp, 0, 6) == 'RESULT') {
-                $content = substr($ac_tmp, 6);
-            } elseif (substr($ac_tmp, 0, 6) == 'FOOTER') {
-                $footer = substr($ac_tmp, 6);
-            }
-        }
-        $content_list = '';
-        for ($theline = 0; $theline < $end; ++$theline) {
-            $true_content = $content;
-            preg_match_all('/##(.*?)##/', $true_content, $out);
-            for ($i = 0; $i < count($out[0]); ++$i) {
-                $remplacement = $this->load_var_sys($out[1][$i], $theline, $result, $key, $including_result);
-                $true_content = str_replace($out[0][$i], $remplacement, $true_content);
-            }
-            $content_list .= $true_content;
-        }
-        if ((($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) || ($do_action && !empty($id_action))) {
-            $str .= '<script type="text/javascript">';
-            $str .= ' var arr_actions = '.$actions_json.';';
-            $str .= ' var arr_msg_error = {\'confirm_title\' : \''._ACTION_CONFIRM.'\',';
-            $str .= ' \'validate\' : \''._VALIDATE.'\',';
-            $str .= ' \'cancel\' : \''._CANCEL.'\',';
-            $str .= ' \'choose_action\' : \''._CHOOSE_ACTION.'\',';
-            $str .= ' \'choose_one_doc\' : \''._CHOOSE_ONE_DOC.'\'';
-            $str .= ' };';
-            //$str .= ' console.log(arr_msg_error);';
-            $str .= ' valid_form=function(mode, res_id, id_action)';
-            $str .= '{';
-            $str .= 'if(!isAlreadyClick){';
-            $str .= ' var val = \'\';';
-            $str .= ' var action_id = \'\';';
-            $str .= ' var table = \'\';';
-            $str .= ' var coll_id = \'\';';
-            $str .= ' var module = \'\';';
-            $str .= ' var thisfrm = document.getElementById(\'form_select\');';
-            $str .= ' if(thisfrm)';
-            $str .= ' {';
-            $str .= ' for(var i=0; i < thisfrm.elements.length; i++)';
-            $str .= ' {';
-            $str .= '  if(thisfrm.elements[i].name = \'field\' && thisfrm.elements[i].checked == true)';
-            $str .= ' {';
-            $str .= ' val += thisfrm.elements[i].value+\',\';';
-            $str .= ' }';
-            $str .= ' else if(thisfrm.elements[i].id == \'action\')';
-            $str .= '   {';
-            $str .= ' action_id = thisfrm.elements[i].options[thisfrm.elements[i].selectedIndex].value;';
-            $str .= ' }';
-            $str .= ' else if(thisfrm.elements[i].id == \'table\')';
-            $str .= ' {';
-            $str .= ' table = thisfrm.elements[i].value;';
-            $str .= ' }';
-            $str .= ' else if(thisfrm.elements[i].id == \'coll_id\')';
-            $str .= ' {';
-            $str .= ' coll_id = thisfrm.elements[i].value;';
-            $str .= ' }';
-            $str .= ' else if(thisfrm.elements[i].id == \'module\')';
-            $str .= ' {';
-            $str .= ' module = thisfrm.elements[i].value;';
-            $str .= ' }';
-            $str .= ' }';
-            $str .= ' val = val.substr(0, val.length -1);';
-            $str .= ' var val_frm = {\'values\' : val,  \'action_id\' : action_id, \'table\' : table, \'coll_id\' : coll_id, \'module\' : module};';
-            $str .= ' if(res_id && res_id != \'\')';
-            $str .= ' {';
-            $str .= ' val_frm[\'values\'] = res_id;';
-            $str .= ' }';
-            $str .= ' if(id_action && id_action != \'\')';
-            $str .= ' {';
-            $str .= ' val_frm[\'action_id\'] = id_action;';
-            $str .= ' }';
-
-            $str .= ' action_send_first_request(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&page=manage_action&module=core\', mode,  val_frm[\'action_id\'], val_frm[\'values\'], val_frm[\'table\'], val_frm[\'module\'], val_frm[\'coll_id\']);';
-            $str .= ' }';
-            $str .= ' else';
-            $str .= ' {';
-            $str .= ' alert(\'Validation form error\');';
-            $str .= ' }';
-            $str .= 'isAlreadyClick = true;';
-            $str .= '}';
-            $str .= ' }';
-            $str .= ' </script>';
-        }
-        $str_foot = '';
-        //#################
-        //#################### Action module
-        if (($bool_radio_form || $bool_check_form) && count($result) > 0 && !$bool_show_actions_list) {
-            $str_foot .= ' <p align="center">';
-            $str_foot .= ' <input class="button" type="submit" value="'.$button_label.'"  />';
-            if ($show_close) {
-                $str_foot .= ' <input type="button" class="button" name="cancel" value="'._CLOSE_WINDOW.'" onclick="window.top.close();" />';
-            }
-            $str_foot .= ' </p>';
-            $str_foot .= ' </form>';
-            $str_foot .= ' <br/>';
-        } elseif (($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) {
-            $str_foot .= ' <p align="center">';
-            $str_foot .= ' <b>'._ACTIONS.' :</b>';
-            $str_foot .= ' <select name="action" id="action">';
-            $str_foot .= ' <option value="">'._CHOOSE_ACTION.'</option>';
-            for ($ind_act = 0; $ind_act < count($actions); ++$ind_act) {
-                $str_foot .= ' <option value="'.$actions[$ind_act]['VALUE'].'">'.$actions[$ind_act]['LABEL'].'</option>';
-            }
-            $str_foot .= ' </select>';
-            $str_foot .= ' <input type="button" name="send" id="send" value="'._VALIDATE.'" onclick="valid_form(\'mass\');window.location.href=\'#top\'" class="button" />';
-            $str_foot .= ' </p>';
-            $str_foot .= ' </form>';
-            $str_foot .= ' <br/>';
-        } elseif ($do_action) {
-            $str_foot .= ' </form>';
-        }
-        //######################
-        // Print in application the generated template list result
-        if ($mode_string == false) {
-            echo $list_title.$page_list1.$str.$table.$head.$content_list.$footer.$str_foot;
-        } else {
-            return $list_title.$page_list1.$str.$table.$head.$content_list.$footer.$str_foot;
-        }
-    }
-}
diff --git a/apps/maarch_entreprise/class/class_lists.php b/apps/maarch_entreprise/class/class_lists.php
deleted file mode 100755
index cf50aad2c04..00000000000
--- a/apps/maarch_entreprise/class/class_lists.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/*
- *    Copyright 2008,2015 Maarch
- *
- *  This file is part of Maarch Framework.
- *
- *   Maarch Framework 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.
- *
- *   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-/**
- * @defgroup list Lists
- */
-
-/**
- * @brief   Lists :  
- *
- *
- * @file
- * @date $date$
- * @version $Revision$
- * @ingroup list
- */
-
-require_once 'apps/'. $_SESSION['config']['app_id'] .'/class/class_lists_Abstract.php';
-
-class lists extends lists_Abstract
-{
-    // custom
-}
diff --git a/apps/maarch_entreprise/class/class_lists_Abstract.php b/apps/maarch_entreprise/class/class_lists_Abstract.php
deleted file mode 100755
index 029fc598b12..00000000000
--- a/apps/maarch_entreprise/class/class_lists_Abstract.php
+++ /dev/null
@@ -1,3801 +0,0 @@
-<?php
-/*
- *    Copyright 2008,2015 Maarch
- *
- *  This file is part of Maarch Framework.
- *
- *   Maarch Framework 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.
- *
- *   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * @defgroup list Lists
- */
-
-/**
- * @brief   Lists :
- *
- *
- * @file
- *
- * @author <dev@maarch.org>
- * @date $date$
- *
- * @version $Revision$
- * @ingroup list
- */
-
-/**
- * @brief  Parameters
- *
- * Parameters for lists             array
-
-        [bool_modeReturn]                   boolean     Return or echo mode (default: true)
-        [divListId]                         string      Id of the div used to contain ajax return of list (default: divList)
-        [moduleName]                        string      Name of the module where the page is
-        [pageName]                          string      The calling page
-        [bool_pageInModule]                 boolean     The calling page is part of a module
-        [urlParameters]                     string      Extra parameters for url to page
-        [pageTitle]                         string      Title of the page to be displayed over the list
-        [bool_bigPageTitle]                 boolean     Size of the title. If false small size
-        [pagePicto]                         string      Image to be displayed near title
-        [bool_showIconDetails]              boolean     Show the detail icon and link
-        [viewDetailsLink]                   string      Default details link
-        [bool_showIconDocument]             boolean     Show the icon view document
-        [bool_showAddButton]                boolean     Show the Add Button
-        [bool_showBottomToolbar]            boolean     Show bottom toolbar (default: true)
-        [bool_showSmallToolbar]             boolean     Show toolbar in small mode (default: false)
-        [addButtonLabel]                    string      Label of the Add Button, (default: _ADD)
-        [addButtonLink]                     string      Url of the Add Button link
-        [addButtonScript]                   string      Action or function executed on click to Add Button
-        [listCss]                           string      Css used in the list (default: listing spec)
-        [bool_sortColumn]                   boolean     Show the order icons or not (default: true)
-        [linesToShow]                       string      Number of rows to show in the list
-        [bool_changeLinesToShow]            boolean     Show dropdown list to change number of rows to show in the list (default: true)
-        [listHeight]                        string      Height of the list
-        [bool_showSearchTools]              boolean     If true : show list letters filter
-        [bool_showSearchBox]                boolean     If true : show search box
-        [searchBoxAutoCompletionUrl]        string      Autocompletion url used by search box
-        [searchBoxAutoCompletionMinChars]   integer     Number minimum of charactere to activate show autocompletion list (default: 1)
-        [searchBoxAutoCompletionParamName]  string      Name of the parameter passed in autocompletion url (default: what)
-        [searchBoxAutoCompletionUpdate]     boolean     Search on ID after autocompletion select
-        [bool_checkBox]                     boolean     Add checkbox to row (checkbox name : field[])
-        [bool_radioButton]                  boolean     Add radio button to row (radio name : field)
-        [bool_standaloneForm]               boolean     Add standalone form (no MEP actions needed)
-        [formId]                            string      Id of the list form (default: formList)
-        [formName]                          string      Name of the list form (default: formList)
-        [formMethod]                        string      Method of the list form (default: POST)
-        [formAction]                        string      Action of the list form (default: #)
-        [formClass]                         string      Class of the list form (default: forms)
-        [disabledRules]                     string      Rules to verify to disabled a line in list (must return boolean) Use generic @@field@@ format parameter
-        [hiddenFormFields]                  array       Hidden fields in the form (format:  array( 'ID' => "the_id", 'NAME' => "the_name", 'VALUE'=> "the_value"))
-        [bool_actionOnLineClick]            boolean     Action on line click
-        [defaultAction]                     string      Id of the default action
-        [collId]                            string      Id of the collection (used in actions management)
-        [tableName]                         string      Name of the table or view (used in actions management)
-        [actions]                           array       List of actions in actions dropdown list (format:  array('ID' => "the_id", 'LABEL' => "the_label"))
-        [filters]                           array       List of filters (format:  array('filter_id', 'filter_id', 'filter_id'))
-        [templates]                         array       List of tempkates (format:  array('template_id', 'template_id', 'template_id'))
-        [defaultTemplate]                   string      Template used by default (default: first in aray)
-        [bool_showTemplateDefaultList]              boolean     Show icon and link of the default lists in template list (default: false)
-        [buttons]                           array       List of form buttons (format:  array('TYPE' => "the_type_or_default", 'ID' => "the_id", 'LABEL' => "the_label", 'ACTION'=> "the_onclick_action"))
-        [processInstructions]               string      Process instructions text (default: _CLICK_LINE_TO_PROCESS)
-        [bool_showSublist]                  boolean     Show sublist icon and action (default: false)
-        [sublistUrl]                        string      Sublist content url (used in ajax function)
-        (*)[actionIcons]                    array       Array of action icons in list (format:
-                                                        array(
-                                                            'type'          => 'the_type',
-                                                            'href'          => 'the_href_link', (**)
-                                                            'script'        => 'the_javascript_action', (**)
-                                                            'class'         => 'the_icon_class',
-                                                            'icon'          => 'the_icon',
-                                                            'label'         => 'the_label',
-                                                            'tooltip'       => 'the_tooltip',
-                                                            'alertText'     => 'the_text_alert',
-                                                            'disabledRules' => 'the_disabled_rules'
-                                                            'alwaysVisible' => true/false
-                                                            )
-                                                        )
- * Parameters for actions          array
-                [type]                              string      Type of the action Icon (switch, button, image or link)
-                [on]                                array       Details of action button ON. (only for switch action) (***)
-                [off]                               array       Details of action button OFF. (only for switch action) (***)
-                [switchRules]                       string      Rule to active switch action (must return boolean). Use @@field_name@@ parameter. (only for switch action)
- *** Details of action button
-                [href]                              string      Link for action (** can't use it with [script])
-                [script]                            string      javascript for action (** can't use it with [href])
-                [tooltip]                           string      Tooltip for action
-                [class]                             string      Css style for action link
-                [icon]                              string      Icon for action link
-                [label]                             string      Label of the link
-                [alertText]                         string      Text displayed in the alert box. Can use  @@field_name@@ parameter
-                [disabledRules]                     string      To disabled action link (must return boolean). Use @@field_name@@ parameter
- */
-require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR
-.'class_security.php';
-
-abstract class lists_Abstract extends Database
-{
-    protected $countResult;
-    protected $countTd;
-    protected $link;
-    protected $start;
-    protected $lines;
-    protected $end;
-    protected $order;
-    protected $orderField;
-    protected $params;
-    protected $actionButtons;
-    protected $withForm;
-    protected $formId;
-    protected $whatSearch;
-    protected $haveAction;
-    protected $currentBasket;
-    protected $template;
-    protected $tmplt_CurrentCssLine;
-    protected $modeReturn;
-    protected $divListId;
-    protected $collId;
-
-    public function __construct()
-    {
-        $this->order = $_REQUEST['order'];
-        $this->orderField = $_REQUEST['order_field'];
-        if ($_REQUEST['start']) {
-            $this->start = $_REQUEST['start'];
-        } else {
-            $this->start = 0;
-        }
-        $this->whatSearch = $_REQUEST['what'];
-        $this->_manageFilters();
-        if (isset($_REQUEST['template'])) {
-            $this->template = $_REQUEST['template'];
-        }
-        if (isset($_REQUEST['coll_id'])) {
-            $this->collId = $_REQUEST['coll_id'];
-        }
-        if (!isset($_SESSION['previous_basket']['id'])) {
-            $_SESSION['previous_basket']['id'] = $_SESSION['current_basket']['id'];
-        }
-    }
-
-    protected function _buildFilter($filter)
-    {
-        //Reset some values
-        $filters = $filtersClause = $where = $options = '';
-
-        //Db query
-        $db = new Database();
-        //var_dump($_SESSION['filters']['contact']);
-        //Load filter's data
-        switch ($filter) {
-            case 'status':
-                $stmt = $db->query(
-                    'SELECT * FROM '.STATUS_TABLE." WHERE can_be_searched = 'Y' order by label_status"
-                );
-                while ($res = $stmt->fetchObject()) {
-                    if (isset($_SESSION['filters']['status']['VALUE'])
-                        && $_SESSION['filters']['status']['VALUE'] == $res->id
-                        ) {
-                        $selected = 'selected="selected"';
-                    } else {
-                        $selected = '';
-                    }
-                    $options .= '<option value="'.$res->id.'" '.$selected.'>'.$res->label_status.'</option>';
-                }
-                $filters .= '<select name="status_id" id="status_id" onChange="loadList(\''.$this->link
-                            .'&filter=status&value=\' + document.filters.status_id.value, \''
-                            .$this->divListId.'\', '.$this->modeReturn.');">'
-                            .'<option value="none">'._CHOOSE_STATUS.'</option>'
-                            .$options.'<option value="late">'._LATE.'</option>'
-                            .'</select>&nbsp;';
-            break;
-
-            case 'entity':
-                require_once 'modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR
-                    .'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php';
-                require_once 'modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR
-                    .'entities_tables.php';
-
-                $ent = new entity();
-                $sec = new security();
-                $ent = new entity();
-
-                $view = $sec->retrieve_view_from_table($this->params['tableName']);
-                if (empty($view)) {
-                    $view = $this->params['tableName'];
-                }
-                if (!empty($view)) {
-                    if (!empty($this->params['basketClause'])) {
-                        $this->params['basketClause'] = str_replace('res_view_letterbox.', 'r.', $this->params['basketClause']);
-                        $where = 'where ('.$this->params['basketClause'].')';
-                    }
-                }
-                if ((isset($_SESSION['filters']['entity']['VALUE']) || isset($_SESSION['filters']['entity_subentities']))) {
-                    $options = '<option selected="selected" value="'.$_SESSION['filters']['entity']['VALUE'].'" style="text-align:center;">'.$ent->getentityshortlabel($_SESSION['filters']['entity']['VALUE']).'</option>';
-                }
-
-                $filters .= '<select data-placeholder="'._ENTITY.'" name="entity_id" id="entity_id" onChange="loadList(\''.$this->link
-                            .'&filter=entity&value=\' + document.filters.entity_id.value, \''
-                            .$this->divListId.'\', '.$this->modeReturn.');">'
-                            .'<option value="none" style="text-align:center;"></option>'
-                            .$options.'</select>';
-                $filters .= '<script>$j("#entity_id").chosen({width:"300px",allow_single_deselect: true});$j("#entity_id").bind("chosen:showing_dropdown", function() {loadToolbarEntities("'.$where.'");}); </script>';
-
-            break;
-
-            case 'entity_subentities':
-
-                  if (isset($_SESSION['filters']['entity']['VALUE']) && $_SESSION['filters']['entity_subentities']['checked'] == true && $_SESSION['filters']['entity']['VALUE'] != '') {
-                      $checked = 'checked="checked"';
-                  } else {
-                      $checked = '';
-                  }
-
-                  if ($_SESSION['filters']['entity_subentities']['checked']) {
-                      $filters .= '<input type="checkbox" '.$checked.' style="margin-left:0px" title="inclure les sous-entités" onclick="loadList(\''.$this->link
-                        .'&filter=entity&value=\' + document.filters.entity_id.value, \''
-                        .$this->divListId.'\', '.$this->modeReturn.');" />&nbsp;';
-                  } else {
-                      $filters .= '<input type="checkbox" '.$checked.' style="margin-left:0px" title="inclure les sous-entités" onclick="loadList(\''.$this->link
-                        .'&filter=entity_subentities&value=\' + document.filters.entity_id.value, \''
-                        .$this->divListId.'\', '.$this->modeReturn.');" />&nbsp;';
-                  }
-
-            break;
-
-            case 'typist':
-                $sec = new security();
-
-                $view = $sec->retrieve_view_from_table($this->params['tableName']);
-                if (empty($view)) {
-                    $view = $this->params['tableName'];
-                }
-                if (!empty($view)) {
-                    if (!empty($this->params['basketClause'])) {
-                        $where = 'where '.$this->params['basketClause'];
-                    }
-
-                    $stmt = $db->query(
-                        'SELECT distinct(typist) as typist, count(distinct res_id)'
-                        .' as total FROM res_view_letterbox r'
-                        .$view.' r '.$where
-                        .' group by typist order by typist'
-                    );
-
-                    while ($res = $stmt->fetchObject()) {
-                        if (isset($_SESSION['filters']['typist']['VALUE'])
-                            && $_SESSION['filters']['typist']['VALUE'] == $res->typist
-                            ) {
-                            $selected = 'selected="selected"';
-                        } else {
-                            $selected = '';
-                        }
-
-                        if ($_SESSION['user']['UserId'] == $res->typist) {
-                            $style = 'style="font-weight:bold;"';
-                        } else {
-                            $style = '';
-                        }
-
-                        $options .= '<option value="'.$res->typist.'" '.$selected.' '.$style.'>'.$res->typist.' ('.$res->total.')</option>';
-                    }
-                }
-                $filters .= '<select name="typist" id="typist" onChange="loadList(\''.$this->link
-                            .'&filter=typist&value=\' + document.filters.typist.value, \''
-                            .$this->divListId.'\', '.$this->modeReturn.');">'
-                            .'<option value="none">'._CHOOSE_USER2.'</option>'
-                            .$options.'</select>&nbsp;';
-            break;
-
-            case 'category':
-                $filters .= '<select data-placeholder="'._CATEGORY.'" name="category_id_list" id="category_id_list" onChange="loadList(\''.$this->link
-                         .'&filter=category&value=\' + document.filters.category_id_list.value, \''
-                         .$this->divListId.'\', '.$this->modeReturn.');">';
-                $filters .= '<option value="none" style="text-align:center;"></option>';
-                foreach (array_keys($_SESSION['coll_categories'][$this->collId]) as $catId) {
-                    if (isset($_SESSION['filters']['category']['VALUE'])
-                        && $_SESSION['filters']['category']['VALUE'] == $catId
-                    ) {
-                        $selected = 'selected="selected"';
-                    } else {
-                        $selected = '';
-                    }
-                    $filters .= '<option value="'.$catId.'" '.$selected.'>'.$_SESSION['coll_categories'][$this->collId][$catId].'</option>';
-                }
-                $filters .= '</select>&nbsp;';
-                $filters .= '<script> $j("#category_id_list").chosen({width:"150px",allow_single_deselect: true});</script>';
-            break;
-
-            case 'priority':
-                $filters .= '<select data-placeholder="'._PRIORITY.'" name="priority_id_list" id="priority_id_list" onChange="loadList(\''.$this->link
-                         .'&filter=priority&value=\' + document.filters.priority_id_list.value, \''
-                         .$this->divListId.'\', '.$this->modeReturn.');">';
-                $filters .= '<option value="none" style="text-align:center;"></option>';
-
-                foreach (array_keys($_SESSION['mail_priorities']) as $priorityId) {
-                    if ($_SESSION['filters']['priority']['VALUE'] == $_SESSION['mail_priorities_id'][$priorityId]) {
-                        $selected = 'selected="selected"';
-                    } else {
-                        $selected = '';
-                    }
-                    $filters .= '<option value="'.$_SESSION['mail_priorities_id'][$priorityId].'" '.$selected.'>'.$_SESSION['mail_priorities'][$priorityId].'</option>';
-                }
-                $filters .= '</select>&nbsp;';
-                //$filters .= '<script>new c($(\'priority_id_list\'),{width:"150px",allow_single_deselect: true});</script>';
-                $filters .= '<script> $j("#priority_id_list").chosen({width:"150px",allow_single_deselect: true});</script>';
-
-            break;
-
-            case 'isViewed':
-                $isViewedArray = array('yes' => _YES, 'no' => _NO);
-                $filters .= '<select data-placeholder="'._VIEWED.'" name="isViewed" id="isViewed" onChange="loadList(\''.$this->link
-                         .'&filter=isViewed&value=\' + document.filters.isViewed.value, \''
-                         .$this->divListId.'\', '.$this->modeReturn.');">';
-                $filters .= '<option value="none"></option>';
-                foreach ($isViewedArray as $key => $value) {
-                    if (isset($_SESSION['filters']['isViewed']['VALUE'])
-                        && $_SESSION['filters']['isViewed']['VALUE'] == $key
-                        ) {
-                        $selected = 'selected="selected"';
-                    } else {
-                        $selected = '';
-                    }
-                    $filters .= '<option value="'.$key.'" '.$selected.'>'.$value.'</option>';
-                }
-                $filters .= '</select>&nbsp;';
-                //$filters .= '<script>new c($(\'isViewed\'),{width: "150px", disable_search: true,allow_single_deselect: true});</script>';
-                $filters .= '<script> $j("#isViewed").chosen({width:"150px", disable_search: true, allow_single_deselect: true});</script>';
-            break;
-
-            case 'contact':
-                //if(isset($_SESSION['filters']['contact']['VALUE']) && !empty($_SESSION['filters']['contact']['VALUE'])) {
-                    require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php';
-                    $sec = new security();
-                    $pos = strpos($this->params['basketClause'], 'r.');
-
-                    if ($pos) {
-                        $ext = 'r';
-                        $view = 'res_view_letterbox r';
-                    } else {
-                        $ext = 'res_view_letterbox';
-                        $view = 'res_view_letterbox';
-                    }
-
-                    $query = 'SELECT distinct('.$ext.'.contact_id),society, firstname, lastname FROM '
-                            .$_SESSION['tablename']['contacts_v2'].' c, '.$view.' WHERE c.contact_id = '.$ext.'.contact_id and '.$this->params['basketClause'];
-
-                    $stmt = $db->query($query, array());
-
-                    $filters .= '<select id="contact_id_list" onChange="loadList(\''.$this->link
-                                             .'&filter=contact&value=\' + document.filters.contact_id_list.value, \''
-                                             .$this->divListId.'\', '.$this->modeReturn.');">';
-                        $filters .= '<option value="none" style="text-align:center;">'._CONTACT.'</option>';
-
-                    while ($line = $stmt->fetchObject()) {
-                        $filters .= '<option value="'.$line->contact_id.'" title="'.$line->society.'"';
-                        if (empty($line->lastname)) {
-                            $person = $line->society;
-                        } else {
-                            $person = $line->firstname.' '.$line->lastname.' ('.$line->society.')';
-                        }
-
-                        if ($_SESSION['filters']['contact']['VALUE'] == $line->contact_id) {
-                            $filters .= ' selected="selected" ';
-                        }
-                        $filters .= '>'.$person.'</option>';
-                    }
-                    $filters .= '</select>&nbsp;';
-                    //$filters .= '<script>new c($(\'contact_id_list\'),{width: "150px",max_shown_results: "10"});</script>';
-                    $filters .= '<script> $j("#contact_id_list").chosen({width:"150px",max_shown_results: "10"});</script>';
-
-            break;
-
-            case 'res_id':
-
-                $res_id = '['._GED.']';
-                $filters .= '<input type="text" name="res_id" id="res_id" placeholder="'.$res_id.'" size="15" '
-                            .'onChange="myFunction(), loadList(\''.$this->link
-                            .'&filter=res_id&value=\' + $(\'residFilters\').value, \''.$this->divListId.'\', '
-                            .$this->modeReturn.');" />&nbsp;';
-                //Autocompletion script and div
-                $filters .= '<script type="text/javascript">function myFunction() {';
-                $filters .= 'var x = document.getElementById("res_id").value;';
-                $filters .= 'document.getElementById("residFilters").value = x;';
-                $filters .= '}</script>';
-                $filters .= '<input type="hidden" id="residFilters" name="residFilters" ';
-                if (isset($_SESSION['filters']['res_id']['VALUE']) && !empty($_SESSION['filters']['res_id']['VALUE'])) {
-                    $filters .= 'value="'.$_SESSION['filters']['res_id']['VALUE'].'"';
-                }
-                $filters .= '/>';
-            break;
-
-            case 'subject':
-
-                $pos = strpos($this->params['basketClause'], 'r.');
-
-                if ($pos) {
-                    $ext = 'r';
-                    $view = 'res_view_letterbox r';
-                } else {
-                    $ext = 'res_view_letterbox';
-                    $view = 'res_view_letterbox';
-                }
-
-                $query = 'SELECT distinct('.$ext.'.subject), res_id FROM '
-                            .$view.' WHERE '.$this->params['basketClause'].' ORDER BY subject ASC';
-
-                $stmt = $db->query($query, array());
-
-                $filters .= '<select id="subjectFilters" name="subjectFilters" onChange="loadList(\''.$this->link
-                             .'&filter=subject&value=\' + document.filters.subjectFilters.value, \''
-                             .$this->divListId.'\', '.$this->modeReturn.');">';
-                $filters .= '<option value="none" style="text-align:center;">'._SUBJECT.'</option>';
-
-                while ($line = $stmt->fetchObject()) {
-                    $filters .= '<option value="'.$line->subject.'" title="'.$line->subject.'"';
-                    if ($_SESSION['filters']['res_id']['VALUE'] == $line->res_id) {
-                        $filters .= ' selected="selected" ';
-                    }
-                    $filters .= '>'.$line->subject.'</option>';
-                }
-                $filters .= '</select>&nbsp;';
-                $filters .= '<script> $j("#subjectFilters").chosen({width:"150px",max_shown_results: "10"});</script>';
-            break;
-
-            case 'type':
-                require_once 'core'.DIRECTORY_SEPARATOR.'core_tables.php';
-
-                if (!empty($this->params['basketClause'])) {
-                    $where = 'where '.$this->params['basketClause'];
-                }
-
-                $stmt = $db->query(
-                    'SELECT distinct(r.type_id), t.description FROM '
-                    .$this->params['tableName'].' r left join doctypes t on t.type_id = r.type_id '.$where
-                    .' group by t.description, r.type_id order by t.description'
-                );
-                while ($res = $stmt->fetchObject()) {
-                    if (isset($_SESSION['filters']['type']['VALUE'])
-                        && $_SESSION['filters']['type']['VALUE'] == $res->type_id
-                        ) {
-                        $selected = 'selected="selected"';
-                    } else {
-                        $selected = '';
-                    }
-                    $options .= '<option value="'.$res->type_id.' '.$selected.'">'.$res->description.'</option>';
-                }
-                $filters .= '<select name="type_id" id="type_id" onChange="loadList(\''.$this->link
-                            .'&filter=type&value=\' + document.filters.type_id.value, \''
-                            .$this->divListId.'\', '.$this->modeReturn.');">'
-                            .'<option value="none">'._CHOOSE_TYPE.'</option>'
-                            .$options.'</select>&nbsp;';
-            break;
-
-            case 'user':
-                if (isset($_SESSION['filters']['user']['VALUE']) && !empty($_SESSION['filters']['user']['VALUE'])) {
-                    $user = $_SESSION['filters']['user']['VALUE'];
-                } else {
-                    $user = '['._USER.']';
-                }
-                $filters .= '<input type="text" name="user_id" id="user_id" value="'.$user.'" size="30" '
-                            .'onfocus="if(this.value==\'['._USER.']\'){this.value=\'\';}" '
-                            .'onKeyPress="if(event.keyCode == 9 || event.keyCode == 13)loadList(\''.$this->link
-                            .'&filter=user&value=\' + this.value, \''.$this->divListId.'\', '
-                            .$this->modeReturn.');" />&nbsp;';
-                //Autocompletion script and div
-                $filters .= '<div id="userListByName" class="autocomplete"></div>';
-                $filters .= '<script type="text/javascript">initList(\'user_id\', \'userListByName\', \''
-                            .$_SESSION['config']['businessappurl'].'index.php?display=true&page='
-                            .'users_autocomplete_list\', \'Input\', \'2\');</script>';
-            break;
-
-            case 'action':
-                $stmt = $db->query(
-                    'SELECT id, label_action FROM '
-                    .$_SESSION['tablename']['actions']
-                    ." WHERE origin = 'folder' and enabled = 'Y' and history = 'Y'"
-                );
-                while ($res = $stmt->fetchObject()) {
-                    $id = 'ACTION#'.$res->id;
-                    if (isset($_SESSION['filters']['action']['VALUE'])
-                        && $_SESSION['filters']['action']['VALUE'] == $id
-                        ) {
-                        $selected = 'selected="selected"';
-                    } else {
-                        $selected = '';
-                    }
-                    $options .= '<option value="'.urlencode($id).'" '.$selected.'>'.$res->label_action.'</option>';
-                }
-                $filters .= '<select name="action_id" id="action_id" onChange="loadList(\''.$this->link
-                            .'&filter=action&value=\' + document.filters.action_id.value, \''
-                            .$this->divListId.'\', '.$this->modeReturn.');">'
-                            .'<option value="none">'._CHOOSE_ACTION.'</option>'
-                            .$options.'</select>&nbsp;';
-            break;
-
-            case 'history_action':
-                for ($i = 0; $i < count($_SESSION['history_keywords']); ++$i) {
-                    if (isset($_SESSION['filters']['history_action']['VALUE'])
-                        && $_SESSION['filters']['history_action']['VALUE'] == $_SESSION['history_keywords'][$i]['id']
-                    ) {
-                        $selected = 'selected="selected"';
-                    } else {
-                        $selected = '';
-                    }
-                    $options .= '<option value="'.$_SESSION['history_keywords'][$i]['id'].'" '
-                        .$selected.'>'.$_SESSION['history_keywords'][$i]['label'].'</option>';
-                }
-                $filters .= '<select name="history_action_id" id="history_action_id" onChange="loadList(\''.$this->link
-                            .'&filter=history_action&value=\' + document.filters.history_action_id.value, \''
-                            .$this->divListId.'\', '.$this->modeReturn.');">'
-                            .'<option value="none">'._CHOOSE_ACTION.'</option>'
-                            .$options.'</select>&nbsp;';
-            break;
-
-            case 'history_date':
-                if (isset($_SESSION['filters']['history_date_start']['VALUE']) && !empty($_SESSION['filters']['history_date_start']['VALUE'])) {
-                    $date_start = $_SESSION['filters']['history_date_start']['VALUE'];
-                }
-                $filters .= '&nbsp;&nbsp;'._SINCE.': <input type="text" name="date_start" '
-                    .'id="date_start" onclick="showCalender(this);" '
-                    .'onKeyPress="if(event.keyCode == 9 || event.keyCode == 13)loadList(\''.$this->link
-                    .'&filter=history_date_start&value=\' + this.value, \''.$this->divListId.'\', '
-                    .$this->modeReturn.');" value="'.$date_start.'" size="15" />';
-
-                if (isset($_SESSION['filters']['history_date_end']['VALUE']) && !empty($_SESSION['filters']['history_date_end']['VALUE'])) {
-                    $date_end = $_SESSION['filters']['history_date_end']['VALUE'];
-                }
-                $filters .= '&nbsp;&nbsp;'._FOR.': <input type="text" name="date_end" '
-                    .'id="date_end" onclick="showCalender(this);" '
-                    .'onKeyPress="if(event.keyCode == 9 || event.keyCode == 13)loadList(\''.$this->link
-                    .'&filter=history_date_end&value=\' + this.value, \''.$this->divListId.'\', '
-                    .$this->modeReturn.');" value="'.$date_end.'" size="15" />&nbsp;';
-            break;
-
-            case 'creation_date':
-                if (isset($_SESSION['filters']['creation_date_start']['VALUE']) && !empty($_SESSION['filters']['creation_date_start']['VALUE'])) {
-                    $date_start = $_SESSION['filters']['creation_date_start']['VALUE'];
-                }
-                $filters .= '&nbsp;&nbsp;'._SINCE.': <input type="text" name="date_start" '
-                    .'id="date_start" onclick="showCalender(this);" '
-                    .'onKeyPress="if(event.keyCode == 9 || event.keyCode == 13)loadList(\''.$this->link
-                    .'&filter=creation_date_start&value=\' + this.value, \''.$this->divListId.'\', '
-                    .$this->modeReturn.');" value="'.$date_start.'" size="15" />';
-
-                if (isset($_SESSION['filters']['creation_date_end']['VALUE']) && !empty($_SESSION['filters']['creation_date_end']['VALUE'])) {
-                    $date_end = $_SESSION['filters']['creation_date_end']['VALUE'];
-                }
-                $filters .= '&nbsp;&nbsp;'._FOR.': <input type="text" name="date_end" '
-                    .'id="date_end" onclick="showCalender(this);" '
-                    .'onKeyPress="if(event.keyCode == 9 || event.keyCode == 13)loadList(\''.$this->link
-                    .'&filter=creation_date_end&value=\' + this.value, \''.$this->divListId.'\', '
-                    .$this->modeReturn.');" value="'.$date_end.'" size="15" />&nbsp;';
-            break;
-
-            case 'identifier':
-                if (isset($_SESSION['filters']['identifier']['VALUE']) && !empty($_SESSION['filters']['identifier']['VALUE'])) {
-                    $identifier = $_SESSION['filters']['identifier']['VALUE'];
-                }/* else {
-                    $identifier = '['._CHRONO_NUMBER.']';
-                }*/
-                $filters .= '<input type="text" name="identifier" placeholder="'._CHRONO_NUMBER.'" id="identifier" style="width:150px;" value="'.$identifier.'" size="40" '
-                           // .'onfocus="if(this.value==\'['._CHRONO_NUMBER.']\'){this.value=\'\';}" '
-                            .'onChange="loadList(\''.$this->link
-                            .'&filter=identifier&value=\' + this.value, \''.$this->divListId.'\', '.$this->modeReturn.');" '
-                            .'onKeyPress="if(event.keyCode == 9 || event.keyCode == 13)loadList(\''.$this->link
-                            .'&filter=identifier&value=\' + this.value, \''.$this->divListId.'\', '
-                            .$this->modeReturn.');" />&nbsp;';
-                break;
-        }
-
-        return $filters;
-    }
-
-    protected function _haveFilter()
-    {
-        $haveFilter = false;
-
-        foreach ($_SESSION['filters'] as $key => $val) {
-            if (!empty($_SESSION['filters'][$key]['VALUE']) || ($key == 'priority' && $_SESSION['filters'][$key]['VALUE'] == 0)) {
-                $haveFilter = true;
-                break;
-            }
-        }
-
-        return  $haveFilter;
-    }
-
-    protected function _resetFilter()
-    {
-        if ($_SESSION['previous_basket']['id'] != $_SESSION['current_basket']['id']) {
-            foreach ($_SESSION['filters'] as $key => $val) {
-                $_SESSION['filters'][$key]['VALUE'] = '';
-                $_SESSION['filters'][$key]['CLAUSE'] = '';
-            }
-        }/*elseif($_SESSION['basket_used'] == $_GET['baskets']){
-            foreach ($_SESSION['filters'] as $key => $val) {
-                $_SESSION['filters'][$key]['VALUE'] = '';
-                $_SESSION['filters'][$key]['CLAUSE'] = '';
-                }
-
-        }*/
-    }
-
-    public function _resetFilter2()
-    {
-        foreach ($_SESSION['filters'] as $key => $val) {
-            $_SESSION['filters'][$key]['VALUE'] = '';
-            $_SESSION['filters'][$key]['CLAUSE'] = '';
-        }
-    }
-
-    protected function _manageFilters()
-    {
-        //Reset all filters
-        if ($_REQUEST['filter'] == 'reset') {
-            $this->_resetFilter2();
-        } else { //Init filter value and clause
-            if (isset($_REQUEST['value']) && (!empty($_REQUEST['value']) || ($_REQUEST['filter'] == 'priority' && $_REQUEST['value'] == 0))) {
-                if ($_REQUEST['value'] == 'none') {
-                    //Reset if none
-                    $_SESSION['filters'][$_REQUEST['filter']]['VALUE'] = '';
-                    $_SESSION['filters'][$_REQUEST['filter']]['CLAUSE'] = '';
-                } else {
-                    //Keep value
-                    $_SESSION['filters'][$_REQUEST['filter']]['VALUE'] = $_REQUEST['value'];
-                    //Build where clause
-                    if ($_REQUEST['filter'] == 'status') {
-                        if ($_SESSION['filters']['status']['VALUE'] == 'late') {
-                            require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php';
-                            $request = new request();
-                            $_SESSION['filters']['status']['CLAUSE'] = '(process_limit_date is not null and '
-                                .$request->current_datetime().' > '
-                                .$request->extract_date('process_limit_date')." ) and status <> 'END'";
-                        } else {
-                            $_SESSION['filters']['status']['CLAUSE'] = "status = '".$_SESSION['filters']['status']['VALUE']."'";
-                        }
-                    } elseif ($_REQUEST['filter'] == 'entity') {
-                        $_SESSION['filters']['entity_subentities']['VALUE'] = '';
-                        $_SESSION['filters']['entity_subentities']['CLAUSE'] = '';
-                        $_SESSION['filters']['entity_subentities']['checked'] = false;
-
-                        $_SESSION['filters']['entity']['CLAUSE'] = "destination = '".$_SESSION['filters']['entity']['VALUE']."'";
-                    } elseif ($_REQUEST['filter'] == 'entity_subentities') {
-                        //$_SESSION['filters']['entity']['VALUE'] = '';
-                        if ($_SESSION['filters']['entity_subentities']['checked'] == true) {
-                            $_SESSION['filters']['entity_subentities']['checked'] = false;
-                            $_SESSION['filters']['entity_subentities']['VALUE'] = '';
-                            $_SESSION['filters']['entity_subentities']['CLAUSE'] = '';
-                        } else {
-                            $_SESSION['filters']['entity']['CLAUSE'] = '';
-                            $_SESSION['filters']['entity_subentities']['checked'] = true;
-                        }
-
-                        require_once 'modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR
-                            .'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php';
-
-                        $entities = new entity();
-                        $subEntities_tmp = array();
-                        $subEntities = array();
-
-                        $subEntities_tmp = $entities->getEntityChildrenTree($subEntities_tmp, $_SESSION['filters']['entity_subentities']['VALUE']);
-
-                        for ($iSubEntities = 0; $iSubEntities < count($subEntities_tmp); ++$iSubEntities) {
-                            array_push($subEntities, "'".$subEntities_tmp[$iSubEntities]['ID']."'");
-                        }
-                        array_push($subEntities, "'".$_SESSION['filters']['entity_subentities']['VALUE']."'");
-
-                        $_SESSION['filters']['entity_subentities']['CLAUSE'] = 'destination in ('.implode(',', $subEntities).')';
-                    } elseif ($_REQUEST['filter'] == 'typist') {
-                        $_SESSION['filters']['typist']['CLAUSE'] = "typist = '".$_SESSION['filters']['typist']['VALUE']."'";
-                    } elseif ($_REQUEST['filter'] == 'category') {
-                        $_SESSION['filters']['category']['CLAUSE'] = "category_id = '".$_SESSION['filters']['category']['VALUE']."'";
-                    } elseif ($_REQUEST['filter'] == 'contact') {
-                        if (is_numeric($_SESSION['filters']['contact']['VALUE'])) {
-                            $_SESSION['filters']['contact']['CLAUSE'] = "(exp_contact_id = '".$_SESSION['filters']['contact']['VALUE']."' or dest_contact_id = '".$_SESSION['filters']['contact']['VALUE']."')";
-                        } else {
-                            $_SESSION['filters']['contact']['CLAUSE'] = "(exp_user_id = '".$_SESSION['filters']['contact']['VALUE']."' or dest_user_id = '".$_SESSION['filters']['contact']['VALUE']."')";
-                        }
-                    } elseif ($_REQUEST['filter'] == 'identifier') {
-                        $_SESSION['filters']['identifier']['CLAUSE'] = "alt_identifier ilike ('%".$_SESSION['filters']['identifier']['VALUE']."%')";
-                    } elseif ($_REQUEST['filter'] == 'type') {
-                        $_SESSION['filters']['type']['CLAUSE'] = "type_id = '".$_SESSION['filters']['type']['VALUE']."'";
-                    } elseif ($_REQUEST['filter'] == 'res_id') {
-                        /*Permet de filtrer sur le res_id*/
-                        if (is_numeric($_SESSION['filters']['res_id']['VALUE'])) {
-                            $_SESSION['filters']['res_id']['CLAUSE'] = "res_id = '".$_SESSION['filters']['res_id']['VALUE']."'";
-                        }
-                    } elseif ($_REQUEST['filter'] == 'subject') {
-                        /*Permet de filtrer sur le l'objet du courrier et si la valeur saisi est un numérique va rechercher sur le res_id*/
-                        $_SESSION['filters']['subject']['CLAUSE'] = "upper(subject) like '%".strtoupper($_SESSION['filters']['subject']['VALUE'])."%'";
-                        if (is_numeric($_SESSION['filters']['subject']['VALUE'])) {
-                            $_SESSION['filters']['subject']['CLAUSE'] .= "or res_id = '".$_SESSION['filters']['subject']['VALUE']."'";
-                        }
-                    } elseif ($_REQUEST['filter'] == 'isViewed') {
-                        if ($_SESSION['filters']['isViewed']['VALUE'] == 'yes') {
-                            $_SESSION['filters']['isViewed']['CLAUSE'] = "res_id in (select res_id from listinstance WHERE coll_id = '".$_SESSION['collection_id_choice']."' and item_type = 'user_id' and item_id = '".$_SESSION['user']['UserId']."' and item_mode = 'cc' and viewed > 0)";
-                        } elseif ($_SESSION['filters']['isViewed']['VALUE'] == 'no') {
-                            $_SESSION['filters']['isViewed']['CLAUSE'] = "res_id in (select res_id from listinstance WHERE coll_id = '".$_SESSION['collection_id_choice']."' and item_type = 'user_id' and item_id = '".$_SESSION['user']['UserId']."' and item_mode = 'cc' and viewed = 0 or viewed is null)";
-                        }
-                    } elseif ($_REQUEST['filter'] == 'user') {
-                        $userId = $this->protect_string_db(str_replace(')', '',
-                            substr($_SESSION['filters']['user']['VALUE'],
-                            strrpos($_SESSION['filters']['user']['VALUE'], '(') + 1)));
-                        $_SESSION['filters']['user']['CLAUSE'] = $_SESSION['tablename']['users'].".user_id = '".$userId."'";
-                    } elseif ($_REQUEST['filter'] == 'action') {
-                        $_SESSION['filters']['action']['CLAUSE'] = "event_type = '".$_SESSION['filters']['action']['VALUE']."'";
-                    } elseif ($_REQUEST['filter'] == 'history_action') {
-                        $_SESSION['filters']['history_action']['CLAUSE'] = "event_type = '".$_SESSION['filters']['history_action']['VALUE']."'";
-                    } elseif ($_REQUEST['filter'] == 'history_date_start' || $_REQUEST['filter'] == 'history_date_end') {
-                        //Pattern
-                        $pattern = '/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/';
-                        //Keep the date
-                        $history_date = array();
-                        //date start
-                        if (preg_match($pattern, $_SESSION['filters']['history_date_start']['VALUE']) == false) {
-                            $_SESSION['error'] = _DATE.' '._WRONG_FORMAT;
-                        } else {
-                            $history_date['start'] = "(date(event_date) >= '"
-                                .$_SESSION['filters']['history_date_start']['VALUE']."')";
-                        }
-                        //date end
-                        if (preg_match($pattern, $_SESSION['filters']['history_date_end']['VALUE']) == false) {
-                            $_SESSION['error'] = _DATE.' '._WRONG_FORMAT;
-                        } else {
-                            $history_date['end'] = "(date(event_date) <= '"
-                                .$_SESSION['filters']['history_date_end']['VALUE']."')";
-                        }
-
-                        $_SESSION['filters']['history_date']['CLAUSE'] = join(' and ', $history_date);
-                    } elseif ($_REQUEST['filter'] == 'creation_date_start' || $_REQUEST['filter'] == 'creation_date_end') {
-                        //Pattern
-                        $pattern = '/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/';
-                        //Keep the date
-                        $creation_date = array();
-                        //date start
-                        if (preg_match($pattern, $_SESSION['filters']['creation_date_start']['VALUE']) == false) {
-                            $_SESSION['error'] = _DATE.' '._WRONG_FORMAT;
-                        } else {
-                            $creation_date['start'] = "(creation_date >= '"
-                                .$_SESSION['filters']['creation_date_start']['VALUE']."')";
-                        }
-                        //date end
-                        if (preg_match($pattern, $_SESSION['filters']['creation_date_end']['VALUE']) == false) {
-                            $_SESSION['error'] = _DATE.' '._WRONG_FORMAT;
-                        } else {
-                            $creation_date['end'] = "(creation_date <= '"
-                                .$_SESSION['filters']['creation_date_end']['VALUE']."')";
-                        }
-
-                        $_SESSION['filters']['creation_date']['CLAUSE'] = join(' and ', $creation_date);
-                    } elseif ($_REQUEST['filter'] == 'priority' && isset($_REQUEST['value'])) {
-                        $_SESSION['filters']['priority']['CLAUSE'] = "priority = '".$_REQUEST['value']."'";
-                    }
-                }
-            }
-        }
-    }
-
-    protected function _resetUrlTemplates()
-    {
-        unset($_SESSION['url_templates']);
-        $_SESSION['url_templates'] = array();
-    }
-
-    protected function _getTemplates()
-    {
-        $templates = '';
-
-        //Check the selected template
-
-        //Show the templates
-        if (isset($this->params['templates']) && count($this->params['templates']) > 0) {
-            //Default list (no template)
-            if ($this->params['bool_showTemplateDefaultList'] === true) {
-                //Put none in template array
-                if (!in_array('none', $this->params['templates'])) {
-                    array_unshift($this->params['templates'], 'none');
-                }
-            } else {
-                //Unset none from template array
-                if (isset($this->params['templates']['none'])) {
-                    unset($this->params['templates']['none']);
-                }
-            }
-            // $this->show_array($_SESSION['html_templates']);
-
-            //Build templates icon and link
-            for ($i = 0; $i < count($this->params['templates']); ++$i) {
-                //Template is defined?
-                if (isset($_SESSION['html_templates'][$this->params['templates'][$i]])) {
-                    //Selected template
-                    if ($this->template == $_SESSION['html_templates'][$this->params['templates'][$i]]['ID']) {
-                        $selected = 'color: #FBC110';
-                    } else {
-                        $selected = '';
-                    }
-
-                    //Template link
-                    if (empty($_SESSION['url_templates'][$this->params['templates'][$i]])) {
-                        if (!empty($_SESSION['html_templates'][$this->params['templates'][$i]]['GOTOLIST'])) {
-                            //link from template parameters
-                            $_SESSION['url_templates'][$this->params['templates'][$i]] =
-                                $_SESSION['html_templates'][$this->params['templates'][$i]]['GOTOLIST']
-                                .'&template='.$_SESSION['html_templates'][$this->params['templates'][$i]]['ID'];
-                        } else {
-                            //
-                            // $this->link = $this->_removeUrlVar($this->link, 'template');
-                            $_SESSION['url_templates'][$this->params['templates'][$i]] =
-                                $this->link.'&template='.$_SESSION['html_templates'][$this->params['templates'][$i]]['ID'];
-                        }
-                    }
-
-                    //Templates
-                    $templates .= '<a href="javascript://" onClick="loadList(\''
-                        .$_SESSION['url_templates'][$this->params['templates'][$i]].'\', \''
-                        .$this->divListId.'\', '.$this->modeReturn.');" title="'
-                        .$_SESSION['html_templates'][$this->params['templates'][$i]]['LABEL'].'">'
-                        .'<i class="'
-                        .$_SESSION['html_templates'][$this->params['templates'][$i]]['IMG'].'" title="'
-                        .$_SESSION['html_templates'][$this->params['templates'][$i]]['LABEL'].'" '
-                        .'style="vertical-align: middle;'.$selected.'"></i></a>&nbsp;&nbsp;';
-                }
-            }
-        }
-
-        // $this->show_array($_SESSION['url_templates']);
-        return $templates;
-    }
-
-    protected function _loadTemplate($templateFile)
-    {
-        $templateContent = '';
-
-        //Get tge filecontent
-        $templateContent = file_get_contents($templateFile);
-
-        //Delete all comments
-        $templateContent = preg_replace('/(<!--.*?-->)/s', '', $templateContent);
-
-        return $templateContent;
-    }
-
-    protected function _tmplt_defineLang($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            if (defined($my_explode[1]) && constant($my_explode[1]) != null) {
-                return constant($my_explode[1]);
-            } else {
-                return $my_explode[1];
-            }
-        }
-    }
-
-    protected function _tmplt_sortColumn($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!isset($my_explode[1])) {
-            return  _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            $column = $my_explode[1];
-            ($this->order == 'desc' && (strpos($this->orderField, $column) !== false)) ? $sortImgDown = 'mCdarkOrange' : $sortImgDown = 'mCdarkBlue';
-            ($this->order == 'asc' && (strpos($this->orderField, $column) !== false)) ? $sortImgUp = 'mCdarkOrange' : $sortImgUp = 'mCdarkBlue';
-
-            $return .= '<a href="javascript://" onClick="loadList(\''.$this->link
-                        .'&order=desc&order_field='.$column.'\', \''.$this->divListId.'\', '.$this->modeReturn.');" title="'
-                        ._DESC_SORT.'"><i class="fa fa-angle-down fa-2x '.$sortImgDown.'" title="'._DESC_SORT.'"></i></a>';
-            $return .= '<a href="javascript://" onClick="loadList(\''.$this->link
-                        .'&order=asc&order_field='.$column.'\', \''.$this->divListId.'\', '.$this->modeReturn.');" title="'
-                        ._ASC_SORT.'"><i class="fa fa-angle-up fa-2x '.$sortImgUp.'" title="'._ASC_SORT.'"></i></a>';
-        }
-
-        return $return;
-    }
-
-    protected function _tmplt_cssLineReload()
-    {
-        //Get last css parameter defined for the result list
-        return $this->tmplt_CurrentCssLine;
-    }
-
-    protected function _tmplt_cssLine($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            //Treat
-            if (count($my_explode) == 2) {
-                return $my_explode[1];
-            } elseif (count($my_explode) == 3) {
-                if ($this->tmplt_CurrentCssLine == '') {
-                    $this->tmplt_CurrentCssLine = $my_explode[1];
-
-                    return $this->tmplt_CurrentCssLine;
-                } elseif ($this->tmplt_CurrentCssLine == $my_explode[1]) {
-                    $this->tmplt_CurrentCssLine = $my_explode[2];
-
-                    return $this->tmplt_CurrentCssLine;
-                } elseif ($this->tmplt_CurrentCssLine == $my_explode[2]) {
-                    $this->tmplt_CurrentCssLine = $my_explode[1];
-
-                    return $this->tmplt_CurrentCssLine;
-                } else {
-                    return _WRONG_PARAM_FOR_LOAD_VALUE;
-                }
-            } else {
-                return _WRONG_PARAM_FOR_LOAD_VALUE;
-            }
-        }
-    }
-
-    protected function _tmplt_loadImage($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            if (count($my_explode) == 2) {
-                return '<i class="fa fa-'.$my_explode[1].'"></i>';
-            } elseif (count($my_explode) >= 3) {
-                return '<i class="fa fa-'.$my_explode[1].'"></i>';
-            } else {
-                return _WRONG_PARAM_FOR_LOAD_VALUE;
-            }
-        }
-    }
-
-    protected function _tmplt_loadEscapeValue($parameter, $resultTheLine)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            $column = $my_explode[1];
-            if (is_array($resultTheLine)) {
-                for ($i = 0; $i <= count($resultTheLine); ++$i) {
-                    if ($resultTheLine[$i]['column'] == $column) {
-                        if (is_bool($resultTheLine[$i]['value'])) {
-                            //If boolean (convert to string)
-                            if ($resultTheLine[$i]['value']) {
-                                return 'true';
-                            } else {
-                                return 'false';
-                            }
-                        } else {
-                            if ($resultTheLine[$i]['column'] == 'subject') {
-                                return preg_replace('/\s+/', ' ', $resultTheLine[$i]['value']);
-                            } else {
-                                return addslashes($resultTheLine[$i]['value']);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    protected function _tmplt_loadValue($parameter, $resultTheLine)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            $column = $my_explode[1];
-            if (is_array($resultTheLine)) {
-                for ($i = 0; $i <= count($resultTheLine); ++$i) {
-                    if ($resultTheLine[$i]['column'] == $column) {
-                        if (is_bool($resultTheLine[$i]['value'])) {
-                            //If boolean (convert to string)
-                            if ($resultTheLine[$i]['value']) {
-                                return 'true';
-                            } else {
-                                return 'false';
-                            }
-                        } else {
-                            if ($resultTheLine[$i]['column'] == 'subject') {
-                                return preg_replace('/\s+/', ' ', $resultTheLine[$i]['value']);
-                            } else {
-                                return $resultTheLine[$i]['value'];
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    protected function _tmplt_showSmallToolbar()
-    {
-        $this->params['bool_showSmallToolbar'] = true;
-
-        return $this->_createSmallToolbar();
-    }
-
-    protected function _tmplt_checkBox($resultTheLine, $listKey, $lineIsDisabled)
-    {
-        //Get the ListKey value
-        $keyValue = '';
-        if (is_array($resultTheLine)) {
-            for ($i = 0; $i <= count($resultTheLine); ++$i) {
-                if ($resultTheLine[$i]['column'] == $listKey) {
-                    $keyValue = $resultTheLine[$i]['value'];
-                }
-            }
-        }
-
-        //If checkbox is activated (is it important if template???)
-        if ($this->params['bool_checkBox'] === true) {
-            if ($_SESSION['stockCheckbox'] != null) {
-                $key = in_array($keyValue, $_SESSION['stockCheckbox']);
-
-                //If disable or checkbox
-                if ($key == true) {
-                    if ($lineIsDisabled === true || empty($keyValue)) {
-                        $return .= '<div align="center"><i class="fa fa-lock fa-2x" title="'._LOCKED.'"></i></div>';
-                    } else {
-                        $return .= '<div align="center"><input type="checkbox" checked="yes" name="field[]" id="field" class="check" onclick="stockCheckbox(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=multiLink\','.$keyValue.');" value="'
-                                    .$keyValue.'" /></div>';
-                    }
-                } else {
-                    if ($lineIsDisabled === true || empty($keyValue)) {
-                        $return .= '<div align="center"><i class="fa fa-lock fa-2x" title="'._LOCKED.'"></i></div>';
-                    } else {
-                        $return .= '<div align="center"><input type="checkbox" name="field[]" id="field" class="check" onclick="stockCheckbox(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=multiLink\','.$keyValue.');" value="'
-                                    .$keyValue.'" /></div>';
-                    }
-                }
-            } else {
-                //If disable or checkbox
-                if ($lineIsDisabled === true || empty($keyValue)) {
-                    $return .= '<div align="center"><i class="fa fa-lock fa-2x" title="'._LOCKED.'"></i></div>';
-                } else {
-                    $return .= '<div align="center"><input type="checkbox" name="field[]" id="field" class="check" onclick="stockCheckbox(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=multiLink\','.$keyValue.');" value="'
-                                .$keyValue.'" /></div>';
-                }
-            }
-        }
-
-        return $return;
-    }
-
-    protected function _tmplt_checkUncheckAll()
-    {
-        //If checkbox is activated
-        if ($this->params['bool_checkBox'] === true) {
-            return '<input type="checkbox" id="checkUncheck" name="checkUncheck" value="" onclick="CheckUncheckAll(this);">';
-        }
-    }
-
-    protected function _tmplt_radioButton($resultTheLine, $listKey, $lineIsDisabled)
-    {
-        $return = '';
-
-        //Get the ListKey value
-        $keyValue = '';
-        if (is_array($resultTheLine)) {
-            for ($i = 0; $i <= count($resultTheLine); ++$i) {
-                if ($resultTheLine[$i]['column'] == $listKey) {
-                    $keyValue = $resultTheLine[$i]['value'];
-                }
-            }
-        }
-        //If radio button is activated (is it important if template???)
-        if ($this->params['bool_radioButton'] === true) {
-            //If disable or radio button
-            if ($lineIsDisabled === true || empty($keyValue)) {
-                $return .= '<div align="center"><i class="fa fa-lock fa-2x" title="'._LOCKED.'"></i></div>';
-            } else {
-                $return .= '<div align="center"><input type="radio" name="field" id="field" class="check" value="'
-                            .$keyValue.'" /></div>';
-            }
-        }
-
-        return $return;
-    }
-
-    protected function _tmplt_showIconProcessDocument($resultTheLine, $listKey)
-    {
-        $return = '';
-        //Show document icon
-        $href = $this->_buildMyLink('index.php?page=view_baskets&module=basket&baskets=MyBasket&directLinkToAction', $resultTheLine, $listKey);
-        $return .= '<div align="center"><a href="'.$href.'" target="_blank" title="'
-                ._PROCESS.'"><i class="fa fa-cog fa-2x" title="'._PROCESS.'"></i></a></div>';
-
-        return $return;
-    }
-
-    protected function _tmplt_showIconDocument($resultTheLine, $listKey)
-    {
-        $return = '';
-        //Show document icon
-        if (is_array($resultTheLine)) {
-            foreach ($resultTheLine as $r) {
-                if (isset($r['res_id'])) {
-                    $res_id = $r['res_id'];
-                    break;
-                }
-            }
-        }
-        $isAttachment = false;
-        if (is_array($resultTheLine)) {
-            foreach ($resultTheLine as $r) {
-                if ($r['column'] === 'attachment_type') {
-                    $isAttachment = true;
-                    break;
-                }
-            }
-        }
-
-        $href = $this->_buildMyLink($this->params['viewDocumentLink'], $resultTheLine, $listKey);
-        if (!$isAttachment) {
-            $return .= '<div align="center" class="iconDoc" onmouseover="displayThumbnail(\''.$res_id.'\')"><a href="../../rest/resources/'.$res_id.'/content" target="_blank" title="'
-                    ._VIEW_DOC.'"><i class="tooltip fa fa-download fa-2x" title="'._VISUALIZE.'"></i><span id="thumb_'.$res_id.'" name="thumb_'.$res_id.'"></span></a></div>';
-        } else {
-            $return .= '<div align="right" class="iconDoc" style="" ><a href="'.$href.'" target="_blank" title="'
-                    ._VIEW_DOC.'"><i class="tooltip fa fa-download fa-2x" title="'._VISUALIZE.'"></i></a></div>';
-        }
-
-        return $return;
-    }
-
-    protected function _tmplt_visualizeIconDocument($resultTheLine, $listKey)
-    {
-        $href = $this->_buildMyLink($this->params['visualizeDocumentLink'], $resultTheLine, $listKey);
-
-        $return .= '<div align="right" class="iconDoc" style="" ><a href="'.$href.'" target="_blank"><i class="tooltip fa fa-eye fa-2x" title="'._VISUALIZE.'"></i></a></div>';
-
-        return $return;
-    }
-
-    protected function _tmplt_downloadIconDocument($resultTheLine, $listKey)
-    {
-        $href = $this->_buildMyLink($this->params['downloadDocumentLink'], $resultTheLine, $listKey);
-
-        $return .= '<div align="right" class="iconDoc" style="" ><a href="'.$href.'" target="_blank"><i class="tooltip fa fa-download fa-2x" title="'._DOWNLOAD.'"></i></a></div>';
-
-        return $return;
-    }
-
-    protected function _tmplt_showIconDetails($resultTheLine, $listKey)
-    {
-        $return = '';
-        //Show details button
-        $linkToDetail = "triggerAngular('#/resources/".array_column($resultTheLine, 'res_id')[0]."');";
-        $href = $this->_buildMyLink($this->params['viewDetailsLink'], $resultTheLine, $listKey);
-        $return .= '<div align="center"><a href="javascript://" onClick="javascript:'.$linkToDetail.'return false;" title="'._DETAILS.'"><i class="fa fa-info-circle fa-2x" title="'._DETAILS.'"></i></a></div>';
-
-        return $return;
-    }
-
-    protected function _tmplt_showActionIcon($parameter, $resultTheLine)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            if (count($my_explode) >= 4) {
-                //Init
-                $actionIsDisabled = false;
-
-                //Check if action is disabled
-                if (isset($my_explode[4]) && !empty($my_explode[4])) {
-                    $actionIsDisabled = $this->_checkDisabledRules($my_explode[4], $resultTheLine);
-                }
-                //If disabled, return blank
-                if ($actionIsDisabled) {
-                    return '&nbsp;';
-                } else {
-                    //return action icon
-                    return '<a href="javascript://" onClick="'.$my_explode[3]
-                        .'" title="'.$my_explode[1]
-                        .'">'.$my_explode[2].'</a>';
-                }
-            } else {
-                return _WRONG_PARAM_FOR_LOAD_VALUE;
-            }
-        }
-    }
-
-    protected function _tmplt_showActionFA($parameter, $resultTheLine)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            if (count($my_explode) >= 4) {
-                //Init
-                $actionIsDisabled = false;
-
-                //Check if action is disabled
-                if (isset($my_explode[4]) && !empty($my_explode[4])) {
-                    $actionIsDisabled = $this->_checkDisabledRules($my_explode[4], $resultTheLine);
-                }
-                //If disabled, return blank
-                if ($actionIsDisabled) {
-                    return '&nbsp;';
-                } else {
-                    //return action icon
-                    return '<a href="javascript://" onClick="'.$my_explode[3]
-                        .'" title="'.$my_explode[1].'"><i class="fa fa-'
-                        .$my_explode[2].' fa-2x" title="'.$my_explode[1].'"></i></a>';
-                }
-            } else {
-                return _WRONG_PARAM_FOR_LOAD_VALUE;
-            }
-        }
-    }
-
-    protected function _tmplt_func_isConfidential($resultTheLine)
-    {
-        $db = new Database();
-        $stmt = $db->query('SELECT confidentiality FROM res_letterbox WHERE res_id = ?',
-                                [$resultTheLine[0]['res_id']]);
-        $color = '';
-        $result = $stmt->fetchObject();
-        if ($result->confidentiality == 'Y') {
-            return '<span style="position: absolute;transform: rotate(-20deg);color: red;-ms-transform: rotate(7deg);-webkit-transform: rotate(7deg);font-weight: bold;margin-left:-80px;margin-top:10px;">'.strtoupper(_CONFIDENTIAL).'</span>';
-        }
-    }
-
-    protected function _tmplt_showActionAdvResultFA($parameter, $resultTheLine)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            if (count($my_explode) >= 4) {
-                //Init
-                $actionIsDisabled = false;
-
-                //Check if action is disabled
-                if (isset($my_explode[4]) && !empty($my_explode[4])) {
-                    $actionIsDisabled = $this->_checkDisabledRules($my_explode[4], $resultTheLine);
-                }
-                //If disabled, return blank
-                if ($actionIsDisabled) {
-                    return '&nbsp;';
-                } else {
-                    //return action icon
-                    $color = '';
-                    if (!empty($_SESSION['fullTextAttachments']['letterbox']) &&
-                        in_array($resultTheLine[0]['res_id'], $_SESSION['fullTextAttachments']['letterbox'])) {
-                        $color = 'style="color: #135F7F;"';
-                    }
-                    $db = new Database();
-                    $stmt = $db->query(
-                        "SELECT count(1) as total FROM res_attachments WHERE res_id_master = ? and status not in ('DEL','OBS','TMP') and lower(translate(title,'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ','aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr')) like lower(?)", array($resultTheLine[0]['res_id'], $_SESSION['searching']['where_request_parameters'][':subject'])
-                    );
-                    $res_attach = $stmt->fetchObject();
-                    if ($res_attach->total > 0) {
-                        $color = 'style="color: #135F7F;"';
-                    }
-
-                    return '<a href="javascript://" onClick="'.$my_explode[3]
-                    .'" title="'.$my_explode[1].'"><i class="fa fa-'
-                    .$my_explode[2].' fa-2x" '.$color.' title="'.$my_explode[1].'"></i></a>';
-                }
-            } else {
-                return _WRONG_PARAM_FOR_LOAD_VALUE;
-            }
-        }
-    }
-
-    protected function _tmplt_clickOnLine($resultTheLine, $listKey, $lineIsDisabled)
-    {
-        $return = '';
-
-        //If there is action on line click
-        if ($this->params['bool_actionOnLineClick'] &&
-            isset($this->params['defaultAction']) && !empty($this->params['defaultAction']) &&
-            $lineIsDisabled === false
-        ) {
-            //Get the ListKey value
-            $keyValue = '';
-            if (is_array($resultTheLine)) {
-                for ($i = 0; $i <= count($resultTheLine); ++$i) {
-                    if ($resultTheLine[$i]['column'] == $listKey) {
-                        $keyValue = $resultTheLine[$i]['value'];
-                    }
-                }
-            }
-            $sAction = \Action\models\ActionModel::getActionPageById(['id' => $this->params['defaultAction']]);
-            if ($sAction == 'visa_mail') {
-                $return = 'onmouseover="this.style.cursor=\'pointer\';" onClick="islockForSignatureBook(\''.$keyValue.'\', \''.$_SESSION['current_basket']['id'].'\', \''.$_SESSION['current_basket']['group_id'].'\')"';
-            } else {
-                $return = 'onmouseover="this.style.cursor=\'pointer\';" onClick="validForm( \'page\', \''.$keyValue.'\', \''.$this->params['defaultAction'].'\');" ';
-            }
-        }
-
-        return $return;
-    }
-
-    protected function _tmplt_includeFile($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            //File
-            $file = $my_explode[1];
-
-            if (count($my_explode) == 3 && isset($my_explode[2]) && !empty($my_explode[2])) {
-                $module = $my_explode[2];
-                include 'modules'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$file;
-            } else {
-                include 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.$file;
-            }
-        }
-    }
-
-    protected function _tmplt_getBusinessAppUrl()
-    {
-        return $_SESSION['config']['businessappurl'];
-    }
-
-    protected function _tmplt_getListParameter($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            return  $this->params[$my_explode[1]];
-        }
-    }
-
-    protected function _tmplt_setListParameter($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            if (count($my_explode) == 3) {
-                if ($my_explode[2] == 'true') {
-                    $this->params[$my_explode[1]] = true;
-                } elseif ($my_explode[2] == 'false') {
-                    $this->params[$my_explode[1]] = false;
-                } else {
-                    $this->params[$my_explode[1]] = $my_explode[2];
-                }
-            } else {
-                return _WRONG_PARAM_FOR_LOAD_VALUE;
-            }
-        }
-    }
-
-    protected function _tmplt_ifStatement($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            if (count($my_explode) >= 4) {
-                $condition = "return($my_explode[1]);";
-                // $debug .='condition: '.$condition."<br>";
-                if (@eval($condition)) {
-                    return $my_explode[2];
-                } else {
-                    return $my_explode[3];
-                }
-            } else {
-                return _WRONG_PARAM_FOR_LOAD_VALUE;
-            }
-        }
-    }
-
-    protected function _tmplt_isModuleLoaded($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-
-        if (!$my_explode[1]) {
-            return _WRONG_PARAM_FOR_LOAD_VALUE;
-        } else {
-            $core_tools = new core_tools();
-
-            if ($core_tools->is_module_loaded($my_explode[1]) === true) {
-                return 'true';
-            } else {
-                return 'false';
-            }
-        }
-    }
-
-    public function tmplt_func_bool_see_notes($resultTheLine)
-    {
-        $return = '';
-        if ($resultTheLine[0]['hasNotes'] || $resultTheLine[1]['hasNotes']) {
-            $return .= '<i class="fa fa-pen-square fa-2x" style="cursor: pointer;" title="'._NOTES.'" onclick="loadNoteList('.$resultTheLine[0]['value'].');"></i>';
-        }
-
-        return $return;
-    }
-
-    public function tmplt_func_delete($resultTheLine)
-    {
-        $return = '';
-
-        $nbresult_I = count($resultTheLine);
-        for ($iresults = 0; $iresults < $nbresult_I; ++$iresults) {
-            if ($resultTheLine[$iresults]['typist_id']) {
-                $typist = $resultTheLine[$iresults]['typist_id'];
-            }
-            if ($resultTheLine[$iresults]['fromDetail']) {
-                $fromDetail = $resultTheLine[$iresults]['fromDetail'];
-            }
-            if ($resultTheLine[$iresults]['value_bis']) {
-                $status = $resultTheLine[$iresults]['value_bis'];
-            }
-        }
-
-        $return = '<a href="" class="delete" style="visibility:hidden;"><i class="tooltip fa fa-trash-alt fa-2x" title="'._DELETE.'"></i></a>';
-        $return .= '<script>titleWithTooltipsterClass("tooltip");</script>';
-
-        return $return;
-    }
-
-    public function tmplt_func_modify($resultTheLine)
-    {
-        $return = '';
-        $nbresult_I = count($resultTheLine);
-        for ($iresults = 0; $iresults < $nbresult_I; ++$iresults) {
-            if ($resultTheLine[$iresults]['typist_id']) {
-                $typist = $resultTheLine[$iresults]['typist_id'];
-            }
-            if ($resultTheLine[$iresults]['relation']) {
-                $relation = $resultTheLine[$iresults]['relation'];
-            }
-            if ($resultTheLine[$iresults]['fromDetail']) {
-                $fromDetail = $resultTheLine[$iresults]['fromDetail'];
-            }
-            if ($resultTheLine[$iresults]['value_bis']) {
-                $status = $resultTheLine[$iresults]['value_bis'];
-            }
-        }
-
-        $return = '<a href="javascript://" disabled="disabled" class="change" style="visibility:hidden;">
-                                <i class="tooltip fa fa-edit fa-2x" title="'._MODIFY.'"></i></a>';
-
-        return $return;
-    }
-
-    public function tmplt_func_previous_version($resultTheLine)
-    {
-        $return = '';
-        if ((int) $resultTheLine[1]['value'] > 1) {
-            $return .= '<i class="fa fa-file" onclick="showPreviousAttachments(\''.$_SESSION['config']['businessappurl']
-                .'index.php?display=true&module=attachments&page=previous_attachments\',\''
-                .$resultTheLine[0]['value'].'\');" style="cursor: pointer;" title="'._SHOW_PREVIOUS_VERSION.'" ></i>';
-        }
-
-        return $return;
-    }
-
-    public function tmplt_func_final_version($resultTheLine)
-    {
-        static $count = 0;
-
-        foreach ($resultTheLine as $value) {
-            if ($value['column'] == 'in_signature_book') {
-                $inSignatureBook = $value['value'];
-            }
-            if ($value['column'] == 'in_send_attach') {
-                $inSendAttach = $value['value'];
-            }
-        }
-
-        $return = '<div>';
-
-        $mailevaConfig = \SrcCore\models\CoreConfigModel::getMailevaConfiguration();
-        $mailevaEnabled = false;
-        if (!empty($mailevaConfig) && $mailevaConfig['enabled']) {
-            $mailevaEnabled = true;
-        }
-
-        $return .= '<input type="checkbox" name="sendAttach'. $count .'" id="sendAttach'. $count .'" align="left"';
-
-        if (!empty($inSendAttach)) {
-            $return .= 'checked ';
-        }
-        if (!$mailevaEnabled) {
-            $return .= 'disabled ';
-        }
-
-        $return .= 'onclick="setSendAttachment('.$resultTheLine[0]['value'].');"/><label';
-        if (!$mailevaEnabled) {
-            $return .= ' style="opacity: 0.5; cursor: default" ';
-        }
-        $return .= ' for="sendAttach'. $count .'">'._PUT_IN_SEND_ATTACH.'</label>';
-
-        $return .= '</div>';
-
-        $return .= '<div>';
-
-        $return .= '<input type="checkbox" name="final'. $count .'" id="final'. $count .'" align="left"';
-
-        if (!empty($inSignatureBook)) {
-            $return .= 'checked ';
-        }
-
-        $return .= 'onclick="setAttachmentInSignatureBook('.$resultTheLine[0]['value'].');"/><label for="final'. $count .'">'._PUT_IN_SIGNATORY_BOOK.'</label>';
-
-        $return .= '</div>';
-
-        ++$count;
-
-        return $return;
-    }
-
-    public function tmplt_func_bool_see_multi_contacts($resultTheLine)
-    {
-        $return = '';
-        $nbresult_I = is_array($resultTheLine) ? count($resultTheLine) : 0;
-
-        for ($iresults = 0; $iresults < $nbresult_I; ++$iresults) {
-            if ($resultTheLine[$iresults]['is_multi_contacts']) {
-                $isMultiContacts = $resultTheLine[$iresults]['is_multi_contacts'];
-            }
-            if ($resultTheLine[$iresults]['res_multi_contacts']) {
-                $resMultiContacts = $resultTheLine[$iresults]['res_multi_contacts'];
-            }
-        }
-
-        return $return;
-    }
-
-    public function tmplt_func_cadenas($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-        $now = date('Y-m-d H:i:s');
-        $my_explode[2] = str_replace("'", '', $my_explode[2]);
-        $my_explode[1] = str_replace("'", '', $my_explode[1]);
-
-        if (!isset($my_explode[2])) {
-            return '';
-        } elseif ($my_explode[2] == null || $my_explode[2] == '' || empty($my_explode[2])) {
-            return '';
-        } elseif ($my_explode[1] == $_SESSION['user']['UserId']) {
-            return '';
-        } elseif ($my_explode[2] > $now) {
-            return '<i class="fa fa-lock fa-2x"></i>';
-        } else {
-            return '';
-        }
-    }
-
-    public function tmplt_showDefaultAction($parameter)
-    {
-        $db = new Database();
-        if ($_SESSION['current_basket']['default_action'] != '') {
-            //Load action name
-            $stmt = $db->query(
-            'SELECT label_action FROM actions WHERE id = ?', array($_SESSION['current_basket']['default_action'])
-        );
-            $res = $stmt->fetchObject();
-
-            return $res->label_action;
-        }
-    }
-
-    public function tmplt_nbNoteAvis($parameter)
-    {
-        $my_explode = explode('|', $parameter);
-        $res_id = str_replace("'", '', $my_explode[1]);
-        $db = new Database();
-        //Load action name
-        $stmt = $db->query(
-            "SELECT count(*) as total FROM notes WHERE identifier = ? and note_text like '[avis%'", array($res_id)
-        );
-        $note = $stmt->fetchObject();
-
-        return $note->total;
-    }
-
-    protected function _tmplt_loadVarSys($parameter, $resultTheLine = array(), $listKey = '', $lineIsDisabled = false)
-    {
-        //#loadValue|arg1##: load value in the db; arg1= column's value identifier
-        if (preg_match("/^loadValue\|/", $parameter)) {
-            $var = $this->_tmplt_loadValue($parameter, $resultTheLine);
-            //#loadValue|arg1##: load value in the db; arg1= column's value identifier
-        } elseif (preg_match("/^loadEscapeValue\|/", $parameter)) {
-            $var = $this->_tmplt_loadEscapeValue($parameter, $resultTheLine);
-            //#defineLang|arg1## : define constant by the lang file; arg1 = constant of lang.php
-        } elseif (preg_match("/^sortColumn\|/", $parameter)) {
-            $var = $this->_tmplt_sortColumn($parameter);
-            //#defineLang|arg1## : define constant by the lang file; arg1 = constant of lang.php
-        } elseif (preg_match("/^defineLang\|/", $parameter)) {
-            $var = $this->_tmplt_defineLang($parameter);
-            //#cssLineReload## : reload css style for next line
-        } elseif (preg_match('/^cssLineReload$/', $parameter)) {
-            $var = $this->_tmplt_cssLineReload($parameter);
-            //#cssLine|coll|nonecoll## : load css style for line arg1,arg2 : switch beetwin style on line one or line two
-        } elseif (preg_match("/^cssLine\|/", $parameter)) {
-            $var = $this->_tmplt_cssLine($parameter);
-            //#loadImage|arg1|arg2## :load image; arg1= image name, arg2 = module name (if image in module)
-        } elseif (preg_match("/^loadImage\|/", $parameter)) {
-            $var = $this->_tmplt_loadImage($parameter);
-            //#showSmallToolbar: swhow small bar for navigation
-        } elseif (preg_match('/^showSmallToolbar$/', $parameter)) {
-            $var = $this->_tmplt_showSmallToolbar();
-            //#checkBox## : show checkbox
-        } elseif (preg_match('/^checkBox$/', $parameter)) {
-            $var = $this->_tmplt_checkBox($resultTheLine, $listKey, $lineIsDisabled);
-            //#checkUncheckAll## : show checkbox check All /uncheck All
-        } elseif (preg_match('/^checkUncheckAll$/', $parameter)) {
-            $var = $this->_tmplt_checkUncheckAll();
-            //#radioButton## : show radio button
-        } elseif (preg_match('/^radioButton$/', $parameter)) {
-            $var = $this->_tmplt_radioButton($resultTheLine, $listKey, $lineIsDisabled);
-            //#showIconProcessDocument## : show process document icon and link
-        } elseif (preg_match('/^showIconProcessDocument$/', $parameter)) {
-            $var = $this->_tmplt_showIconProcessDocument($resultTheLine, $listKey);
-            //#showIconDocument## : show document icon and link
-        } elseif (preg_match('/^showIconDocument$/', $parameter)) {
-            $var = $this->_tmplt_showIconDocument($resultTheLine, $listKey);
-            //#visualizeIconDocument## : show document icon and link
-        } elseif (preg_match('/^visualizeIconDocument$/', $parameter)) {
-            $var = $this->_tmplt_visualizeIconDocument($resultTheLine, $listKey);
-            //#downloadIconDocument## : show download document icon and link
-        } elseif (preg_match('/^downloadIconDocument$/', $parameter)) {
-            $var = $this->_tmplt_downloadIconDocument($resultTheLine, $listKey);
-            //#showIconDetails## : show details icon and link
-        } elseif (preg_match('/^showIconDetails$/', $parameter)) {
-            $var = $this->_tmplt_showIconDetails($resultTheLine, $listKey);
-        } elseif (preg_match("/^showActionIcon\|/", $parameter)) {
-            $var = $this->_tmplt_showActionIcon($parameter, $resultTheLine);
-            //#showActionFA## : show action Font Awesome
-        } elseif (preg_match("/^showActionFA\|/", $parameter)) {
-            $var = $this->_tmplt_showActionFA($parameter, $resultTheLine);
-            //#showActionAdvResultFA## : show action Font Awesome
-        } elseif (preg_match("/^showActionAdvResultFA\|/", $parameter)) {
-            $var = $this->_tmplt_showActionAdvResultFA($parameter, $resultTheLine);
-            //#clickOnLine## : Action on click under the line
-        } elseif (preg_match('/^clickOnLine$/', $parameter)) {
-            $var = $this->_tmplt_clickOnLine($resultTheLine, $listKey, $lineIsDisabled);
-            //#includeFile## : Action on click under the line
-        } elseif (preg_match("/^includeFile\|/", $parameter)) {
-            $var = $this->_tmplt_includeFile($parameter);
-            //#getBusinessAppUrl## : Action on click under the line
-        } elseif (preg_match('/^getBusinessAppUrl$/', $parameter)) {
-            $var = $this->_tmplt_getBusinessAppUrl();
-            //#getListParameter## :
-        } elseif (preg_match("/^getListParameter\|/", $parameter)) {
-            $var = $this->_tmplt_getListParameter($parameter);
-            //#setListParameter## :
-        } elseif (preg_match("/^setListParameter\|/", $parameter)) {
-            $var = $this->_tmplt_setListParameter($parameter);
-            //#isModuleLoaded## :
-        } elseif (preg_match("/^isModuleLoaded\|/", $parameter)) {
-            $var = $this->_tmplt_isModuleLoaded($parameter);
-            //#ifStatement## :
-        } elseif (preg_match("/^ifStatement\|/", $parameter)) {
-            $var = $this->_tmplt_ifStatement($parameter);
-        } elseif (preg_match('/^func_bool_see_multi_contacts$/', $parameter)) {
-            $var = $this->tmplt_func_bool_see_multi_contacts($resultTheLine);
-        } elseif (preg_match('/^func_delete$/', $parameter)) {
-            $var = $this->tmplt_func_delete($resultTheLine);
-        } elseif (preg_match('/^func_modify$/', $parameter)) {
-            $var = $this->tmplt_func_modify($resultTheLine);
-        } elseif (preg_match('/^func_final_version$/', $parameter)) {
-            $var = $this->tmplt_func_final_version($resultTheLine);
-        } elseif (preg_match('/^func_previous_version$/', $parameter)) {
-            $var = $this->tmplt_func_previous_version($resultTheLine);
-        } elseif (preg_match('/^func_bool_see_notes$/', $parameter)) {
-            $var = $this->tmplt_func_bool_see_notes($resultTheLine);
-        } elseif (preg_match("/^func_cadenas\|/", $parameter)) {
-            $var = $this->tmplt_func_cadenas($parameter);
-        } elseif (preg_match('/^showDefaultAction$/', $parameter)) {
-            $var = $this->tmplt_showDefaultAction($parameter);
-        } elseif (preg_match("/^nbNoteAvis\|/", $parameter)) {
-            $var = $this->tmplt_nbNoteAvis($parameter);
-        } elseif (preg_match('/^func_isConfidential$/', $parameter)) {
-            $var = $this->_tmplt_func_isConfidential($resultTheLine);
-            //#showActionIcon## : show action icon
-        } else {
-            $var = _WRONG_FUNCTION_OR_WRONG_PARAMETERS;
-        }
-
-        return $var;
-    }
-
-    protected function _buildTemplate($templateFile, $resultArray, $listKey, $parameters = [])
-    {
-        if (file_exists('custom/'.$_SESSION['custom_override_id'].'/'.$templateFile)) {
-            $templateFile = 'custom/'.$_SESSION['custom_override_id'].'/'.$templateFile;
-        }
-        //Check if template file exists
-        if (file_exists($templateFile)) {
-            //Load template file
-            $templateContent = $this->_loadTemplate($templateFile);
-
-            //Explode template
-            $templateContentArray = explode('#!#', $templateContent);
-
-            //Get value from template
-            foreach ($templateContentArray as $templateSection) {
-                if (substr($templateSection, 0, 5) == 'TABLE') {
-                    //Get table string
-                    $table = substr($templateSection, 5);
-                    $trueTable = $table;
-                    preg_match_all('/##(.*?)##/', $trueTable, $output);
-
-                    //Replace functions by values
-                    for ($i = 0; $i < count($output[0]); ++$i) {
-                        $remplacementTable = $this->_tmplt_loadVarSys($output[1][$i]);
-                        $table = str_replace($output[0][$i], $remplacementTable, $trueTable);
-                    }
-                } elseif (substr($templateSection, 0, 4) == 'HEAD') {
-                    //Get head string
-                    $head = substr($templateSection, 4);
-                    $trueHead = $head;
-                    preg_match_all('/##(.*?)##/', $trueHead, $output);
-
-                    for ($i = 0; $i < count($output[0]); ++$i) {
-                        //If template function is called under template function
-                        $_trueHead = $output[1][$i];
-                        preg_match_all('/#(.*?)#/', $_trueHead, $_output);
-                        for ($j = 0; $j < count($_output[0]); ++$j) {
-                            // $debug .='--> '.$_output[0][$j].'<br>';
-                            $_remplacementHead = $this->_tmplt_loadVarSys($_output[1][$j]);
-                            // $debug .='---> '.$_remplacementHead.'<br>';
-                            $_trueHead = str_replace($_output[0][$j], $_remplacementHead, $_trueHead);
-                        }
-                        $output[1][$i] = $_trueHead;
-
-                        $remplacementHead = $this->_tmplt_loadVarSys($output[1][$i]);
-                        $trueHead = str_replace($output[0][$i], $remplacementHead, $trueHead);
-                    }
-                    $head = $trueHead;
-                } elseif (substr($templateSection, 0, 6) == 'RESULT') {
-                    //Get rows content
-                    $content = substr($templateSection, 6);
-                } elseif (substr($templateSection, 0, 6) == 'FOOTER') {
-                    //Get footer string
-                    $footer = substr($templateSection, 6);
-                }
-            }
-
-            $rowsContent = '';
-            //Loop into the set of records
-            for ($theLine = 0; $theLine < $this->end; ++$theLine) {
-                //Check if line is disable
-                $lineIsDisabled = $this->_checkDisabledRules($this->params['disabledRules'], $resultArray[$theLine]);
-
-                //Treat content
-                $trueContent = $content;
-
-                preg_match_all('/##(.*?)##/', $trueContent, $output);
-
-                for ($i = 0; $i < count($output[0]); ++$i) {
-                    // echo '-> '.$output[1][$i].'<br>';
-                    $_trueContent = '';
-
-                    //If template function is called under template function
-                    $_trueContent = $output[1][$i];
-
-                    preg_match_all('/#(.*?)#/', $_trueContent, $_output);
-
-                    for ($j = 0; $j < count($_output[0]); ++$j) {
-                        // echo '--> '.$_output[0][$j].'<br>';
-                        $_remplacement = $this->_tmplt_loadVarSys($_output[1][$j], $resultArray[$theLine], $listKey, $lineIsDisabled);
-                        // echo '---> '.$_remplacement.'<br>';
-                        $_trueContent = str_replace($_output[0][$j], $_remplacement, $_trueContent);
-                    }
-                    $output[1][$i] = $_trueContent;
-
-                    // echo '<- '.$output[1][$i].'<br><br>';
-
-                    if (empty($parameters) || empty($parameters['noModification']) || ($output[1][$i] != 'func_modify' && $output[1][$i] != 'func_delete')) {
-                        $remplacement = $this->_tmplt_loadVarSys($output[1][$i], $resultArray[$theLine], $listKey, $lineIsDisabled);
-                    } else {
-                        $remplacement = '';
-                    }
-                    $trueContent = str_replace($output[0][$i], $remplacement, $trueContent);
-                }
-
-                $rowsContent .= $trueContent;
-            }
-
-            $buildedTemplate = $table.$head.$rowsContent.$footer;
-
-            //Fix some json line breaks issues
-            $buildedTemplate = str_replace(chr(10), '', $buildedTemplate);
-            $buildedTemplate = str_replace(chr(13), '', $buildedTemplate);
-
-            return $buildedTemplate;
-        } else {
-            return _NO_TEMPLATE_FILE_AVAILABLE.': '.$templateFile;
-        }
-    }
-
-    protected function _highlightWords($input, $keyword, $maxLength = 30, $minLength = 5)
-    {
-        $output = $input;
-
-        if (strlen(trim($keyword)) < $maxLength && strlen(trim($keyword)) > $minLength) {
-            // $output = preg_replace("/(>|^)([^<]+)(?=<|$)/esx", "'\\1' . str_replace('" . $keyword . "', '<span class=\"highlighted\">" . $keyword . "</span>', '\\2')", $input);
-            // $output = preg_replace("/(?<!\[)(\b{$keyword}\b)(?!\])/i", '<span class="highlighted">\\1</span>', $input);
-            $keywordArray = explode(' ', $keyword);
-            for ($i = 0; $i < count($keywordArray); ++$i) {
-                $save_keywordArray = '';
-                $pos = stripos($input, $keywordArray[$i]);
-
-                if ($pos !== false) {
-                    $save_keywordArray = substr($input, $pos, strlen($keywordArray[$i]));
-                }
-                $output = preg_replace('/('.$keywordArray[$i].')/i', '<span class="highlighted">'.$save_keywordArray.'</span>', $input);
-            }
-        }
-
-        return $output;
-    }
-
-    protected function _buildMyLink($link, $resultTheLine, $listKey = '')
-    {
-        //If you want to use different key for action link
-        if (strpos($link, '@@') !== false) {
-            foreach (array_keys($resultTheLine) as $column) { // for every column
-                $key = '@@'.$resultTheLine[$column]['column'].'@@'; //build the alias
-                $val = $resultTheLine[$column]['value']; //get the real value
-                $link = str_replace($key, $val, $link); //replace alias by real value
-            }
-        }
-
-        //Use standard id (based on list key)
-        if (!empty($listKey)) {
-            //Get the ListKey value
-            $keyValue = '';
-            if (is_array($resultTheLine)) {
-                for ($i = 0; $i <= count($resultTheLine); ++$i) {
-                    if ($resultTheLine[$i]['column'] == $listKey) {
-                        $keyValue = $resultTheLine[$i]['value'];
-                    }
-                }
-            }
-            $link .= '&id='.$keyValue;
-        }
-
-        return $link;
-    }
-
-    protected function _removeUrlVar($url, $varName)
-    {
-        $url = html_entity_decode($url);
-        $urlArray = parse_url($url);
-        parse_str($urlArray['query'], $output);
-        unset($output[$varName]);
-        $urlVar = http_build_query($output);
-
-        return  strtok($url, '?').'?'.$urlVar;
-    }
-
-    protected function _buildPageLink()
-    {
-        //Get page and module from REQUEST
-        if (!isset($this->params['pageName']) || empty($this->params['pageName'])) {
-            $this->params['pageName'] = $_REQUEST['page'];
-        }
-        if (!isset($this->params['moduleName']) || empty($this->params['moduleName'])) {
-            $this->params['moduleName'] = $_REQUEST['module'];
-        }
-
-        //Url parameters
-        if (isset($this->params['urlParameters'])) {
-            $pos = strpos($this->params['urlParameters'], '&');
-            //if my urlParameters string have '&'
-            if ($pos !== false) {
-                //at the firt position
-                if ($pos != 0) {
-                    //And page is called by index page
-                    if ($this->params['bool_pageInModule']) {
-                        //Add '&'
-                        $this->params['urlParameters'] = '&'.$this->params['urlParameters'];
-                    }
-                }
-            } else {//my urlParameters string dont have '&' at all
-                //And page is called by index page
-                if ($this->params['bool_pageInModule']) {
-                    //Add '&'
-                    $this->params['urlParameters'] = '&'.$this->params['urlParameters'];
-                }
-            }
-        }
-
-        //Page pageName
-        if (isset($this->params['pageName'])) {
-            if ($this->params['bool_pageInModule'] && isset($this->params['moduleName'])) { //If page is called in a module by index page
-                $link = $_SESSION['config']['businessappurl'].'index.php?page='.$this->params['pageName'].'&module='
-                    .$this->params['moduleName'].$this->params['urlParameters'];
-            } elseif (isset($this->params['moduleName']) && !$this->params['bool_pageInModule']) { //Else if page is called inside the module
-                $link = $_SESSION['urltomodules'].$this->params['moduleName'].'/'.$this->params['pageName'].'.php?'.$this->params['urlParameters'];
-            } else {
-                $link = $_SESSION['config']['businessappurl'].'index.php?page='.$this->params['pageName'].$this->params['urlParameters'];
-            }
-        } else { //Default link (anchor) to prevent error in link if no pageName or module name
-            $link = '#';
-        }
-
-        //String searched in list
-        if (!empty($this->whatSearch)) {
-            $link = $this->_removeUrlVar($link, 'what');
-            $link .= '&what='.$this->whatSearch;
-        }
-
-        //Column order
-        if (!empty($_REQUEST['order']) && !empty($_REQUEST['order_field'])) {
-            //Remove some url parameters
-            $link = $this->_removeUrlVar($link, 'order');
-            $link = $this->_removeUrlVar($link, 'order_field');
-            //Init
-            $this->order = $_REQUEST['order'];
-            $this->orderField = $_REQUEST['order_field'];
-        }
-
-        //Template
-        if (isset($_REQUEST['template'])) {
-            //Remove some url parameters
-            $link = $this->_removeUrlVar($link, 'template');
-            $this->template = $_REQUEST['template'];
-            $link .= '&template='.$_REQUEST['template'];
-            $_SESSION['save_list']['template'] = $_REQUEST['template'];
-        }
-
-        //Id (used in sublist)
-        if (isset($_REQUEST['id'])) {
-            $link = $this->_removeUrlVar($link, 'id');
-            $link .= '&id='.$_REQUEST['id'];
-        }
-
-        //Number of lines to show
-        if (isset($_REQUEST['lines']) && !empty($_REQUEST['lines'])) {
-            $link = $this->_removeUrlVar($link, 'lines');
-            $link .= '&lines='.$_REQUEST['lines'];
-        }
-
-        //Display = true
-        if (isset($_REQUEST['display']) && !empty($_REQUEST['display'])) {
-            $link = $this->_removeUrlVar($link, 'display');
-            $link .= '&display=true';
-        }
-
-        return $link;
-    }
-
-    protected function _checkDisabledRules($disabledRules, $resultTheLine = array())
-    {
-        $disabled = false;
-
-        if (!empty($disabledRules)) {
-            if (is_array($resultTheLine) && count($resultTheLine) > 0) {
-                foreach (array_keys($resultTheLine) as $column) { // for every column
-                    $key = '@@'.$resultTheLine[$column]['column'].'@@'; //build the alias
-                    $val = "'".$resultTheLine[$column]['value']."'"; //get the real value with simple quotes
-                    $disabledRules = str_replace($key, $val, $disabledRules); //replace alias by real value
-                }
-            }
-            //Eval disabled rule
-            if (!empty($disabledRules)) {
-                $rules = "return($disabledRules);";
-//                echo $rules."<br>\n";
-                try {
-                    if (@eval($rules)) {
-                        $disabled = true;
-                    }
-                } catch (Throwable $t) {
-
-                }
-            }
-        }
-
-        return $disabled;
-    }
-
-    protected function _createHeader($resultFirstRow, $listColumn, $showColumn, $sortColumn)
-    {
-        $count_td = 0;
-
-        $column = '<tr>';
-
-        //If sublist
-        if ($this->params['bool_showSublist'] && !empty($this->params['sublistUrl'])) {
-            $column .= '<th width="1%">&nbsp;</th>';
-            ++$count_td;
-        }
-
-        //If checkbox
-        if ($this->params['bool_checkBox'] === true) {
-            $column .= '<th width="1%" alt="'._CHECK_ALL
-                    .' / '._UNCHECK_ALL
-                    .'"><div align="center"><input type="checkbox" '
-                    .'id="checkUncheck" name="checkUncheck" value="" onclick="CheckUncheckAll(this);"></div></th>';
-            ++$count_td;
-            //If radio button
-        } elseif ($this->params['bool_radioButton'] === true) {
-            $column .= '<th width="1%">&nbsp;</th>';
-            ++$count_td;
-        }
-
-        //If view document
-        if ($this->params['bool_showIconDocument']) {
-            $column .= '<th width="1%">&nbsp;</th>';
-            ++$count_td;
-        }
-
-        //Print column header
-        if (!empty($listColumn)) {
-            $numberListColumn = count($listColumn);
-        } else {
-            $numberListColumn = 0;
-        }
-        for ($actualColumn = 0; $actualColumn < $numberListColumn; ++$actualColumn) {
-            //Show column
-            if ($showColumn[$actualColumn] === true) {
-                //Different background on ordered column
-                if ($sortColumn[$actualColumn] === null) {
-                    $columnStyle = '';
-                } else {
-                    $columnStyle = (is_string($sortColumn[$actualColumn]) && strpos($this->orderField, $sortColumn[$actualColumn]) !== false) ? ' style="background-image: url(static.php?filename=black_0.1.png);"' : '';
-                }
-
-                //column
-                $column .= '<th'.$columnStyle.' width="'.$resultFirstRow[$actualColumn]['size']
-                        .'%" valign="'.$resultFirstRow[$actualColumn]['valign']
-                        .'"><div align="'.$resultFirstRow[$actualColumn]['label_align'].'">'
-                        .$listColumn[$actualColumn];
-
-                //Show sort icon
-                if ($this->params['bool_sortColumn']) {
-                    if ($sortColumn[$actualColumn] !== false) {
-                        //Change color of sort icon
-                        ($this->order == 'desc' && isset($sortColumn[$actualColumn]) && (strpos($this->orderField, $sortColumn[$actualColumn]) !== false)) ?
-                            $sortImgDown = 'mCdarkOrange' : $sortImgDown = 'mCdarkBlue';
-                        ($this->order == 'asc' && isset($sortColumn[$actualColumn]) && (strpos($this->orderField, $sortColumn[$actualColumn]) !== false)) ?
-                            $sortImgUp = 'mCdarkOrange' : $sortImgUp = 'mCdarkBlue';
-                        $column .= '<br/><br/>';
-
-                        //Build header
-                        $column .= '<a href="javascript://" onClick="loadList(\''.$this->link
-                        .'&order=desc&order_field='.$sortColumn[$actualColumn].'\', \''
-                        .$this->divListId.'\', '.$this->modeReturn.');" title="'
-                        ._DESC_SORT.'"><i class="fa fa-angle-down fa-2x '
-                        .$sortImgDown.'" title="'._DESC_SORT.'"></i></a>';
-                        $column .= '<a href="javascript://" onClick="loadList(\''.$this->link
-                        .'&order=asc&order_field='.$sortColumn[$actualColumn].'\', \''
-                        .$this->divListId.'\', '.$this->modeReturn.');" title="'
-                        ._ASC_SORT.'"><i class="fa fa-angle-up fa-2x '
-                        .$sortImgUp.'" title="'._ASC_SORT.'"></i></a>';
-                    }
-                }
-                $column .= '</div></th>';
-
-                ++$count_td;
-            }
-        }
-
-        //Reserve space for action buttons
-        if (!empty($this->actionButtons)) {
-            for ($i = 0; $i < count($this->actionButtons); ++$i) {
-                $column .= '<th width="1%" valign="bottom">&nbsp;</th>';
-                ++$count_td;
-            }
-        }
-
-        //Reserve space for details button
-        if ($this->params['bool_showIconDetails']) {
-            $column .= '<th width="1%" valign="bottom">&nbsp;</th>';
-            ++$count_td;
-        }
-
-        $column .= '</tr>';
-
-        //Count the number of columns
-        $this->countTd = $count_td;
-
-        //Small toolbar
-        $toolbar = '';
-        if ($this->params['bool_showSmallToolbar']) {
-            $toolbar = '<tr><th style="padding:0px;" colspan="'.$this->countTd.'">';
-            $toolbar .= $this->_createSmallToolbar();
-            $toolbar .= '</th></tr>';
-        }
-
-        //Add button
-        $addButton = $footer = '';
-        if ($this->params['bool_showAddButton']) {
-            $addButton = $this->_displayAddButton();
-            $footer = '<tfoot>'.$addButton.'</tfoot>';
-        }
-
-        //Header
-        $header = '<thead>'.$toolbar.$column.'</thead>'.$footer;
-
-        return $header;
-    }
-
-    protected function _getTools($resultFirstRow, $countResult)
-    {
-        //ADD ALWAYS VISISBLE PARAMETERS
-        $tools = $urlParameters = '';
-        if (isset($this->params['tools']) && count($this->params['tools']) > 0) {
-            for ($i = 0; $i < count($this->params['tools']); ++$i) {
-                if (!isset($this->params['tools'][$i]['alwaysVisible'])) {
-                    $this->params['tools'][$i]['alwaysVisible'] = false;
-                }
-
-                $toolIsDisabled = $this->_checkDisabledRules($this->params['tools'][$i]['disabledRules']);
-
-                if (($toolIsDisabled === false && $countResult > 0) || $this->params['tools'][$i]['alwaysVisible'] === true) {
-                    if (isset($this->params['tools'][$i]['script']) && !empty($this->params['tools'][$i]['script'])) {
-                        $script = $this->_buildMyLink($this->params['tools'][$i]['script'], $resultFirstRow);
-                        $tools .= '<a href="javascript://" onClick="'.$script
-                                .'" title="'.$this->params['tools'][$i]['tooltip'].'">';
-                    } else {
-                        //Url parameters
-                        if (isset($this->params['tools'][$i]['urlParameters'])) {
-                            $pos = strpos($this->params['tools'][$i]['urlParameters'], '&');
-                            //if my urlParameters string have '&'
-                            if ($pos !== false) {
-                                //at the firt position
-                                if ($pos != 0) {
-                                    //Add '&'
-                                    $this->params['tools'][$i]['urlParameters'] = '&'.$this->params['urlParameters'];
-                                }
-                            }
-                            $urlParameters = $this->params['tools'][$i]['urlParameters'];
-                        }
-                        //Href
-                        if (isset($this->params['tools'][$i]['href']) && !empty($this->params['tools'][$i]['href'])) {
-                            $href = $this->params['tools'][$i]['href'];
-                        } else {
-                            $href = $this->link.$urlParameters;
-                        }
-                        // If javascript alert box
-                        if (isset($this->params['tools'][$i]['alertText']) && !empty($this->params['tools'][$i]['alertText'])) {
-                            $tools .= '<a href="javascript://" onClick="if(confirm(\''
-                                    .addslashes($this->params['tools'][$i]['alertText']).'\')) loadList(\''
-                                    .$href.'\', \''.$this->divListId.'\', '.
-                                    $this->modeReturn.');" title="'.$this->params['tools'][$i]['tooltip'].'">';
-                        } else {
-                            $tools .= '<a href="javascript://" onClick="loadList(\''
-                                .$href.'\', \''.$this->divListId.'\', '.$this->modeReturn.');" title="'
-                                .$this->params['tools'][$i]['tooltip'].'">';
-                        }
-                    }
-                    //Image
-                    if (isset($this->params['tools'][$i]['icon'])) {
-                        $tools .= '<i class="fa fa-'.$this->params['tools'][$i]['icon'].' fa-2x" title="'.$this->params['tools'][$i]['tooltip'].'"></i>&nbsp;';
-                    } else {
-                        $tools .= '<i class="fa fa-ban fa-2x" title="NO_IMAGE"></i>&nbsp;';
-                    }
-                    $tools .= '</a>&nbsp;';
-                }
-            }
-        }
-
-        return $tools;
-    }
-
-    protected function _displaySearchTools()
-    {
-        $searchTools = '';
-        if ($this->params['bool_showSearchTools']) {
-            //Remove old what filter
-            $searchToolsLink = $this->_removeUrlVar($this->link, 'what');
-
-            $searchTools .= '<div id="searchTools" class="listletter"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="forms"><tr>';
-            //Alphabetical list
-            $searchTools .= '<td width="65%" height="30"><strong>'._ALPHABETICAL_LIST.'</strong> : ';
-            for ($i = ord('A'); $i <= ord('Z'); ++$i) {
-                //Highlight selected letter
-                (chr($i) == trim($this->whatSearch)) ? $letter = '<span class="selectedLetter">'.chr($i).'</span>' : $letter = chr($i);
-                $searchTools .= '<a href="javascript://" onClick="loadList(\''.$searchToolsLink.'&what='.chr($i)
-                    .'\', \''.$this->divListId.'\', '.$this->modeReturn.');">'.$letter.'</a>&nbsp;';
-            }
-            $searchTools .= '-&nbsp;<a href="javascript://" onClick="loadList(\''.
-                $searchToolsLink.'&what=\', \''.$this->divListId.'\', '.$this->modeReturn.');">'._ALL.'</a>';
-            $searchTools .= '</td>';
-            //Search box
-            $searchTools .= '<td width="35%" align="right">&nbsp;';
-            if ($this->params['bool_showSearchBox']) {
-                $searchTools .= '<form id="frmletters" name="frmletters" method="post" action="#"><div>';
-                (strlen($this->whatSearch) > 1) ? $what = $this->whatSearch : $what = '';
-                $searchTools .= '<input type="text" name="what" id="what" size="15" value="'.$what.'" onkeyup="erase_contact_external_id(\'what\', \'selectedObject\');"/>&nbsp;';
-                if (isset($this->params['searchBoxAutoCompletionUrl']) && !empty($this->params['searchBoxAutoCompletionUrl'])) {
-                    $searchTools .= '<div id="whatList" class="autocomplete"></div>';
-                    $searchTools .= '<script type="text/javascript">';
-                    if ($this->params['searchBoxAutoCompletionUpdate'] == true) {
-                        $searchTools .= 'launch_autocompleter_update(\''
-                            .$this->params['searchBoxAutoCompletionUrl'].'\', \'what\', \'whatList\', \''
-                            .$this->params['searchBoxAutoCompletionMinChars'].'\', \'selectedObject\');';
-                    } else {
-                        $searchTools .= 'initList(\'what\', \'whatList\', \''
-                            .$this->params['searchBoxAutoCompletionUrl'].'\', \''
-                            .$this->params['searchBoxAutoCompletionParamName'].'\', \''
-                            .$this->params['searchBoxAutoCompletionMinChars'].'\');';
-                    }
-
-                    $searchTools .= '</script>';
-                    $searchTools .= '<input type="hidden" name="selectedObject" id="selectedObject" />';
-                }
-                $searchTools .= '<input name="submit" class="button" type="button" value="'
-                    ._SEARCH.'" onClick="loadList(\''
-                    .$this->link.'&what=\' + document.getElementById(\'what\').value+\'&selectedObject=\' + document.getElementById(\'selectedObject\').value, \''
-                    .$this->divListId.'\', '.$this->modeReturn.');"/><div></form>';
-            }
-            $searchTools .= '</td>';
-            $searchTools .= '</tr></table></div>';
-        }
-
-        return $searchTools;
-    }
-
-    protected function _createToolbar($resultFirstRow)
-    {
-        $toolbar = $tools = $templates = $filters = '';
-        $start = $end = 0;
-
-        //Loading image
-        $loading = '<div id="loading" style="display:none;" title ="'._PROCESS_IN_PROGRESS.'""></div>';
-
-        //Lines to show
-        $nbLines = $this->params['linesToShow'];
-        if (isset($_REQUEST['lines']) && !empty($_REQUEST['lines'])) {
-            $nbLines = $this->params['linesToShow'] = strip_tags($_REQUEST['lines']);
-            $_SESSION['save_list']['lines'] = $nbLines;
-        }
-
-        //Number of pages
-        $current_page = ceil($this->start / $nbLines+1);
-        $nb_pages = ceil($this->countResult / $nbLines);
-
-        if ($nb_pages > 500) {
-            $nb_pages = 500;
-        }
-        // $debug .='NB total '.$this->countResult.' / NB show: '.$this->params['linesToShow'].' / Pages: '.$nb_pages.' /';
-
-        if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
-            $start = strip_tags($_REQUEST['start']);
-        }
-        /*$end = $start + $this->params['linesToShow'];
-        if ($end > $this->countResult) {
-            $end = $this->countResult;
-        }*/
-
-        //Get list of tools (icon and link)
-        $tools = $this->_getTools($resultFirstRow, $this->countResult);
-
-        //Get templates
-        $templates = $this->_getTemplates();
-
-        //Get Filters
-        if (isset($this->params['filters']) && count($this->params['filters']) > 0) {
-            $height = '60px';
-            $filters = '</tr><tr><td colspan="11" class="separator2">'.($this->_displayFilters()).'</td></tr>';
-        } else {
-            $height = '30px';
-        }
-
-        //Build dropdown lines object
-        $linesDropdownList = '';
-        if ($this->params['bool_changeLinesToShow']) {
-            $nbLinesSelect = array(
-                10,
-                25,
-                50,
-                100,
-                250,
-                500,
-            );
-            if (!in_array($this->params['linesToShow'], $nbLinesSelect)) {
-                array_push($nbLinesSelect, $this->params['linesToShow']);
-            }
-            sort($nbLinesSelect);
-
-            $linesDropdownList .= '<i class="fa fa-bars fa-2x" aria-hidden="true" title="'._SHOW.'"></i> <select name="nbLines" id="nbLines" onChange="loadList(\''.$this->link
-                                .'&order='.$this->order.'&order_field='
-                                .$this->orderField.'&lines=\' + this.value, \''
-                                .$this->divListId.'\', '.$this->modeReturn.');">';
-            //Array values
-            for ($i = 0; $i < count($nbLinesSelect); ++$i) {
-                if ($nbLinesSelect[$i] >= $this->countResult) {
-                    break;
-                }
-                ($nbLinesSelect[$i] == $nbLines) ? $selected = 'selected="selected" ' : $selected = '';
-                $linesDropdownList .= '<option value="'.$nbLinesSelect[$i].'" '.$selected.'>'.$nbLinesSelect[$i]._LINES.'</option>';
-            }
-            //Extra value
-            ($this->countResult == $nbLines || $this->countResult < $nbLines) ? $selected = 'selected="selected" ' : $selected = '';
-            $linesDropdownList .= '<option value="'.$this->countResult.'" '.$selected.'>'._ALL.'('.$this->countResult.')</option>';
-            $linesDropdownList .= '</select>';
-            //$linesDropdownList .= '<script>if(!$(\'nbLines_chosen\')){new c($(\'nbLines\'),{width: "auto", disable_search: true});}</script>';
-            $linesDropdownList .= '<script> $j("#nbLines").chosen({width: "auto", disable_search: true});</script>';
-        }
-
-        //If there are more than 1 page, pagination
-        if ($nb_pages > 1) {
-            //Build dropdown navigation object
-            $next_start = 0;
-            $pageDropdownList .= _GO_TO_PAGE.' <select name="startpage" onChange="loadList(\''.$this->link
-                                .'&order='.$this->order.'&order_field='
-                                .$this->orderField.'&start=\' + this.value, \''
-                                .$this->divListId.'\', '.$this->modeReturn.');">';
-            $lastpage = 0;
-            for ($i = 0; $i != $nb_pages; ++$i) {
-                $the_line = $i + 1;
-                if ($current_page == $the_line) {
-                    $pageDropdownList .= '<option value="'.$next_start.'" selected="selected">'.($i + 1).'</option>';
-                } else {
-                    $pageDropdownList .= '<option value="'.$next_start.'">'.($i + 1).'</option>';
-                }
-
-                $next_start = $next_start + $this->params['linesToShow'];
-                $lastpage = $next_start;
-            }
-            $pageDropdownList .= '</select>';
-
-            $lastpage = $lastpage - $this->params['linesToShow'];
-            $previous = '&nbsp;';
-            $next = '';
-            //Previous
-            if ($current_page > 1) {
-                $start_prev = $this->start - $this->params['linesToShow'];
-                $previous = '<a href="javascript://" onClick="loadList(\''.$this->link.'&order='
-                    .$this->order.'&order_field='.$this->orderField.'&start='.$start_prev
-                    .'\', \''.$this->divListId.'\', '.$this->modeReturn
-                    .');"><i class="fa fa-backward" title="'._PREVIOUS.'"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;';
-            }
-            //Next link
-            if ($current_page != $nb_pages) {
-                $start_next = $start + $this->params['linesToShow'];
-                $next = ' <a href="javascript://" onClick="loadList(\''.$this->link.'&order='
-                    .$this->order.'&order_field='.$this->orderField.'&start='
-                    .$start_next.'\', \''.$this->divListId.'\', '.$this->modeReturn
-                    .');"><i class="fa fa-forward" title="'._NEXT.'"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;';
-            }
-            $toolbar .= '<div class="block" style="height:'.$height.';" align="center" >';
-            $toolbar .= '<table width="100%" border="0"><tr>';
-            $toolbar .= '<td align="left" width="20px" nowrap>'.$loading.'</td>';
-            $toolbar .= '<td align="center" width="15%" nowrap><b>'.$previous.'</b></td>';
-            $toolbar .= '<td align="center" width="15%" nowrap><b>'.$next.'</b></td>';
-            $toolbar .= '<td width="10px" class="separator1">|</td>';
-            $toolbar .= '<td align="center" width="15%" nowrap>'.$pageDropdownList.'</td>';
-            $toolbar .= '<td width="10px" class="separator1">|</td>';
-            $toolbar .= '<td align="center" width="15%" nowrap>'.$linesDropdownList.'</td>';
-            $toolbar .= '<td width="10px" class="separator1">|</td>';
-            $toolbar .= '<td width="210px" align="right" nowrap>'.$tools.'</td>';
-            $toolbar .= '<td width="5px" class="separator1">|</td>';
-            $toolbar .= '<td align="right" nowrap>'.$templates.'</td>';
-            $toolbar .= '</tr>';
-            $toolbar .= $filters;
-            $toolbar .= '</table>';
-            $toolbar .= '</div>';
-        } else {
-            //Show toolbar if templates, tools or filters
-            if (
-                !empty($templates) ||
-                !empty($tools) ||
-                !empty($filters) ||
-                ($this->params['bool_changeLinesToShow'] && $this->countResult > 0)
-                ) {
-                // $showToolbar = true;
-                //if no result
-                if ($this->countResult == 0) {
-                    //reset templates and tools (no need if no result)
-                    // $templates = '&nbsp;';
-                    // $tools = '&nbsp;';
-                    //if not caused by filters => list is empty
-                    if ($this->_haveFilter() !== true) {
-                        $filters = '';
-                        // $showToolbar = false;
-                    }
-                }
-                //Toolbar
-                if ($this->params['bool_showToolbar']) {
-                    $toolbar .= '<div class="block" style="height:'.$height.';" align="center" >';
-                    $toolbar .= '<table width="100%" border="0"><tr>';
-                    $toolbar .= '<td align="left" width="20px" nowrap>'.$loading.'</td>';
-                    $toolbar .= '<td align="center" width="15%" nowrap><b>&nbsp;</b></td>';
-                    $toolbar .= '<td align="center" width="15%" nowrap><b>&nbsp;</b></td>';
-                    $toolbar .= '<td width="10px" class="separator1">|</td>';
-                    $toolbar .= '<td align="center" width="15%" nowrap>'.$pageDropdownList.'</td>';
-                    $toolbar .= '<td width="10px" class="separator1">|</td>';
-                    $toolbar .= '<td align="center" width="15%" nowrap>'.$linesDropdownList.'</td>';
-                    $toolbar .= '<td width="10px" class="separator1">|</td>';
-                    $toolbar .= '<td width="210px"align="right">'.$tools.'</td>';
-                    $toolbar .= '<td width="5px" class="separator1">|</td>';
-                    $toolbar .= '<td align="right" nowrap>'.$templates.'</td>';
-                    $toolbar .= '</tr>';
-                    $toolbar .= $filters;
-                    $toolbar .= '</table>';
-                    $toolbar .= '</div>';
-                }
-            }
-        }
-
-        //$this->start = $start;
-        //$this->end = $end;
-
-        return $toolbar;
-    }
-
-    protected function _createBottomToolbar($resultFirstRow)
-    {
-        //Init
-        $toolbar = $tools = $templates = '';
-        $start = $end = 0;
-
-        //Loading image
-        $loading = '<div id="loading" style="display:none;">'
-        .'<i class="fa fa-spinner fa-2x" style="vertical-align: middle;" title="loading..."></i></div>';
-
-        //Lines to show
-        if (isset($_REQUEST['lines']) && !empty($_REQUEST['lines'])) {
-            $nbLines = $this->params['linesToShow'] = strip_tags($_REQUEST['lines']);
-        }
-
-        //Number of pages
-        $nb_pages = ceil($this->countResult / $this->params['linesToShow']);
-        // $debug .='NB total '.$this->countResult.' / NB show: '.$this->params['linesToShow'].' / Pages: '.$nb_pages.' /';
-
-        if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
-            $start = strip_tags($_REQUEST['start']);
-        }
-        $end = $start + $this->params['linesToShow'];
-        if ($end > $this->countResult) {
-            $end = $this->countResult;
-        }
-
-        //Get list of tools (icon and link)
-        $tools = $this->_getTools($resultFirstRow, $this->countResult);
-
-        //Get templates
-        $templates = $this->_getTemplates();
-
-        //Go to top link
-        $goToTop = '<a href="javascript://" onclick="new Effect.ScrollTo(\'topOfTheList\');'
-            .'return false;" alt="Top"><i class="fa fa-arrow-up fa-2x" style="vertical-align: middle;" title="Top"></a>';
-
-        //Build dropdown lines object
-        $linesDropdownList = '';
-        if ($this->params['bool_changeLinesToShow']) {
-            $nbLinesSelect = array(
-                10,
-                25,
-                50,
-                100,
-                250,
-                500,
-            );
-            if (!in_array($this->params['linesToShow'], $nbLinesSelect)) {
-                array_push($nbLinesSelect, $this->params['linesToShow']);
-            }
-            sort($nbLinesSelect);
-
-            $linesDropdownList .= '<i class="fa fa-bars fa-2x" aria-hidden="true" title="'._SHOW.'"></i> <select name="nbLines" id="nbLines" onChange="loadList(\''.$this->link
-                                .'&order='.$this->order.'&order_field='
-                                .$this->orderField.'&lines=\' + this.value, \''
-                                .$this->divListId.'\', '.$this->modeReturn.');">';
-            //Array values
-            for ($i = 0; $i < count($nbLinesSelect); ++$i) {
-                if ($nbLinesSelect[$i] >= $this->countResult) {
-                    break;
-                }
-                ($nbLinesSelect[$i] == $nbLines) ? $selected = 'selected="selected" ' : $selected = '';
-                $linesDropdownList .= '<option value="'.$nbLinesSelect[$i].'" '.$selected.'>'.$nbLinesSelect[$i]._LINES.'</option>';
-            }
-            //Extra value
-            ($this->countResult == $nbLines || $this->countResult < $nbLines) ? $selected = 'selected="selected" ' : $selected = '';
-            $linesDropdownList .= '<option value="'.$this->countResult.'" '.$selected.'>'._ALL.'('.$this->countResult.')</option>';
-            $linesDropdownList .= '</select>';
-            //$linesDropdownList .= '<script>if(!$(\'nbLines_chosen\')){new c($(\'nbLines\'),{width: "auto", disable_search: true});}</script>';
-            $linesDropdownList .= '<script> $j("#nbLines").chosen({width: "auto", disable_search: true});</script>';
-        }
-
-        //If there are more than 1 page, pagination
-        if ($nb_pages > 1) {
-            //Build dropdown navigation object
-            $next_start = 0;
-            $pageDropdownList .= _GO_TO_PAGE.' <select name="startpage" onChange="loadList(\''.$this->link
-                                .'&order='.$this->order.'&order_field='
-                                .$this->orderField.'&start=\' + this.value, \''
-                                .$this->divListId.'\', '.$this->modeReturn.');">';
-            $lastpage = 0;
-            for ($i = 0; $i != $nb_pages; ++$i) {
-                $the_line = $i + 1;
-                if ($start == $next_start) {
-                    $pageDropdownList .= '<option value="'.$next_start.'" selected="selected">'.($i + 1).'</option>';
-                } else {
-                    $pageDropdownList .= '<option value="'.$next_start.'">'.($i + 1).'</option>';
-                }
-
-                $next_start = $next_start + $this->params['linesToShow'];
-                $lastpage = $next_start;
-            }
-            $pageDropdownList .= '</select>';
-
-            $lastpage = $lastpage - $this->params['linesToShow'];
-            $previous = '&nbsp;';
-            $next = '';
-            //Previous
-            if ($start > 0) {
-                $start_prev = $start - $this->params['linesToShow'];
-                $previous = '<a href="javascript://" onClick="loadList(\''.$this->link.'&order='
-                    .$this->order.'&order_field='.$this->orderField.'&start='.$start_prev
-                    .'\', \''.$this->divListId.'\', '.$this->modeReturn
-                    .');"><i class="fa fa-backward" title="'._PREVIOUS.'"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;';
-            }
-
-            //Next link
-            if ($start != $lastpage) {
-                $start_next = $start + $this->params['linesToShow'];
-                $next = ' <a href="javascript://" onClick="loadList(\''.$this->link.'&order='
-                    .$this->order.'&order_field='.$this->orderField.'&start='
-                    .$start_next.'\', \''.$this->divListId.'\', '.$this->modeReturn
-                    .');"><i class="fa fa-forward" title="'._NEXT.'"></i></a>';
-            }
-
-            //Toolbar
-            $bottomToolbar .= '<br/>';
-            $bottomToolbar .= '<div class="block_bottom" align="center" >';
-            $bottomToolbar .= '<table width="100%" border="0"><tr>';
-            $bottomToolbar .= '<td align="left" width="20px" nowrap>'.$loading.'</td>';
-            $bottomToolbar .= '<td align="center" width="15%" nowrap><b>'.$previous.'</b></td>';
-            $bottomToolbar .= '<td align="center" width="15%" nowrap><b>'.$next.'</b></td>';
-            $bottomToolbar .= '<td width="10px" class="separator1">|</td>';
-            $bottomToolbar .= '<td align="center" width="15%" nowrap>'.$pageDropdownList.'</td>';
-            $bottomToolbar .= '<td width="10px" class="separator1">|</td>';
-            $bottomToolbar .= '<td align="center" width="15%" nowrap>'.$linesDropdownList.'</td>';
-            $bottomToolbar .= '<td width="10px" class="separator1">|</td>';
-            $bottomToolbar .= '<td width="210px" align="right" nowrap>'.$tools.'</td>';
-            $bottomToolbar .= '<td width="5px" class="separator1">|</td>';
-            $bottomToolbar .= '<td align="right" nowrap>'.$templates.'</td>';
-            $bottomToolbar .= '<td width="5px" class="separator1">|</td>';
-            $bottomToolbar .= '<td align="right" width="20px">'.$goToTop.'</td>';
-            $bottomToolbar .= '</tr>';
-            $bottomToolbar .= '</table>';
-            $bottomToolbar .= '</div>';
-        } else {
-            //Show toolbar if templates or tools
-            if (
-                !empty($templates) ||
-                !empty($tools) ||
-                $this->params['bool_changeLinesToShow']
-            ) {
-                //Toolbar
-                $bottomToolbar .= '<div class="block_bottom" align="center" >';
-                $bottomToolbar .= '<table width="100%" border="0"><tr>';
-                $bottomToolbar .= '<td align="left" width="20px" nowrap>'.$loading.'</td>';
-                $bottomToolbar .= '<td align="center" width="15%" nowrap><b>&nbsp;</b></td>';
-                $bottomToolbar .= '<td align="center" width="15%" nowrap><b>&nbsp;</b></td>';
-                $bottomToolbar .= '<td width="10px" class="separator1">|</td>';
-                $bottomToolbar .= '<td align="center" width="15%" nowrap>'.$pageDropdownList.'</td>';
-                $bottomToolbar .= '<td width="10px" class="separator1">|</td>';
-                $bottomToolbar .= '<td align="center" width="15%" nowrap>'.$linesDropdownList.'</td>';
-                $bottomToolbar .= '<td width="10px" class="separator1">|</td>';
-                $bottomToolbar .= '<td width="210px"align="right">'.$tools.'</td>';
-                $bottomToolbar .= '<td width="5px" class="separator1">|</td>';
-                $bottomToolbar .= '<td align="right" nowrap>'.$templates.'</td>';
-                $bottomToolbar .= '<td width="5px" class="separator1">|</td>';
-                $bottomToolbar .= '<td align="right" width="20px">'.$goToTop.'</td>';
-                $bottomToolbar .= '</tr>';
-                $bottomToolbar .= '</table>';
-                $bottomToolbar .= '</div>';
-            }
-        }
-
-        //$this->start = $start;
-        //$this->end = $end;
-
-        return $bottomToolbar;
-    }
-
-    protected function _createSmallToolbar()
-    {
-        //Init
-        $toolbar = '';
-        $start = $end = 0;
-
-        //Lines to show
-        if (isset($_REQUEST['lines']) && !empty($_REQUEST['lines'])) {
-            $nbLines = $this->params['linesToShow'] = strip_tags($_REQUEST['lines']);
-        }
-
-        //Number of pages
-        $nb_pages = ceil($this->countResult / $this->params['linesToShow']);
-
-        if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
-            $start = strip_tags($_REQUEST['start']);
-        }
-        $end = $start + $this->params['linesToShow'];
-        if ($end > $this->countResult) {
-            $end = $this->countResult;
-        }
-
-        //Build dropdown lines object
-        $linesDropdownList = '';
-        if ($this->params['bool_changeLinesToShow']) {
-            $nbLinesSelect = array(
-                10,
-                25,
-                50,
-                100,
-                250,
-                500,
-            );
-            if (!in_array($this->params['linesToShow'], $nbLinesSelect)) {
-                array_push($nbLinesSelect, $this->params['linesToShow']);
-            }
-            sort($nbLinesSelect);
-
-            $linesDropdownList = '<form name="nbLinesToShow" method="get" >';
-            $linesDropdownList .= '<i class="fa fa-bars fa-2x" aria-hidden="true" title="'._SHOW.'"></i>
- <select name="nbLines" id="nbLines" onChange="loadList(\''.$this->link
-                                .'&order='.$this->order.'&order_field='
-                                .$this->orderField.'&lines=\' + document.nbLinesToShow.nbLines.value, \''
-                                .$this->divListId.'\', '.$this->modeReturn.');">';
-            //Array values
-            for ($i = 0; $i < count($nbLinesSelect); ++$i) {
-                if ($nbLinesSelect[$i] >= $this->countResult) {
-                    break;
-                }
-                ($nbLinesSelect[$i] == $nbLines) ? $selected = 'selected="selected" ' : $selected = '';
-                $linesDropdownList .= '<option value="'.$nbLinesSelect[$i].'" '.$selected.'>'.$nbLinesSelect[$i]._LINES.'</option>';
-            }
-            //Extra value
-            ($this->countResult == $nbLines || $this->countResult < $nbLines) ? $selected = 'selected="selected" ' : $selected = '';
-            $linesDropdownList .= '<option value="'.$this->countResult.'" '.$selected.'>'._ALL.'('.$this->countResult.')</option>';
-            $linesDropdownList .= '</select>';
-            //$linesDropdownList .= '<script>if(!$(\'nbLines_chosen\')){new c($(\'nbLines\'),{width: "auto"});}</script>';
-            $linesDropdownList .= '<script> $j("#nbLines").chosen({width: "auto"});</script>';
-            $linesDropdownList .= '</form>';
-        }
-
-        //If there are more than 1 page, pagination
-        if ($nb_pages > 1) {
-            //Build dropdown navigation object
-            $next_start = 0;
-            $pageDropdownList = ''
-                                .'<select name="startpage" id="startpage" class ="small" onChange="loadList(\''.$this->link
-                                .'&order='.$this->order.'&order_field='
-                                .$this->orderField.'&start=\' + document.'.$this->formId.'.startpage.value, \''
-                                .$this->divListId.'\', '.$this->modeReturn.');">';
-            $lastpage = 0;
-            for ($i = 0; $i != $nb_pages; ++$i) {
-                $the_line = $i + 1;
-                if ($start == $next_start) {
-                    $pageDropdownList .= '<option value="'.$next_start.'" selected="selected">'.($i + 1).'</option>';
-                } else {
-                    $pageDropdownList .= '<option value="'.$next_start.'">'.($i + 1).'</option>';
-                }
-
-                $next_start = $next_start + $this->params['linesToShow'];
-                $lastpage = $next_start;
-            }
-            $pageDropdownList .= '</select>';
-
-            $lastpage = $lastpage - $this->params['linesToShow'];
-            $previous = '&nbsp;';
-            $next = '';
-
-            //Previous
-            if ($start > 0) {
-                $start_prev = $start - $this->params['linesToShow'];
-                $previous .= '<a href="javascript://" alt="'._PREVIOUS.'" onClick="loadList(\''.$this->link.'&order='
-                    .$this->order.'&order_field='.$this->orderField.'&start='.$start_prev
-                    .'\', \''.$this->divListId.'\', '.$this->modeReturn
-                    .');"><i class="fa fa-backward" title="'._PREVIOUS.'"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;';
-            }
-
-            //Next
-            if ($start != $lastpage) {
-                $start_next = $start + $this->params['linesToShow'];
-                $next = ' <a href="javascript://" alt="'._NEXT.'" onClick="loadList(\''.$this->link.'&order='
-                    .$this->order.'&order_field='.$this->orderField.'&start='
-                    .$start_next.'\', \''.$this->divListId.'\', '.$this->modeReturn
-                    .');"><i class="fa fa-forward" title="'._NEXT.'"></i></a>';
-            }
-
-            //Loading image
-            $loading = '<div id="loading" style="display:none;">'
-                .'<i class="fa fa-spinner fa-2x" style="vertical-align: middle;" title="loading..."></i></div>';
-
-            //Small toolbar
-            $toolbar .= '<table width="100%" border="0" cellspacing="0" class="zero_padding"><tr>';
-            $toolbar .= '<td align="left" width="15px" nowrap>'.$loading.'</td>';
-            $toolbar .= '<td align="left" width="10px" nowrap><b>'.$previous.'</b></td>';
-            $toolbar .= '<td align="center" width="10px" nowrap><b>'.$next.'</b></td>';
-            $toolbar .= '<td width="1%" class="separator1">|</td>';
-            $toolbar .= '<td align="left" width="94%">'.$pageDropdownList.'</td>';
-            $toolbar .= '</tr></table>';
-        }
-
-        //$this->start = $start;
-        //$this->end = $end;
-
-        return $toolbar;
-    }
-
-    protected function _displayFilters()
-    {
-        $filters = $filtersControl = '';
-        if (isset($this->params['filters']) && count($this->params['filters']) > 0) {
-            $found = false;
-
-            for ($i = 0; $i < count($this->params['filters']); ++$i) {
-                if (isset($_SESSION['filters'][$this->params['filters'][$i]])) {
-                    $filtersControl .= $this->_buildFilter($this->params['filters'][$i]);
-                    $found = true;
-                }
-            }
-            if ($found) {
-                //Display filter
-                $filters .= '<div style="padding-bottom: 15px;"><form name="filters" id="filters" '
-                        .'onsubmit="return false;" action="#" method="post"><i class="fa fa-filter fa-2x" title="'._FILTER_BY.'" aria-hidden="true" style="position: relative;top: 3px;"></i>: ';
-                $filters .= $filtersControl;
-                //Clear icon
-                $filters .= '|&nbsp;&nbsp;<a href="javascript://"  title="'._CLEAR_SEARCH.'" onfocus="this.blur()" '
-                            .'onclick="javascript:loadList2(\''.$this->link
-                            .'&filter=reset\', \''.$this->divListId.'\', '
-                            .$this->modeReturn.');">'
-                            .'<i class="fa fa-sync fa-2x" style="position: relative;top: 6px;" title="'._CLEAR_SEARCH.'"></i></a>';
-                $filters .= '</form></div>';
-            } else {
-                $filters = _NO_CORRESPONDING_FILTERS;
-            }
-        }
-
-        return $filters;
-    }
-
-    protected function _createHiddenFields()
-    {
-        $hiddenFields = '';
-        //Action management hidden fields
-        if ($this->withForm) {
-            if (!empty($this->params['collId'])) {
-                $hiddenFields
-                .= '<input type="hidden" id="coll_id" name="coll_id" value="'.$this->params['collId'].'">';
-            }
-            if (!empty($this->params['moduleName'])) {
-                $hiddenFields
-                .= '<input type="hidden" id="module" name="module" value="'.$this->params['moduleName'].'">';
-            }
-            if (!empty($this->params['tableName'])) {
-                $hiddenFields
-                .= '<input type="hidden" id="table" name="table" value="'.$this->params['tableName'].'">';
-            }
-        }
-        //Regular hidden fields
-        if (isset($this->params['hiddenFormFields']) && count($this->params['hiddenFormFields']) > 0) {
-            for ($i = 0; $i < count($this->params['hiddenFormFields']); ++$i) {
-                $hiddenFields .= '<input type="hidden" id="'
-                    .$this->params['hiddenFormFields'][$i]['ID']
-                    .'" name="'.$this->params['hiddenFormFields'][$i]['NAME']
-                    .'" value="'.$this->params['hiddenFormFields'][$i]['VALUE'].'">';
-            }
-        }
-
-        return $hiddenFields;
-    }
-
-    protected function _displayAddButton()
-    {
-        $addButton = '';
-        //$addButton .= '<tr><td class="price" colspan="'.$this->countTd.'"><span class="add clearfix">';
-        $addButton .= '<tr><td class="price" colspan="'.$this->countTd.'">';
-        if (isset($this->params['addButtonScript']) && !empty($this->params['addButtonScript'])) { //Script
-            $addButtonScript = 'onClick="javascript:'.$this->params['addButtonScript'].'"';
-            $addButtonLink = 'javascript://';
-        } elseif (isset($this->params['addButtonLink']) && !empty($this->params['addButtonLink'])) { //Link
-            $addButtonScript = '';
-            $addButtonLink = $this->params['addButtonLink'];
-        } else { //Error
-            $addButtonLink = '#';
-            //ERROR RETURN
-        }
-        //$addButton .= '<a href="'.$addButtonLink.'" '.$addButtonScript.'><span>'.$this->params['addButtonLabel'].'</span></a></span>';
-        $addButton .= '<a href="'.$addButtonLink.'" '.$addButtonScript
-            .'><span><i class="fa fa-plus-square fa-3x" title="'.$this->params['addButtonLabel'].'"></i></span></a>';
-        $addButton .= '</td></tr>';
-
-        return $addButton;
-    }
-
-    protected function _createExtraJavascript()
-    {
-        $str .= '<script type="text/javascript">';
-        $str .= ' var arr_msg_error = {\'confirm_title\' : \''.addslashes(_ACTION_CONFIRM).'\',';
-        $str .= ' \'validate\' : \''.addslashes(_VALIDATE).'\',';
-        $str .= ' \'cancel\' : \''.addslashes(_CANCEL).'\',';
-        $str .= ' \'choose_action\' : \''.addslashes(_CHOOSE_ACTION).'\',';
-        $str .= ' \'choose_one_doc\' : \''.addslashes(_CHOOSE_ONE_DOC).'\',';
-        $str .= ' \'choose_one_folder\' : \''.addslashes(_CHOOSE_ONE_FOLDER).'\'';
-        $str .= ' };';
-        $str .= 'var validForm = function(mode, res_id, id_action) {';
-        $str .= 'if(!isAlreadyClick) {';
-        $str .= ' var val = \'\';';
-        $str .= ' var action_id = \'\';';
-        $str .= ' var table = \'\';';
-        $str .= ' var coll_id = \'\';';
-        $str .= ' var module = \'\';';
-        $str .= ' var thisfrm = document.getElementById(\''.$this->formId.'\');';
-        $str .= ' if(thisfrm) {';
-        $str .= ' for(var i=0; i < thisfrm.elements.length; i++) {';
-        $str .= ' if(thisfrm.elements[i].id == \'field\' && thisfrm.elements[i].checked == true) {';
-        $str .= ' val += thisfrm.elements[i].value+\',\';';
-        $str .= ' }';
-        $str .= ' else if(thisfrm.elements[i].id == \'action\') {';
-        $str .= ' action_id = thisfrm.elements[i].options[thisfrm.elements[i].selectedIndex].value;';
-        $str .= ' }';
-        $str .= ' else if(thisfrm.elements[i].id == \'table\') {';
-        $str .= ' table = thisfrm.elements[i].value;';
-        $str .= ' }';
-        $str .= ' else if(thisfrm.elements[i].id == \'coll_id\') {';
-        $str .= ' coll_id = thisfrm.elements[i].value;';
-        $str .= ' }';
-        $str .= ' else if(thisfrm.elements[i].id == \'module\') {';
-        $str .= ' module = thisfrm.elements[i].value;';
-        $str .= ' }';
-        $str .= ' }';
-        $str .= ' if(module == \'\') {';
-        $str .= ' module = \'null\';';
-        $str .= ' }';
-        $str .= ' val = val.substr(0, val.length -1);';
-        $str .= ' var val_frm = {\'values\' : val,  \'action_id\' : action_id, \'table\' : table, \'coll_id\' : coll_id, \'module\' : module};';
-        $str .= ' if(res_id && res_id != \'\') {';
-        $str .= ' val_frm[\'values\'] = res_id;';
-        $str .= ' }';
-        $str .= ' if(id_action && id_action != \'\') {';
-        $str .= ' val_frm[\'action_id\'] = id_action;';
-        $str .= ' }';
-        $str .= ' action_send_first_request(\''.$_SESSION['config']['businessappurl']
-                .'index.php?display=true&page=manage_action&module=core\', mode,  val_frm[\'action_id\'], '
-                .'val_frm[\'values\'], val_frm[\'table\'], val_frm[\'module\'], val_frm[\'coll_id\']);';
-        $str .= ' } else {';
-        $str .= ' alert(\'Validation form error\');';
-        $str .= ' }';
-        $str .= ' if (mode == \'mass\') {';
-        $str .= ' isAlreadyClick = false;';
-        $str .= ' } else {';
-        $str .= ' isAlreadyClick = true;';
-        $str .= ' }';
-        $str .= '}';
-        $str .= '}';
-        $str .= ' </script>';
-
-        return $str;
-    }
-
-    protected function _createActionsList($currentBasket)
-    {
-        if (count($currentBasket) > 0) {
-            //Default action
-            if (!empty($currentBasket['default_action'])) {
-                $this->params['bool_actionOnLineClick'] = true;
-                //Enable action management
-                $this->haveAction = true;
-                $this->params['defaultAction'] = $currentBasket['default_action'];
-            }
-
-            //Collection
-            if (!empty($currentBasket['coll_id'])) {
-                $this->params['collId'] = $currentBasket['coll_id'];
-            }
-            //Table name
-            if (!empty($currentBasket['table'])) {
-                $this->params['tableName'] = $currentBasket['table'];
-            }
-            //Lock list
-            if (!empty($currentBasket['lock_list'])) {
-                $this->params['disabledRules'] = $currentBasket['lock_list'];
-            }
-            //Basket clause
-            if (!empty($currentBasket['clause'])) {
-                $this->params['basketClause'] = $currentBasket['clause'];
-            }
-
-            //Actions list
-            if (count($currentBasket['actions']) > 0) {
-                $this->params['actions'] = array();
-                for ($i = 0; $i < count($currentBasket['actions']); ++$i) {
-                    if ($currentBasket['actions'][$i]['MASS_USE'] == 'Y') {
-                        array_push($this->params['actions'], array('ID' => $currentBasket['actions'][$i]['ID'],
-                        'LABEL' => $currentBasket['actions'][$i]['LABEL'], ));
-                    }
-                }
-            }
-        }
-
-        //If no action disable all form input
-        if ((!isset($this->params['actions']) || count($this->params['actions']) == 0)
-            && $this->params['bool_standaloneForm'] === false
-        ) {
-            $this->params['bool_checkBox'] = false;
-            $this->params['bool_radioButton'] = false;
-        } else {
-            //Display checkbox if both checkbox and radio type are disabled
-            if ($this->params['bool_checkBox'] === false
-                && $this->params['bool_radioButton'] === false
-                && $this->params['bool_standaloneForm'] === false
-            ) {
-                $this->params['bool_checkBox'] = true;
-            }
-
-            //Enable action management
-            $this->haveAction = true;
-        }
-    }
-
-    protected function _displayButtons()
-    {
-        $buttons = '';
-        if (isset($this->params['buttons']) && count($this->params['buttons']) > 0) {
-            for ($i = 0; $i < count($this->params['buttons']); ++$i) {
-                //Button type
-                if (isset($this->params['buttons'][$i]['TYPE'])) {
-                    $type = $this->params['buttons'][$i]['TYPE'];
-                } else {
-                    $type = 'button';
-                }
-                $buttons .= ' <input type="'
-                    .$type.'" name="'
-                    .$this->params['buttons'][$i]['ID'].'" id="'
-                    .$this->params['buttons'][$i]['ID'].'" value="'
-                    .$this->params['buttons'][$i]['LABEL'].'" onClick="'
-                    .$this->params['buttons'][$i]['ACTION'].'" class="button" />';
-            }
-        }
-
-        return $buttons;
-    }
-
-    protected function _displayActionsList()
-    {
-        $actionsList = '';
-        $actionsList .= ' <p align="center">';
-        if (!empty($this->params['actions']) && is_array($this->params['actions']) && count($this->params['actions']) > 0) {
-            $actionsList .= ' <b>'._ACTIONS.' :</b>';
-            $actionsList .= ' <select name="action" id="action">';
-            $actionsList .= ' <option value="">'._CHOOSE_ACTION.'</option>';
-            for ($i = 0; $i < count($this->params['actions']); ++$i) {
-                $actionsList .= ' <option value="'.$this->params['actions'][$i]['ID'].'">'
-                    .$this->params['actions'][$i]['LABEL'].'</option>';
-            }
-            $actionsList .= ' </select>';
-            $actionsList .= ' <input type="button" name="send" id="send_mass" value="'._VALIDATE
-                .'" onClick="validForm(\'mass\');window.location.href=\'#top\'" class="button" />';
-        }
-
-        $actionsList .= $this->_displayButtons();
-        $actionsList .= ' </p>';
-
-        return $actionsList;
-    }
-
-    protected function _createPreviewDiv()
-    {
-        $str_previsualise = '<div ';
-        $str_previsualise .= 'id="return_previsualise" ';
-        $str_previsualise .= 'style="';
-        $str_previsualise .= 'display: none; ';
-        $str_previsualise .= 'border-radius: 10px; ';
-        $str_previsualise .= 'box-shadow: 10px 10px 15px rgba(0, 0, 0, 0.4); ';
-        $str_previsualise .= 'padding: 10px; ';
-        $str_previsualise .= 'width: auto; ';
-        $str_previsualise .= 'height: auto; ';
-        $str_previsualise .= 'position: absolute; ';
-        $str_previsualise .= 'top: 0; ';
-        $str_previsualise .= 'left: 0; ';
-        $str_previsualise .= 'z-index: 999; ';
-        $str_previsualise .= 'background-color: rgba(255, 255, 255, 0.9); ';
-        $str_previsualise .= 'border: 3px solid #459ed1;';
-        $str_previsualise .= '" ';
-        $str_previsualise .= '>';
-        $str_previsualise .= '<input type="hidden" id="identifierDetailFrame" value="" />';
-        $str_previsualise .= '</div>';
-
-        return $str_previsualise;
-    }
-
-    protected function _buildPreviewContent($resultTheLine, $listKey, $jsonIdentifier = 'identifierDetailFrame')
-    {
-        $contentArray = array();
-
-        //Get the ListKey value
-        $keyValue = '';
-        for ($i = 0; $i <= count($resultTheLine); ++$i) {
-            if ($resultTheLine[$i]['column'] == $listKey) {
-                $keyValue = $resultTheLine[$i]['value'];
-                break;
-            }
-        }
-
-        foreach (array_keys($resultTheLine) as $column) { // for every column
-            $contentArray[$jsonIdentifier] = $keyValue;
-            $contentArray[$resultTheLine[$column]['column']] = $resultTheLine[$column]['value'];
-        }
-
-        /*
-        //If you want to use different key for action link
-        if (strpos($link, "@@") !== false) {
-
-                $key = "@@".$resultTheLine[$column]['column']."@@"; //build the alias
-                $val = $resultTheLine[$column]['value']; //get the real value
-                $link = str_replace($key, $val, $link); //replace alias by real value
-            }
-        }
-        */
-
-        return  json_encode($contentArray);
-    }
-
-    protected function _createActionIcon($actualLine, $actualButton, $listKey = '')
-    {
-        $icon = '';
-
-        if (isset($actualButton['type']) && $actualButton['type'] == 'preview') {
-            if (!isset($actualButton['content']) || empty($actualButton['content'])) {
-                $content = $this->_buildPreviewContent($actualLine, $listKey);
-            } else {
-                $content = $this->_buildMyLink($actualButton['content'], $actualLine);
-            }
-            // $icon .= $content;
-            $icon .= '<a href="javascript://"';
-            $icon .= ' onMouseOver="previsualiseAdminRead(event, '.htmlspecialchars($content).');" ';
-            $icon .= ' onMouseOut="$(\'identifierDetailFrame\').setValue(\'\'); '
-                    .'$(\'return_previsualise\').style.display=\'none\';" ';
-            $icon .= ' title="'.$actualButton['tooltip'].'"';
-        } else {
-            if (isset($actualButton['script']) && !empty($actualButton['script'])) {
-                $script = $this->_buildMyLink($actualButton['script'], $actualLine);
-                $icon .= '<a href="javascript://" ';
-
-                //If javascript alert box
-                if (isset($actualButton['alertText']) && !empty($actualButton['alertText'])) {
-                    $alertText = $this->_buildMyLink($actualButton['alertText'], $actualLine);
-                    $icon .= 'onClick="if(confirm(\''.addslashes($alertText).'\')){'.$script.';} else {return false;};" ';
-                } else {
-                    $icon .= 'onClick="'.$script.'" ';
-                }
-                if ($this->_checkTypeOfActionIcon($this->actionButtons, 'preview') === true) {
-                    $icon .= ' onMouseOver="$(\'identifierDetailFrame\').setValue(\'\'); '
-                        .'$(\'return_previsualise\').style.display=\'none\';" ';
-                }
-                $icon .= ' title="'.$actualButton['tooltip'].'"';
-            } else {
-                $href = $this->_buildMyLink($actualButton['href'], $actualLine, $listKey);
-                $icon .= '<a href="'.$href.'" title="'.$actualButton['tooltip'].'"';
-
-                //If javascript alert box
-                if (isset($actualButton['alertText']) && !empty($actualButton['alertText'])) {
-                    $alertText = $this->_buildMyLink($actualButton['alertText'], $actualLine);
-                    $icon .= ' onClick="return(confirm(\''.addslashes($alertText).'\'));" ';
-                    if ($this->_checkTypeOfActionIcon($this->actionButtons, 'preview') === true) {
-                        $icon .= ' onMouseOver="$(\'identifierDetailFrame\').setValue(\'\'); '
-                            .'$(\'return_previsualise\').style.display=\'none\';" ';
-                    }
-                }
-            }
-        }
-        //Style
-        $showLabel = true;
-        if (isset($actualButton['class'])) {
-            //$icon .= ' class="'.$actualButton['class'].'">';
-            $icon .= '>';
-            if ($actualButton['class'] == 'change') {
-                $icon .= '<i class="fa fa-edit fa-2x" title="'._MODIFY.'"></i>';
-                $showLabel = false;
-            } elseif ($actualButton['class'] == 'delete') {
-                $icon .= '<i class="fa fa-times fa-2x" title="'._DELETE.'"></i>';
-                $showLabel = false;
-            } elseif ($actualButton['class'] == 'suspend') {
-                $icon .= '<i class="fa fa-pause fa-2x" title="'._SUSPEND.'"></i>';
-                $showLabel = false;
-            } elseif ($actualButton['class'] == 'authorize') {
-                $icon .= '<i class="fa fa-check fa-2x" title="'._AUTHORIZE.'"></i>';
-                $showLabel = false;
-            } elseif ($actualButton['class'] == 'view') {
-                $icon .= '<i class="fa fa-eye fa-2x" title="'._VIEW.'"></i>';
-                $showLabel = false;
-            } elseif ($actualButton['class'] == 'use') {
-                $icon .= '<i class="fa fa-dot-circle fa-2x" title="'._USE.'"></i>';
-                $showLabel = false;
-            }
-        } else {
-            $icon .= '>';
-        }
-        //Image
-        if (isset($actualButton['icon'])) {
-            $icon .= '<i class="fa fa-'.$actualButton['icon'].' fa-2x" title="'.$actualButton['tooltip'].'"></i>';
-        }
-        //Label
-        if (isset($actualButton['label']) && $showLabel) {
-            $icon .= '&nbsp;'.$actualButton['label'];
-        }
-        $icon .= '</a>';
-
-        return $icon;
-    }
-
-    protected function _checkTypeOfActionIcon($actionButtons, $type)
-    {
-        $isThisType = false;
-        if (empty($actionButtons) || !is_array($actionButtons)) {
-            return false;
-        }
-        for ($button = 0; $button < count($actionButtons); ++$button) {
-            if ($actionButtons[$button]['type'] == $type) {
-                $isThisType = true;
-                break;
-            }
-        }
-
-        return $isThisType;
-    }
-
-    protected function _createContent($resultArray, $listColumn, $listKey)
-    {
-        $content = $lineCss = '';
-
-        $content .= '<tbody>';
-        
-        //Loop into the set of records
-        for ($theLine = 0; $theLine < $this->end; ++$theLine) {
-            //Init
-            $href = '';
-            $resultTheLine = array();
-
-            //Simplify some values
-            $resultTheLine = $resultArray[$theLine];
-
-            //Get the ListKey value
-            $keyValue = '';
-            for ($i = 0; $i <= count($resultTheLine); ++$i) {
-                if ($resultTheLine[$i]['column'] == $listKey) {
-                    $keyValue = $resultTheLine[$i]['value'];
-                    if ($listKey == 'res_id') {
-                        $resId = $keyValue;
-                    }
-                }
-            }
-
-            //Check if line is disable
-            $lineIsDisabled = $this->_checkDisabledRules($this->params['disabledRules'], $resultTheLine);
-
-            //Alternate css for each line
-            if ($lineCss == '') {
-                $lineCss = 'col';
-            } elseif ($lineCss == 'col') {
-                $lineCss = '';
-            }
-            if ($lineIsDisabled === true && $this->haveAction) {
-                $content .= '<tr class="disabled">';
-            } else {
-                $content .= '<tr class="'.$lineCss.'">';
-            }
-
-            //Show sublist toggle icon
-            if ($this->params['bool_showSublist'] && !empty($this->params['sublistUrl'])) {
-                if ($lineIsDisabled === true) {
-                    $content .= '<td width="1%"><div align="center"><i class="fa fa-minus fa-2x" style="vertical-align: middle;"></i></div></td>';
-                } else {
-                    $sublist = $this->_buildMyLink($this->params['sublistUrl'], $resultTheLine, $listKey);
-                    $content .= '<td width="1%"><div align="center"><a href="javascript://" onclick="loadValueInDiv(\''
-                            .$keyValue.'\',\''.$sublist.'\')" title="'._TOGGLE
-                            .'"><i class="fa fa-minus fa-2x" style="vertical-align: middle;"></i></a></div></td>';
-                }
-            }
-
-            //If disable or checkbox or radio button
-            if ($lineIsDisabled === true && ($this->params['bool_checkBox'] === true || $this->params['bool_radioButton'] === true)) {
-                $content .= '<td width="1%"><div align="center"><i class="fa fa-lock fa-2x" style="vertical-align: middle;" title="'._LOCKED.'"></i></div></td>';
-            } elseif ($this->params['bool_checkBox'] === true) {
-                $content .= '<td width="1%"><div align="center"><input type="checkbox" name="field[]" id="field" class="check" value="'
-                    .$keyValue.'" /></div></td>';
-            } elseif ($this->params['bool_radioButton'] === true) {
-                if ($_SESSION['stockCheckbox'] != null) {
-                    $key = in_array($keyValue, $_SESSION['stockCheckbox']);
-                    if ($key == true) {
-                        $content .= '<td width="1%"><div align="center"><input type="Checkbox" checked="yes" name="field[]" id="field" class="check" onclick="stockCheckbox(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=multiLink\','.$keyValue.');" value="'
-                    .$keyValue.'" /></div></td>';
-                    } else {
-                        $content .= '<td width="1%"><div align="center"><input type="Checkbox" name="field[]" id="field" class="check" onclick="stockCheckbox(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=multiLink\','.$keyValue.');" value="'
-                    .$keyValue.'" /></div></td>';
-                    }
-                } else {
-                    $content .= '<td width="1%"><div align="center"><input type="Checkbox" name="field[]" id="field" class="check" onclick="stockCheckbox(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=multiLink\','.$keyValue.');" value="'
-                    .$keyValue.'" /></div></td>';
-                }
-            }
-
-            //Show document icon
-            if ($this->params['bool_showIconDocument']) {
-                $href = $this->_buildMyLink($this->params['viewDocumentLink'], $resultTheLine, $listKey);
-                $content .= '<td width="1%"><div align="center"><a href="../../rest/resources/'.$resId.'/content" target="_blank" title="'
-                    ._VIEW_DOC.'"><i class="fa fa-download fa-2x"></i></a></div></td>';
-            }
-
-            //Show the rows (loop into columns)
-            for ($column = 0; $column < count($listColumn); ++$column) {
-                //If show column
-                if ($resultTheLine[$column]['show'] == true) {
-                    $class = '';
-
-                    //Column content
-                    $columnValue = $this->_highlightWords($resultTheLine[$column]['value'], $this->whatSearch);
-
-                    //CSS
-                    if (isset($resultTheLine[$column]['class']) &&
-                        !empty($resultTheLine[$column]['class'])
-                    ) {
-                        $class = 'class="'.$resultTheLine[$column]['class'].'"';
-                    }
-
-                    //Different background on ordered column
-                    isset($resultTheLine[$column]['order']) && is_string($resultTheLine[$column]['order']) && (strpos($this->orderField, $resultTheLine[$column]['order']) !== false) ?
-                        $columnStyle = ' style="background-image: url(static.php?filename=black_0.1.png);"' : $columnStyle = '';
-
-                    //If there is action on line click
-                    if ($this->params['bool_actionOnLineClick'] &&
-                        isset($this->params['defaultAction']) &&
-                        !empty($this->params['defaultAction']) &&
-                        $lineIsDisabled === false
-                    ) {
-                        $sAction = \Action\models\ActionModel::getActionPageById(['id' => $this->params['defaultAction']]);
-                        if ($sAction == 'visa_mail') {
-                            $content .= '<td'.$columnStyle.' onmouseover="this.style.cursor=\'pointer\';" '
-                                .'onClick="islockForSignatureBook(\''.$keyValue.'\', \''.$_SESSION['current_basket']['id'].'\', \''.$_SESSION['current_basket']['group_id'].'\');" width="'.$resultTheLine[$column]['size'].'%" '
-                                .$class.'><div align="'.$resultTheLine[$column]['align'].'">'
-                                .$columnValue.'</div></td>';
-                        } else {
-                            $content .= '<td'.$columnStyle.' onmouseover="this.style.cursor=\'pointer\';" '
-                                .'onClick="validForm( \'page\', \''.$keyValue.'\', \''
-                                .$this->params['defaultAction'].'\');" width="'.$resultTheLine[$column]['size'].'%" '
-                                .$class.'><div align="'.$resultTheLine[$column]['align'].'">'
-                                .$columnValue.'</div></td>';
-                        }
-                    } else {
-                        $content .= '<td'.$columnStyle.' width="'.$resultTheLine[$column]['size'].'%" '
-                            .$class.'><div align="'.$resultTheLine[$column]['align'].'">'
-                            .$columnValue.'</div></td>';
-                    }
-                }
-            }
-
-            //Show action buttons
-            if (!empty($this->actionButtons)) {
-                for ($button = 0; $button < count($this->actionButtons); ++$button) {
-                    $actionIsDisabled = $this->_checkDisabledRules($this->actionButtons[$button]['disabledRules'], $resultTheLine);
-                    if ($actionIsDisabled) {
-                        $content .= '<td width="1%">&nbsp;</td>';
-                    } else {
-                        $content .= '<td width="1%" nowrap><div style="font-size:10px;">';
-                        //Chceck type of action
-                        if (!isset($this->actionButtons[$button]['type']) or $this->actionButtons[$button]['type'] == 'standard') { //Standard icon
-                           $content .= $this->_createActionIcon($resultTheLine, $this->actionButtons[$button], $listKey);
-                        } elseif ($this->actionButtons[$button]['type'] == 'preview') { //View icon
-                            $content .= $this->_createActionIcon($resultTheLine, $this->actionButtons[$button], $listKey);
-                        } elseif ($this->actionButtons[$button]['type'] == 'switch') {  //Switch icon
-                            //Switch rules to be ON
-                            $switchIsOn = $this->_checkDisabledRules($this->actionButtons[$button]['switchRules'], $resultTheLine);
-    
-                            if (isset($this->actionButtons[$button]['on']) && $switchIsOn) { //Switch ON
-                                $content .= $this->_createActionIcon($resultTheLine, $this->actionButtons[$button]['on'], $listKey);
-                            } elseif (isset($this->actionButtons[$button]['off'])) { //Switch OFF
-                                $content .= $this->_createActionIcon($resultTheLine, $this->actionButtons[$button]['off'], $listKey);
-                            }
-                        }
-                        $content .= '</div></td>';
-                    }
-                }
-            }
-
-            //Show details button
-            if ($this->params['bool_showIconDetails']) {
-                $href = $this->_buildMyLink($this->params['viewDetailsLink'], $resultTheLine, $listKey);
-                $content .= '<td width="1%"><div align="center"><a href="javascript://" onClick="javascript:window.top.location=\''
-                    .$href.'\'; return false;" title="'._DETAILS.'"><i class="fa fa-info-circle fa-2x" title="'._DETAILS.'"></i></a></div></td>';
-            }
-
-            //End of line
-            $content .= '</tr>';
-
-            //Show sublist content (in another hidden line)
-            if ($this->params['bool_showSublist'] && !empty($this->params['sublistUrl'])) {
-                $content .= '<tr class="" id="subList_'.$keyValue.'" name="subList_'
-                    .$keyValue.'" style="display: none;"><td colspan="'
-                    .$this->countTd.'" style="background-color: white;"><div id="div_'
-                    .$keyValue.'" class="more_ressources"></div></td></tr>';
-            }
-        }
-        $content .= '</tbody>';
-
-        return  $content;
-    }
-
-    public function showList($resultArray, $parameters = array(), $listKey = '', $currentBasket = array())
-    {
-        //Put in different arrays: label, show, sort of columns
-        if (!empty($resultArray) && is_array($resultArray) && count($resultArray) > 0 && isset($resultArray[0])) {
-            $listColumn = array();
-            $showColumn = array();
-            $sortColumn = array();
-            for ($j = 0; $j < count($resultArray[0]); ++$j) {
-                array_push($listColumn, $resultArray[0][$j]['label']);
-                array_push($showColumn, $resultArray[0][$j]['show']);
-                array_push($sortColumn, $resultArray[0][$j]['order']);
-            }
-        }
-
-        //Default values
-        if (!isset($parameters['bool_showToolbar'])) {
-            $parameters['bool_showToolbar'] = true;
-        }
-        if (!isset($parameters['bool_bigPageTitle'])) {
-            $parameters['bool_bigPageTitle'] = true;
-        }
-        if (!isset($parameters['bool_checkBox'])) {
-            $parameters['bool_checkBox'] = false;
-        }
-        if (!isset($parameters['bool_radioButton'])) {
-            $parameters['bool_radioButton'] = false;
-        }
-        if (!isset($parameters['bool_showSublist'])) {
-            $parameters['bool_showSublist'] = false;
-        }
-        if (!isset($parameters['bool_showIconDocument'])) {
-            $parameters['bool_showIconDocument'] = false;
-        }
-        if (!isset($parameters['bool_sortColumn'])) {
-            $parameters['bool_sortColumn'] = true;
-        }
-        if (!isset($parameters['bool_showIconDetails'])) {
-            $parameters['bool_showIconDetails'] = false;
-        }
-        if (!isset($parameters['bool_showAddButton'])) {
-            $parameters['bool_showAddButton'] = false;
-        }
-        if (!isset($parameters['bool_actionOnLineClick'])) {
-            $parameters['bool_actionOnLineClick'] = false;
-        }
-        if (!isset($parameters['bool_pageInModule'])) {
-            $parameters['bool_pageInModule'] = true;
-        }
-        if (!isset($parameters['bool_showSearchTools'])) {
-            $parameters['bool_showSearchTools'] = false;
-        }
-        if (!isset($parameters['bool_showSearchBox'])) {
-            $parameters['bool_showSearchBox'] = true;
-        }
-        if (!isset($parameters['bool_showSmallToolbar'])) {
-            $parameters['bool_showSmallToolbar'] = false;
-        }
-        if (!isset($parameters['bool_showBottomToolbar'])) {
-            $parameters['bool_showBottomToolbar'] = true;
-        }
-        if (!isset($parameters['bool_showTemplateDefaultList'])) {
-            $parameters['bool_showTemplateDefaultList'] = false;
-        }
-        if (!isset($parameters['bool_standaloneForm'])) {
-            $parameters['bool_standaloneForm'] = false;
-        }
-        if (!isset($parameters['bool_modeReturn'])) {
-            $parameters['bool_modeReturn'] = true;
-        }
-        if (!isset($parameters['divListId'])) {
-            $parameters['divListId'] = 'divList';
-        }
-        if (!isset($parameters['searchBoxAutoCompletionParamName'])) {
-            $parameters['searchBoxAutoCompletionParamName'] = 'what';
-        }
-        if (!isset($parameters['searchBoxAutoCompletionMinChars'])) {
-            $parameters['searchBoxAutoCompletionMinChars'] = 1;
-        }
-        if (!isset($parameters['searchBoxAutoCompletionUpdate'])) {
-            $parameters['searchBoxAutoCompletionUpdate'] = false;
-        }
-        if (!isset($parameters['viewDocumentLink'])) {
-            $parameters['viewDocumentLink'] = $_SESSION['config']['businessappurl']
-            .'index.php?display=true&editingMode=true&dir=indexing_searching&page=view_resource_controler';
-        }
-        if (!isset($parameters['viewDetailsLink'])) {
-            $parameters['viewDetailsLink'] = $_SESSION['config']['businessappurl']
-            .'index.php?page=details&dir=indexing_searching';
-        }
-        if (!isset($parameters['bool_changeLinesToShow'])) {
-            $parameters['bool_changeLinesToShow'] = true;
-        }
-        if (!isset($parameters['linesToShow'])) {
-            $parameters['linesToShow'] = $_SESSION['config']['nblinetoshow'];
-        }
-        if (!isset($parameters['listCss']) || empty($parameters['listCss'])) {
-            $parameters['listCss'] = 'listing spec';
-        }
-        if (!isset($parameters['addButtonLabel']) || empty($parameters['addButtonLabel'])) {
-            $parameters['addButtonLabel'] = _ADD;
-        }
-        if (!isset($parameters['formId'])) {
-            $parameters['formId'] = 'formList';
-            $parameters['formName'] = 'formList';
-        } else {
-            $parameters['formName'] = $parameters['formId'];
-        }
-        if (!isset($parameters['formAction'])) {
-            $parameters['formAction'] = '#';
-        }
-        if (!isset($parameters['formMethod'])) {
-            $parameters['formMethod'] = 'POST';
-        }
-        if (!isset($parameters['formClass'])) {
-            $parameters['formClass'] = 'forms';
-        }
-        if (!isset($parameters['processInstructions'])) {
-            $parameters['processInstructions'] = _CLICK_LINE_TO_PROCESS;
-        }
-
-        //Reset
-        $grid = $gridContent = '';
-
-        //Init some global vars
-        $this->params = array();
-        $this->params = $parameters;
-        $this->actionButtons = array();
-        $this->actionButtons = $parameters['actionIcons'];
-        $this->divListId = $parameters['divListId'];
-        $this->modeReturn = ($parameters['bool_modeReturn'] === true) ? 'true' : 'false';
-        if (isset($parameters['height']) && !empty($parameters['height'])) {
-            $this->height = $parameters['height'];
-        }
-        $this->formId = $parameters['formId'];
-        $this->haveAction = false;
-
-        $this->countResult = 0;
-        if (!empty($resultArray) && is_array($resultArray)) {
-            $this->countResult = $_SESSION['save_list']['full_count'];
-            $this->start = $parameters['start'];
-            $this->end = count($resultArray);
-        }
-        if (count($currentBasket) > 0) {
-            $this->currentBasket = $currentBasket;
-        }
-        if ((isset($this->params['collId']) && !empty($this->params['collId']))) {
-            $this->collId = $this->params['collId'];
-        } elseif ((isset($currentBasket['coll_id']) && !empty($currentBasket['coll_id']))) {
-            $this->collId = $currentBasket['coll_id'];
-        }
-
-        //Selected template or default template
-        if (empty($this->template)) {
-            if (isset($this->params['defaultTemplate']) && !empty($this->params['defaultTemplate'])) {
-                $this->template = $this->params['defaultTemplate'];
-            }
-        }
-        //Action par defaut
-        if (isset($parameters['defaultAction']) && !empty($parameters['defaultAction'])) {
-            $this->params['bool_actionOnLineClick'] = true;
-            $this->haveAction = true;
-        }
-
-        //Standalone form
-        if ($parameters['bool_standaloneForm'] === true) {
-            $this->params['bool_actionOnLineClick'] = false;
-        }
-
-        //Page picto
-        if (isset($parameters['pagePicto'])) {
-            $picto_path = '<i class="fa fa-'.$parameters['pagePicto'].' fa-2x"></i> ';
-        }
-
-        //Top anchor
-        $grid .= '<div id="topOfTheList"></div>';
-
-        //Check ih there is a preview button before show preview div
-        if ($this->_checkTypeOfActionIcon($this->actionButtons, 'preview') === true) {
-            $grid .= $this->_createPreviewDiv();
-        }
-
-        //Page title
-        if (isset($parameters['pageTitle'])) {
-            if ($parameters['bool_bigPageTitle']) {
-                $grid .= '<h1>'.$picto_path.$parameters['pageTitle'].'</h1>';
-            } else {
-                $grid .= '<b>'.$picto_path.$parameters['pageTitle'].'</b><br />';
-            }
-        }
-
-        //Actions list
-        if (count($currentBasket) > 0) {
-            $this->_createActionsList($currentBasket);
-        }
-
-        //Build page link
-        $this->link = $this->_buildPageLink();
-        // $grid .=  'Link = '. $this->link.''; //debug
-
-        //Search tools
-        $grid .= $this->_displaySearchTools();
-
-        //Toolbar
-        if ($this->params['bool_showSmallToolbar'] === false) {
-            $grid .= $this->_createToolbar($resultArray[0]);
-        }
-
-        //Show bottom toolbar
-        if (
-            $this->params['bool_showSmallToolbar'] === false
-            && $this->params['bool_showBottomToolbar'] === true
-            && $this->params['linesToShow'] > $_SESSION['config']['nblinetoshow']
-            && (
-                $this->countResult > $this->params['linesToShow']
-                || $this->countResult > $_SESSION['config']['nblinetoshow']
-                )
-            ) {
-            $bottomToolbar = $this->_createBottomToolbar($resultArray[0]);
-        }
-
-        //If there some results
-
-        if ((!empty($resultArray) && is_array($resultArray) && count($resultArray) > 0) || $this->params['bool_showAddButton']) {
-            //Need a form?
-            $this->withForm = false;
-            if ($this->params['bool_checkBox'] === true || $this->params['bool_radioButton'] === true ||
-                (!empty($parameters['actions']) && is_array($parameters['actions']) && count($parameters['actions']) > 0) ||
-                (!empty($parameters['buttons']) && is_array($parameters['buttons']) && count($parameters['buttons']) > 0)
-                || !empty($this->params['defaultAction'])
-                ) {
-                //Need a form!
-                $this->withForm = true;
-                $B_form = $E_form = '';
-
-                //Extra javascript to handle form
-                $grid .= $this->_createExtraJavascript();
-
-                //Build form
-                $B_form .= '<form name="'.$parameters['formName'].'" id="'
-                        .$this->formId.'" action="'.$parameters['formAction'].'" method="'
-                        .$parameters['formMethod'].'" class="'.$parameters['formClass'].'">';
-                $B_form .= '<input type="hidden" value=""/>';
-
-                //Get hidden fields
-                $gridContent .= $this->_createHiddenFields();
-
-                //Actions (list or buttons)
-                $E_form .= $this->_displayActionsList();
-
-                //End form
-                $E_form .= '</form>';
-            }
-
-            //Height
-            $B_height = $E_height = '';
-            if (isset($parameters['listHeight']) && !empty($parameters['listHeight'])) {
-                $B_height .= '<div style="height:'.$parameters['listHeight'].';overflow-x: hidden;overflow-y: auto;"><div style="height:97%;">';
-                // $B_height .= '<div class="fixed-table-container"><div class="header-height"></div><div class="fixed-table-container-inner">';
-                $E_height .= '</div></div>';
-            }
-
-            //Template mode
-            if (!empty($this->template) && $this->template != 'none') {
-                //Build the grid from template
-                $gridContent .= $this->_buildTemplate($_SESSION['html_templates'][$this->template]['PATH'], $resultArray, $listKey, $parameters);
-                
-                //Build the list
-                $grid .= $B_form.$B_height.$gridContent.$E_height.$E_form;
-
-                //Normal mode
-            } else {
-                //Header
-                $gridContent .= $this->_createHeader($resultArray[0], $listColumn, $showColumn, $sortColumn);
-                
-                //Content
-                $gridContent .= $this->_createContent($resultArray, $listColumn, $listKey);
-
-                //Build the list
-                (!empty($this->params['listCss'])) ? $listCss = 'class="'.$this->params['listCss'].'"' : $listCss = '';
-                $grid .= $B_form.$B_height.'<table cellspacing="0" border="0" cellpadding="0" align="center" '
-                        .$listCss.' style="width:100%;">'.$gridContent.'</table>'.$E_height.$E_form.$bottomToolbar;
-            }
-
-            //Process instructions
-            if ($this->params['bool_actionOnLineClick'] === true) {
-                $grid .= '<em>'.$parameters['processInstructions'].'</em>';
-            }
-        } else {
-            $grid .= '<div style ="text-align: center;font-size: 16px;padding: 20px;font-weight: bold;opacity: 0.5;">'._NO_RESULTS.'</div>';
-        }
-        //Show the list
-        if ($this->params['bool_modeReturn'] === true) {
-            return $this->_parse($grid);
-        } else {
-            echo $this->_parse($grid);
-        }
-    }
-
-    protected function _parse($text)
-    {
-        //...
-        $text = str_replace("\r\n", "\n", $text);
-        $text = str_replace("\r", "\n", $text);
-
-        $text = str_replace("\n", '\\n ', $text);
-
-        return $text;
-    }
-
-    public function loadList($target, $showLoading = true, $divListId = 'divList', $returnMode = 'true', $init = 'true')
-    {
-        $list = "\n";
-        $loading = '';
-
-        //Reset filters
-        $this->_resetFilter();
-
-        //Reset html template list url
-        $this->_resetUrlTemplates();
-
-        //Create javascript load list function
-        $list .= '<script type="text/javascript">loadList(\''.$target.'&display=true\', \''.$divListId.'\', '.$returnMode.', '.$init.');</script>';
-
-        //Show loading image?
-        if ($showLoading === true) {
-            $loading = '<div style="padding:10px;justify-content: center;display: flex;align-items: center;font-size: 24px;font-weight: bold;opacity: 0.5;"><div class="lds-ring" style="position:initial;margin-top: 0;"><div></div><div></div><div></div><div></div></div><div>'._PROCESS_IN_PROGRESS.'</div></div>';
-        }
-
-        //Content div
-        $list .= '<div id="'.$divListId.'" name="'.$divListId.'">'.$loading.'</div>';
-
-        return $list;
-    }
-
-    public function loadList2($target, $showLoading = true, $divListId = 'divList', $returnMode = 'true', $init = 'true')
-    {
-        $list = "\n";
-        $loading = '';
-        //Reset filters
-        $this->_resetFilter2();
-
-        //Reset html template list url
-        $this->_resetUrlTemplates();
-
-        //Create javascript load list function
-        $list .= '<script type="text/javascript">loadList2(\''.$target.'&display=true\', \''.$divListId.'\', '.$returnMode.', '.$init.');</script>';
-
-        //Show loading image?
-        if ($showLoading === true) {
-            $loading = '<i class="fa fa-spinner fa-2x"></i>';
-        }
-
-        //Content div
-        $list .= '<div id="'.$divListId.'" name="'.$divListId.'">'.$loading.'</div>';
-
-        return $list;
-    }
-
-    public function debug($viewAll = true)
-    {
-        $debug .= '<br/><pre>';
-        $debug .= '<b>Request:</b><br />';
-        $debug .= print_r($_REQUEST, true);
-        $debug .= '<br/><b>Return mode:</b> '.$this->modeReturn;
-        $debug .= '<br/><b>Link:</b> '.$this->link.'<br/>';
-        $debug .= '<b>Have action:</b> '.$this->haveAction.'<br />';
-        $debug .= '<b>With form:</b> '.$this->withForm.'<br />';
-        $debug .= '<b>Selected template:</b> '.$this->template.'<br />';
-        $debug .= '<b>Parameters:</b><br />';
-        $debug .= print_r($this->params, true);
-        if ($viewAll) {
-            $debug .= '<br/><b>Current basket:</b><br />';
-            $debug .= print_r($this->currentBasket, true);
-            // $debug .='<br/><b>Lists:</b></br>';
-            // $debug .= print_r($_SESSION['lists'], true);
-            $debug .= '<br/><b>Filters:</b><br />';
-            $debug .= print_r($_SESSION['filters'], true);
-            $debug .= '<br/><b>Filter clause:</b> '.$this->getFilters().'<br />';
-            $debug .= '<b>Templates:</b><br />';
-            $debug .= print_r($_SESSION['html_templates'], true);
-        }
-        $debug .= '</pre>';
-        if ($this->params['bool_modeReturn']) {
-            //Fix some json line breaks issues
-            $debug = str_replace(chr(10), '', $debug);
-            $debug = str_replace(chr(13), '', $debug);
-
-            return $debug;
-        } else {
-            echo $debug;
-        }
-    }
-
-    public function getLink()
-    {
-        return $this->link;
-    }
-
-    public function getStart()
-    {
-        return $this->start;
-    }
-
-    public function getOrder()
-    {
-        return $this->order;
-    }
-
-    public function getOrderField()
-    {
-        return $this->orderField;
-    }
-
-    public function setOrder($order = 'desc')
-    {
-        $this->order = $order;
-    }
-
-    public function setOrderField($field)
-    {
-        $this->orderField = $field;
-    }
-
-    public function getWhatSearch()
-    {
-        return $this->whatSearch;
-    }
-
-    public function getFilters()
-    {
-        $filtersClause = '';
-        $filtersArray = array();
-
-        foreach ($_SESSION['filters'] as $key => $val) {
-            if (!empty($_SESSION['filters'][$key]['CLAUSE'])) {
-                array_push($filtersArray, $_SESSION['filters'][$key]['CLAUSE']);
-            }
-        }
-        if (count($filtersArray) > 0) {
-            $filtersClause .= '('.implode(' and ', $filtersArray).')';
-        } //Build
-
-        return $filtersClause;
-    }
-
-    public function getTemplate()
-    {
-        return $this->template;
-    }
-
-    public function setTemplate($template)
-    {
-        $this->template = $template;
-    }
-
-    public function setCollection($collId)
-    {
-        $this->collId = $collId;
-    }
-}
diff --git a/apps/maarch_entreprise/class/class_pdf.php b/apps/maarch_entreprise/class/class_pdf.php
deleted file mode 100755
index eb1fcb978ea..00000000000
--- a/apps/maarch_entreprise/class/class_pdf.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/*
-*
-*   Copyright 2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-*
-* @file     class_pdf.php
-* @date     $date$
-* @version  $Revision$
-*/
-
-require_once 'apps/'. $_SESSION['config']['app_id'] .'/class/class_pdf_Abstract.php';
-
-class PDF extends PDF_Abstract
-{
-    // custom
-}
diff --git a/apps/maarch_entreprise/class/class_pdf_Abstract.php b/apps/maarch_entreprise/class/class_pdf_Abstract.php
deleted file mode 100755
index 4f4442dd9ad..00000000000
--- a/apps/maarch_entreprise/class/class_pdf_Abstract.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-/*
-*
-*   Copyright 2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-*
-* @file     class_pdf.php
-* @date     $date$
-* @version  $Revision$
-*/
-
-define('FPDF_FONTPATH', 'apps/maarch_entreprise/tools/pdfb/fpdf_1_7/font/');
-require_once 'apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdf.php';
-require_once 'apps/maarch_entreprise/tools/pdfb/fpdf_1_7/fpdi.php';
-
-//class PDF extends PDFB
-abstract class PDF_Abstract extends FPDI
-{
-    //var $extgstates = array();
-    //$extgstates = array();
-    function TextWithRotation($x, $y, $txt, $txt_angle, $font_angle=0)
-    {
-        $txt=str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt)));
-        $font_angle+=90+$txt_angle;
-        $txt_angle*=M_PI/180;
-        $font_angle*=M_PI/180;
-        $txt_dx=cos($txt_angle);
-        $txt_dy=sin($txt_angle);
-        $font_dx=cos($font_angle);
-        $font_dy=sin($font_angle);
-        $s=sprintf('BT %.2f %.2f %.2f %.2f %.2f %.2f Tm (%s) Tj ET',
-                 $txt_dx, $txt_dy, $font_dx, $font_dy,
-                 $x*$this->k, ($this->h-$y)*$this->k, $txt);
-        if ($this->ColorFlag)
-            $s='q '.$this->TextColor.' '.$s.' Q';
-        $this->_out($s);
-    }
-    
-    // alpha: real value from 0 (transparent) to 1 (opaque)
-    // bm:    blend mode, one of the following:
-    //          Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn,
-    //          HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity
-    function SetAlpha($alpha, $bm='Normal')
-    {
-        $_SESSION['extgstates'] = array();
-        // set alpha for stroking (CA) and non-stroking (ca) operations
-        $gs = $this->AddExtGState(array('ca'=>$alpha, 'CA'=>$alpha, 'BM'=>'/'.$bm));
-        $this->SetExtGState($gs);
-    }
-
-    function AddExtGState($parms)
-    {
-        $n = count($_SESSION['extgstates'])+1;
-        $_SESSION['extgstates'][$n]['parms'] = $parms;
-        return $n;
-    }
-
-    function SetExtGState($gs)
-    {
-        $this->_out(sprintf('/GS%d gs', $gs));
-    }
-
-    function _enddoc()
-    {
-        if(!empty($_SESSION['extgstates']) && $this->PDFVersion<'1.4')
-            $this->PDFVersion='1.4';
-        parent::_enddoc();
-    }
-
-    function _putextgstates()
-    {
-        for ($i = 1; $i <= count($_SESSION['extgstates']); $i++)
-        {
-            $this->_newobj();
-            $_SESSION['extgstates'][$i]['n'] = $this->n;
-            $this->_out('<</Type /ExtGState');
-            foreach ($_SESSION['extgstates'][$i]['parms'] as $k=>$v)
-                $this->_out('/'.$k.' '.$v);
-            $this->_out('>>');
-            $this->_out('endobj');
-        }
-    }
-
-    function _putresourcedict()
-    {
-        parent::_putresourcedict();
-        $this->_out('/ExtGState <<');
-        foreach($_SESSION['extgstates'] as $k=>$extgstate)
-            $this->_out('/GS'.$k.' '.$extgstate['n'].' 0 R');
-        $this->_out('>>');
-    }
-
-    function _putresources()
-    {
-        $this->_putextgstates();
-        parent::_putresources();
-    }
-}
diff --git a/apps/maarch_entreprise/index.php b/apps/maarch_entreprise/index.php
index 29ecf654337..5674ca4e352 100755
--- a/apps/maarch_entreprise/index.php
+++ b/apps/maarch_entreprise/index.php
@@ -18,16 +18,6 @@ if (isset($_REQUEST['dir']) && !empty($_REQUEST['dir'])) {
     $_REQUEST['dir'] = str_replace("..", "", $_REQUEST['dir']);
 }
 
-//reset orders in previous basket list
-if (empty($_SESSION['current_basket'])) {
-    $_SESSION['save_list']['start'] = 0;
-    $_SESSION['save_list']['lines'] = "";
-    $_SESSION['save_list']['order'] = "";
-    $_SESSION['save_list']['order_field'] = "";
-    $_SESSION['save_list']['template'] = "";
-    $_SESSION['save_list']['full_count'] = 0;
-}
-
 // Useless ???
 if (isset($_GET['show'])) {
     $show = $_GET['show'];
@@ -255,9 +245,6 @@ if (!empty($_REQUEST['page']) && empty($_REQUEST['triggerAngular'])) {
 
     //FOOTER
     echo '<p id="footer">';
-    if (isset($_SESSION['config']['showfooter']) && $_SESSION['config']['showfooter'] == 'true') {
-        $core->load_footer();
-    }
     echo '</p>';
 
     $_SESSION['error'] = '';
@@ -266,7 +253,6 @@ if (!empty($_REQUEST['page']) && empty($_REQUEST['triggerAngular'])) {
     echo '</div>';
     echo '</div>';
     
-    $core->view_debug();
     echo '</body>';
     echo '</html>';
     exit();
diff --git a/apps/maarch_entreprise/lang/en.php b/apps/maarch_entreprise/lang/en.php
index df85343e351..eacf34b6662 100755
--- a/apps/maarch_entreprise/lang/en.php
+++ b/apps/maarch_entreprise/lang/en.php
@@ -3618,13 +3618,6 @@ if (!defined('_DOC_NOT_CLOSED')) {
     define('_DOC_NOT_CLOSED', 'This mail is not closed');
 }
 
-if (!defined('_SECURITY_MESSAGE')) {
-    define('_SECURITY_MESSAGE', 'Security message');
-}
-if (!defined('_SECURITY_MESSAGE_DETAILS')) {
-    define('_SECURITY_MESSAGE_DETAILS', 'XSS type resquest is not allowed');
-}
-
 if (!defined('_CHOOSE_ENTITY_SUBENTITIES')) {
     define('_CHOOSE_ENTITY_SUBENTITIES', 'Choose a department (+ sub-department(s))');
 }
diff --git a/apps/maarch_entreprise/lang/fr.php b/apps/maarch_entreprise/lang/fr.php
index ddef0aa3f2a..2559ef5bf3b 100755
--- a/apps/maarch_entreprise/lang/fr.php
+++ b/apps/maarch_entreprise/lang/fr.php
@@ -3645,13 +3645,6 @@ if (!defined('_DOC_NOT_CLOSED')) {
     define('_DOC_NOT_CLOSED', "Ce courrier n'est pas clôturé");
 }
 
-if (!defined('_SECURITY_MESSAGE')) {
-    define('_SECURITY_MESSAGE', 'Message de sécurité');
-}
-if (!defined('_SECURITY_MESSAGE_DETAILS')) {
-    define('_SECURITY_MESSAGE_DETAILS', 'Requête de type XSS non permise');
-}
-
 if (!defined('_CHOOSE_ENTITY_SUBENTITIES')) {
     define('_CHOOSE_ENTITY_SUBENTITIES', 'Choisissez une entité (+ sous-entité(s))');
 }
diff --git a/apps/maarch_entreprise/lang/nl.php b/apps/maarch_entreprise/lang/nl.php
index f7767cc3ae7..21f35966213 100755
--- a/apps/maarch_entreprise/lang/nl.php
+++ b/apps/maarch_entreprise/lang/nl.php
@@ -3472,12 +3472,6 @@ if (!defined('_CLOSE_MAIL_AND_INDEX_DESC')) {
 if (!defined('_DOC_NOT_CLOSED')) {
     define('_DOC_NOT_CLOSED', 'Deze brief is niet afgesloten');
 }
-if (!defined('_SECURITY_MESSAGE')) {
-    define('_SECURITY_MESSAGE', 'Veiligheidsboodschap');
-}
-if (!defined('_SECURITY_MESSAGE_DETAILS')) {
-    define('_SECURITY_MESSAGE_DETAILS', 'Verzoek van XSS type niet toegestaan');
-}
 if (!defined('_CHOOSE_ENTITY_SUBENTITIES')) {
     define('_CHOOSE_ENTITY_SUBENTITIES', 'Kies een eenheid (+ subeenhe(i)d(en))');
 }
diff --git a/apps/maarch_entreprise/security_message.php b/apps/maarch_entreprise/security_message.php
deleted file mode 100755
index c9e1a5ecd91..00000000000
--- a/apps/maarch_entreprise/security_message.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/*
-*   Copyright 2008-2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  security message page
-* 
-* @file
-* @author  Laurent Giovannoni  <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup apps
-*/
-
-$core_tools2 = new core_tools();
-/****************Management of the location bar  ************/
-$init = false;
-if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true")
-{
-    $init = true;
-}
-$level = "";
-if(isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1))
-{
-    $level = $_REQUEST['level'];
-}
-$page_path = $_SESSION['config']['businessappurl'].'index.php?page=security_message';
-$page_label = _SECURITY_MESSAGE;
-$page_id = "security_message";
-$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level);
-/***********************************************************/
-?>
-<h1>
-<?php echo _SECURITY_MESSAGE;?></h1>
-<div id="inner_content" class="clearfix">
-<?php
-echo '<h3>' . _SECURITY_MESSAGE_DETAILS . ' !</h3>';
-if ($_SESSION['config']['debug'] == 'true') {
-    echo $_SESSION['securityMessage'];
-}
-?>
-</div>
diff --git a/ci/php.ini b/ci/php.ini
index be424c66355..957324c162a 100755
--- a/ci/php.ini
+++ b/ci/php.ini
@@ -184,7 +184,7 @@ engine = On
 ; Development Value: Off
 ; Production Value: Off
 ; http://php.net/short-open-tag
-short_open_tag = On
+short_open_tag = Off
 
 ; The number of significant digits displayed in floating point numbers.
 ; http://php.net/precision
@@ -462,7 +462,7 @@ memory_limit = 256M
 ; Development Value: E_ALL
 ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
 ; http://php.net/error-reporting
-error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+error_reporting = E_ALL & ~E_NOTICE
 
 ; This directive controls whether or not and where PHP will output errors,
 ; notices and warnings too. Error output is very useful during development, but
diff --git a/core/admin_tools.php b/core/admin_tools.php
deleted file mode 100755
index 0b1a823401a..00000000000
--- a/core/admin_tools.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief API to manage admin 
-*
-* @file
-* @author Laurent Giovannoni
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-
-/**
- * Format given item with given values, according with HTML formating.
- * NOTE: given item needs to be an array with at least 2 keys: 
- * 'column' and 'value'.
- * NOTE: given item is modified consequently.  
- * @param $item
- * @param $label
- * @param $size
- * @param $label_align
- * @param $align
- * @param $valign
- * @param $show
- */
-function At_formatItem(
-    &$item, $label , $size , $labelAlign, $align, $valign, $show
-) {
-    $func = new functions();
-    $item['value'] = $func->show_string($item['value']);    
-    $item[$item['column']] = $item['value'];
-    $item["label"] = $label;
-    $item["size"] = $size;
-    $item["label_align"] = $labelAlign;
-    $item["align"] = $align;
-    $item["valign"] = $valign;
-    $item["show"] = $show;
-    $item["order"] = $item['column'];    
-}
-
-/**
- * Put given object in session, according with given type
- * NOTE: given object needs to be at least hashable
- * @param string $type
- * @param hashable $hashable
- */
-function At_putInSession($type, $hashable)
-{
-    $func = new functions();
-    foreach ($hashable as $key => $value) {
-        $_SESSION['m_admin'][$type][$key] = $func->show_string($value);
-    }
-}
-
-/**
- * Show the admin list of an Ajax request 
- * @param object $db database request object
- * @param string $whatRequest request string
- */
-function At_showAjaxList($stmt, $whatRequest)
-{
-    $listArray = array();
-    while ($line = $stmt->fetchObject()) {
-        array_push($listArray, $line->tag);
-    }
-    echo "<ul>\n";
-    $authViewList = 0;
-    $flagAuthView = false;
-    foreach ($listArray as $what) {
-        if (isset($authViewList) && $authViewList >= 10) {
-            $flagAuthView = true;
-        }
-        if (stripos($what, $whatRequest) === 0) {
-            echo "<li>" . functions::xssafe($what) . "</li>\n";
-            if ($flagAuthView) {
-                echo "<li>...</li>\n";
-                break;
-            }
-            $authViewList++;
-        }
-    }
-    echo "</ul>";
-}
-
diff --git a/core/class/Action.php b/core/class/Action.php
deleted file mode 100755
index 6a816c48f04..00000000000
--- a/core/class/Action.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/*
-*    Copyright 2008,2009,2010 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the Action Object (herits of the BaseObject class)
-*
-*
-* @file
-* @author Claire Figueras <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-// Loads the required class
-try {
-    require_once('core/class/BaseObject.php');
-} catch (Exception $e) {
-    functions::xecho($e->getMessage()) . ' // ';
-}
-
-/**
-* @brief  Action Object, herits of the BaseObject class
-*
-* @ingroup core
-*/
-class Action extends BaseObject
-{
-    /**
-    * Returns the string representing the Action object
-    *
-    * @return string The action label (label_action)
-    */
-    public function __toString()
-    {
-        return $this->label_action ;
-    }
-}
\ No newline at end of file
diff --git a/core/class/ActionControler.php b/core/class/ActionControler.php
deleted file mode 100755
index f600b262bd4..00000000000
--- a/core/class/ActionControler.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-
-/*
-*    Copyright 2008-2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of the Action Object (create, save, modify, etc...)
-*
-*
-* @file
-* @author Claire Figueras <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-// Loads the required class
-try {
-	require_once('core/class/class_db_pdo.php');
-	require_once('core/class/Action.php');
-	require_once('core/core_tables.php');
- // require_once('core/class/ObjectControlerIF.php');
-    require_once('core/class/ObjectControlerAbstract.php');
-    require_once('core/class/class_history.php');
-} catch (Exception $e) {
-	functions::xecho($e->getMessage()) . ' // ';
-}
-
-/**
-* @brief  Controler of the Action Object
-*
-*<ul>
-*  <li>Get an action object from an id</li>
-*  <li>Save in the database an action</li>
-*  <li>Manage the operation on the action related tables in the database (insert, select, update, delete)</li>
-*</ul>
-* @ingroup core
-*/
-class ActionControler
-{
-	/**
-	* Database object used to connnect to the database
-    */
-	private static $db;
-
-	/**
-	* Actions table
-    */
-	public static $actions_table ;
-	
-	/**
-	* Actions_groupbaskets_table table
-    */
-	public static $actions_groupbaskets_table ;
-
-	/**
-	* Opens a database connexion and values the tables variables
-	*/
-	public static function connect()
-	{
-		$db = new Database();
-		
-		self::$actions_table = $_SESSION['tablename']['actions'];
-		self::$actions_groupbaskets_table = $_SESSION['tablename']['bask_actions_groupbaskets'];
-
-		self::$db=$db;
-	}
-
-	/**
-	* Returns an Action array of Object based on all action
-	*
-	* @return Action array of objects with properties from the database or null
-	*/
-	public function getAllActions()
-	{
-		self::connect();
-		$query = "select * from ".self::$actions_table;
-
-		$stmt = self::$db->query($query);
-
-		if($stmt->rowCount() > 0)
-		{
-			$actions_list = array();
-			while($queryResult=$stmt->fetchObject()){
-				$action = new Action();
-				foreach($queryResult as $key => $value){
-					$action->{$key}=$value;
-				}
-				array_push($actions_list, $action);
-			}
-			return $actions_list;
-		}
-		else
-		{
-			return null;
-		}
-	}
-
-    /**
-	* Returns an Categories array of categories linked to an action
-	*
-	* @return categories array 
-	*/
-	public static function getAllCategoriesLinkedToAction($actionId)
-	{
-		self::connect();
-		$query = "select category_id from actions_categories where action_id = ?";
-
-		$stmt = self::$db->query($query, array($actionId));
-
-		if ($stmt->rowCount() > 0) {
-			$categories_list = array();
-			while($queryResult=$stmt->fetchObject()){
-				array_push($categories_list, $queryResult->category_id);
-			}
-			return $categories_list;
-		} else {
-			return null;
-		}
-	}
-
-}
diff --git a/core/class/ExportControler.php b/core/class/ExportControler.php
deleted file mode 100755
index 6513b20c2c1..00000000000
--- a/core/class/ExportControler.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-
-*
-* @brief   ExportControler
-*
-* @author  dev <dev@maarch.org>
-* @ingroup core
-*/
-require_once 'core/class/class_functions.php';
-require_once 'core/class/class_history.php';
-
-class ExportControler
-{
-    public $array_export = [];
-    public $pos = 0;
-
-    public function __construct()
-    {
-        $this->retrieve_datas();
-        $_SESSION['export']['filename'] = $this->make_csv();
-    }
-
-    private function retrieve_datas()
-    {
-        // Retrieve the query
-        $query = $this->make_query();
-
-        // Retrieve datas
-        $db = new Database();
-
-        $stmt = $db->query($query, $_SESSION['last_select_query_parameters']);
-
-        while ($line = $stmt->fetchObject()) {
-            $this->array_export[] = $line->res_id;
-        }
-    }
-
-    private function make_query()
-    {
-        // Retrieve the end of last select query on the list
-        $endLastQuery = substr(
-                $_SESSION['last_select_query'],
-                strpos(
-                    $_SESSION['last_select_query'],
-                    'FROM'
-                )
-            );
-
-        // Create template for the new query
-        $query_template = 'SELECT ';
-        $query_template .= 'res_id ';
-        $query_template .= $endLastQuery;
-
-        return $query_template;
-    }
-
-    private function make_csv()
-    {
-        $currentUser = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id']]);
-        $rawTemplate = \Resource\models\ExportTemplateModel::get(['select' => ['delimiter', 'data'], 'where' => ['user_id = ?', 'format = ?'], 'data' => [$currentUser['id'], 'csv']]);
-        if (!empty($rawTemplate[0])) {
-            $rawTemplate = $rawTemplate[0];
-            $data = json_decode($rawTemplate['data'], true);
-        } else {
-            $rawTemplate = ['delimiter' => ';'];
-            $data = [
-                ["value" => "res_id", "label" => "Identifiant GED", "isFunction" => false],
-                ["value" => "doc_date", "label" => "Date d'arrivée", "isFunction" => false],
-                ["value" => "getInitiatorEntity", "label" => "Entité initiatrice", "isFunction" => true],
-                ["value" => "getDestinationEntity", "label" => "Entité traitante", "isFunction" => true],
-                ["value" => "getAssignee", "label" => "Destinataire", "isFunction" => true],
-                ["value" => "subject", "label" => "Objet", "isFunction" => false],
-                ["value" => "type_label", "label" => "Type de courrier", "isFunction" => false],
-                ["value" => "getStatus", "label" => "Statut", "isFunction" => true],
-                ["value" => "getPriority", "label" => "Priorité", "isFunction" => true],
-                ["value" => "getCopies", "label" => "Utilisateurs / Entités en copie", "isFunction" => true],
-                ["value" => "getCategory", "label" => "Catégorie", "isFunction" => true],
-                ["value" => "getSenders", "label" => "Expéditeurs", "isFunction" => true],
-                ["value" => "getRecipients", "label" => "Destinataires", "isFunction" => true],
-                ["value" => "getSignatories", "label" => "Signataires", "isFunction" => true],
-                ["value" => "getSignatureDates", "label" => "Date de signature", "isFunction" => true],
-                ["value" => "getTags", "label" => "Mots clés", "isFunction" => true],
-            ];
-        }
-
-        $select           = ['res_view_letterbox.res_id'];
-        $tableFunction    = [];
-        $leftJoinFunction = [];
-        $csvHead          = [];
-        foreach ($data as $value) {
-            $csvHead[] = $value['label'];
-            if (empty($value['value'])) {
-                continue;
-            }
-            if ($value['isFunction']) {
-                if ($value['value'] == 'getStatus') {
-                    $select[] = 'status.label_status AS "status.label_status"';
-                    $tableFunction[] = 'status';
-                    $leftJoinFunction[] = 'res_view_letterbox.status = status.id';
-                } elseif ($value['value'] == 'getPriority') {
-                    $select[] = 'priorities.label AS "priorities.label"';
-                    $tableFunction[] = 'priorities';
-                    $leftJoinFunction[] = 'res_view_letterbox.priority = priorities.id';
-                } elseif ($value['value'] == 'getCategory') {
-                    $select[] = 'res_view_letterbox.category_id';
-                } elseif ($value['value'] == 'getInitiatorEntity') {
-                    $select[] = 'enone.short_label AS "enone.short_label"';
-                    $tableFunction[] = 'entities enone';
-                    $leftJoinFunction[] = 'res_view_letterbox.initiator = enone.entity_id';
-                } elseif ($value['value'] == 'getDestinationEntity') {
-                    $select[] = 'entwo.short_label AS "entwo.short_label"';
-                    $tableFunction[] = 'entities entwo';
-                    $leftJoinFunction[] = 'res_view_letterbox.destination = entwo.entity_id';
-                } elseif ($value['value'] == 'getDestinationEntityType') {
-                    $select[] = 'enthree.entity_type AS "enthree.entity_type"';
-                    $tableFunction[] = 'entities enthree';
-                    $leftJoinFunction[] = 'res_view_letterbox.destination = enthree.entity_id';
-                } elseif ($value['value'] == 'getTypist') {
-                    $select[] = 'res_view_letterbox.typist';
-                } elseif ($value['value'] == 'getAssignee') {
-                    $select[] = 'res_view_letterbox.dest_user';
-                }
-            } else {
-                $select[] = "res_view_letterbox.{$value['value']}";
-            }
-        }
-
-        $order = 'CASE res_view_letterbox.res_id ';
-        foreach ($this->array_export as $key => $resId) {
-            $order .= "WHEN {$resId} THEN {$key} ";
-        }
-        $order .= 'END';
-
-        $aChunkedResources = array_chunk($this->array_export, 10000);
-        $resources = [];
-        foreach ($aChunkedResources as $chunkedResource) {
-            $resourcesTmp = \Resource\models\ResourceListModel::getOnView([
-                'select'    => $select,
-                'table'     => $tableFunction,
-                'leftJoin'  => $leftJoinFunction,
-                'where'     => ['res_view_letterbox.res_id in (?)'],
-                'data'      => [$chunkedResource],
-                'orderBy'   => [$order]
-            ]);
-            $resources = array_merge($resources, $resourcesTmp);
-        }
-
-        $file = \Resource\controllers\ExportController::getCsv(['delimiter' => $rawTemplate['delimiter'], 'data' => $data, 'resources' => $resources, 'chunkedResIds' => $aChunkedResources]);
-
-        $csvName = $_SESSION['user']['UserId'].'-'.md5(date('Y-m-d H:i:s')).'.csv';
-        $pathToCsv = $_SESSION['config']['tmppath'].$csvName;
-        file_put_contents($pathToCsv, stream_get_contents($file));
-        fclose($file);
-
-        return $csvName;
-    }
-}
diff --git a/core/class/SecurityControler.php b/core/class/SecurityControler.php
index 87d19a0ff56..a5abaed06c7 100755
--- a/core/class/SecurityControler.php
+++ b/core/class/SecurityControler.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*    Copyright 2008-2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -87,36 +74,6 @@ class SecurityControler
         }
     }
 
-    /**
-    * Returns all security object for a given usergroup
-    *
-    * @param  $groupId string  Usergroup identifier
-    * @return Array of security objects or null
-    */
-    public function getAccessForGroup($groupId)
-    {
-        if (empty($groupId)) {
-            return null;
-        }
-        $db = new Database();
-        
-        $query = "select * from " . SECURITY_TABLE . " where group_id = ?";
-
-        $stmt = $db->query($query, array($groupId));
-
-        $security = array();
-        if ($stmt->rowCount() > 0) {
-            while ($queryResult = $stmt->fetchObject()) {
-                $access = new SecurityObj();
-                foreach ($queryResult as $key => $value) {
-                    $access->{$key} = $value;
-                }
-                array_push($security, $access);
-            }
-        }
-        return $security;
-    }
-
     /**
     * Saves in the database a security object
     *
@@ -132,7 +89,7 @@ class SecurityControler
 
         if ($mode == "up") {
             return $this->_update($security);
-        } else if ($mode == "add") {
+        } elseif ($mode == "add") {
             return $this->_insert($security);
         }
 
@@ -252,7 +209,7 @@ class SecurityControler
             }
         }
         return array(
-            'QUERY' => implode(",",$result), 
+            'QUERY' => implode(",", $result),
             'VALUES' => $arrayValues,
         );
     }
@@ -286,9 +243,12 @@ class SecurityControler
         );
     }
 
-    public function check_where_clause($collId, $whereClause,
-       $view, $userId)
-    {
+    public function check_where_clause(
+        $collId,
+        $whereClause,
+        $view,
+        $userId
+    ) {
         $res = array(
             'RESULT' => false,
             'TXT' => '',
@@ -365,11 +325,13 @@ class SecurityControler
                     if (class_exists($key)) {
                         $object = new $key;
                         if (method_exists(
-                            $object, 'process_where_clause'
+                            $object,
+                            'process_where_clause'
                         ) == true
                         ) {
                             $where = $object->process_where_clause(
-                                $where, $userId
+                                $where,
+                                $userId
                             );
                         }
                     }
@@ -409,100 +371,22 @@ class SecurityControler
         }
         if (preg_match('/@user/', $whereClause)) {
             $whereClause = str_replace(
-                "@user", "'" . trim($userId) . "'", $whereClause
+                "@user",
+                "'" . trim($userId) . "'",
+                $whereClause
             );
         }
         if (preg_match('/@email/', $whereClause)) {
             $user = \User\models\UserModel::getByLogin(['login' => $userId, 'select' => ['mail']]);
             $whereClause = str_replace(
-                "@email", "'" . trim($user['mail']) . "'", $whereClause
+                "@email",
+                "'" . trim($user['mail']) . "'",
+                $whereClause
             );
         }
         return $whereClause;
     }
 
-    /**
-    * Loads into session, the security parameters corresponding to the user
-    * groups.
-    *
-    * @param  $userId string User Identifier
-    */
-    public function load_security($userId)
-    {
-        $tab['collections'] = array();
-        $tab['security'] = array();
-        $func = new functions();
-
-        if ($userId == "superadmin") {
-            for ($i = 0; $i < count($_SESSION['collections']); $i ++) {
-                $tab['security'][$_SESSION['collections'][$i]['id']] = array();
-                $tab['security'][$_SESSION['collections'][$i]['id']]['DOC'] = array(
-                    'table'  => $_SESSION['collections'][$i]['table'],
-                    'label_coll' => $_SESSION['collections'][$i]['label'],
-                    'view'  => $_SESSION['collections'][$i]['view'],
-                    'where' => " (1=1) ",
-                );
-                array_push(
-                    $tab['collections'], $_SESSION['collections'][$i]['id']
-                );
-            }
-        } else {
-            $uc = new users_controler();
-            $groups = $uc->getGroups($userId);
-
-            $access = array();
-            for ($i = 0; $i < count($groups); $i ++) {
-                $tmp = $this->getAccessForGroup($groups[$i]['GROUP_ID']);
-                for ($j = 0; $j < count($tmp);$j ++) {
-                    array_push($access, $tmp[$j]);
-                }
-            }
-            for ($i = 0; $i < count($access); $i ++) {
-                // TO DO : vérifier les dates
-                $collId = $access[$i]->__get('coll_id');
-                $whereClause = $access[$i]->__get('where_clause');
-                $whereClause = $this->process_security_where_clause(
-                    $whereClause, $userId
-                );
-                $whereClause = str_replace('where', '', $whereClause);
-
-                $ind = $this->get_ind_collection($collId);
-
-                if (trim($whereClause) == "") {
-                    $where = "-1";
-                } else {
-                    $where = "( " . $func->show_string($whereClause) . " )";
-                }
-                if (! in_array($collId, $tab['collections'])) {
-                    $tab['security'][$collId] = array();
-
-                    $tab['security'][$collId]['DOC'] = array(
-                        'table'  => $_SESSION['collections'][$ind]['table'],
-                        'label_coll'  => $_SESSION['collections'][$ind]['label'],
-                        'view'  => $_SESSION['collections'][$ind]['view'],
-                        'where'  => $where,
-                    );
-                    array_push($tab['collections'], $collId);
-                } else {
-                    if (isset($tab['security'][$collId]['DOC'])
-                        && count($tab['security'][$collId]['DOC']) > 0
-                    ) {
-                        $tab['security'][ $collId]['DOC']['where'] .= " or "
-                            . $where;
-                    } else {
-                        $tab['security'][$collId]['DOC'] = array(
-                            'table'  => $_SESSION['collections'][$ind]['table'],
-                            'label_coll'  => $_SESSION['collections'][$ind]['label'],
-                            'view'  => $_SESSION['collections'][$ind]['view'],
-                            'where'  => $where,
-                        );
-                    }
-                }
-            }
-        }
-        return $tab;
-    }
-
     /**
     * Gets the indice of the collection in the  $_SESSION['collections'] array
     *
@@ -520,7 +404,6 @@ class SecurityControler
         return -1;
     }
 
-
     /**
     * Check the where clause syntax
     *
diff --git a/core/class/Service.php b/core/class/Service.php
index a94ec7c768e..c50196aa674 100755
--- a/core/class/Service.php
+++ b/core/class/Service.php
@@ -1,27 +1,14 @@
 <?php
 /*
-*    Copyright 2008,2009,2010 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
 * @brief  Contains the Service Object (herits of the BaseObject class)
-* 
-* 
+*
+*
 * @file
 * @author Claire Figueras <dev@maarch.org>
 * @date $date$
@@ -31,25 +18,25 @@
 
 // Loads the required class
 try {
-	require_once("core/class/BaseObject.php");
-} catch (Exception $e){
-	echo functions::xssafe($e->getMessage()).' // ';
+    require_once("core/class/BaseObject.php");
+} catch (Exception $e) {
+    echo functions::xssafe($e->getMessage()).' // ';
 }
 
 /**
-* @brief  Service Object, herits of the BaseObject class 
+* @brief  Service Object, herits of the BaseObject class
 *
 * @ingroup core
 */
 class Service extends BaseObject
 {
-	/**
-	* Returns the string representing the Service object
-	*
-	* @return string The service label (name)
-	*/
-	public function __toString(){
-		return $this->name ; 
-	}
+    /**
+    * Returns the string representing the Service object
+    *
+    * @return string The service label (name)
+    */
+    public function __toString()
+    {
+        return $this->name ;
+    }
 }
-?>
diff --git a/core/class/ServiceControler.php b/core/class/ServiceControler.php
deleted file mode 100755
index f963cc22968..00000000000
--- a/core/class/ServiceControler.php
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-/*
-*    Copyright 2008,2009,2010 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of the Service Object
-*
-*
-* @file
-* @author Claire Figueras <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-
-// To activate de debug mode of the class
-use Group\controllers\PrivilegeController;
-
-$_ENV['DEBUG'] = false;
-/*
-define("_CODE_SEPARATOR","/");
-define("_CODE_INCREMENT",1);
-*/
-
-// Loads the required class
-try {
-	require_once("core/class/Service.php");
-	require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."usergroups_controler.php");
-	require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."users_controler.php");
-	require_once 'core/core_tables.php';
-} catch (Exception $e){
-	echo functions::xssafe($e->getMessage()).' // ';
-}
-
-/**
-* @brief  Controler of the Service Object
-*
-* @ingroup core
-*/
-class ServiceControler
-{
-	/**
-	* Database object used to connnect to the database
-    */
-	private static $db;
-
-	/**
-	* usergroups_services table
-    */
-	private static $usergroups_services_table;
-
-
-	/**
-	* Opens a database connexion and values the tables variables
-	*/
-	public function connect()
-	{
-		$db = new Database();
-
-		self::$usergroups_services_table = USERGROUPS_SERVICES_TABLE;
-		self::$db=$db;
-	}
-
-	public function loadEnabledServices()
-	{
-		$_SESSION['enabled_services'] = array();
-		if (!empty($_SESSION['app_services'])) {
-			for ($i = 0; $i < count($_SESSION['app_services']); $i++) {
-				if ($_SESSION['app_services'][$i]['enabled'] == "true") {
-					array_push($_SESSION['enabled_services'], array('id' => $_SESSION['app_services'][$i]['id'], 'label' => $_SESSION['app_services'][$i]['name'], 'comment' => $_SESSION['app_services'][$i]['comment'], 'type' => $_SESSION['app_services'][$i]['servicetype'], 'parent' => 'application', 'system' => $_SESSION['app_services'][$i]['system_service']));
-				}
-			}
-		}
-		if (!empty($_SESSION["modules_services"])) {
-			foreach (array_keys($_SESSION['modules_services']) as $value) {
-				for ($i = 0; $i < count($_SESSION['modules_services'][$value]); $i++) {
-					if ($_SESSION['modules_services'][$value][$i]['enabled'] == "true") {
-						array_push($_SESSION['enabled_services'], array('id' => $_SESSION['modules_services'][$value][$i]['id'], 'label' => $_SESSION['modules_services'][$value][$i]['name'], 'comment' => $_SESSION['modules_services'][$value][$i]['comment'], 'type' => $_SESSION['modules_services'][$value][$i]['servicetype'], 'parent' => $value, 'system' => $_SESSION['modules_services'][$value][$i]['system_service']));
-					}
-				}
-			}
-		}
-	}
-
-	/**
-	* Loads into session all the services for a user
-	*
-	* @param  $user_id  string User identifier
-	* @param  $include_system  bool If true include the system services, false otherwise (true by default)
-	*/
-	public function loadUserServices($user_id)
-	{
-		$services = array();
-		
-		// #TODO : Au lieu de partir des services, partir plutot des groupes de l'utilisateur et r�cuperer tous les services 
-		// associés aux groupes
-		if($user_id == "superadmin")
-		{
-//			$services = self::getAllServices();
-			return ['adv_search_mlb' => true];
-		}
-		/*else
-		{
-			$tmpServices = array();
-			for ($i = 0; $i < count($_SESSION['enabled_services']); $i ++) {
-				if ($_SESSION['enabled_services'][$i]['system'] == true ) {
-					$services[$_SESSION['enabled_services'][$i]['id']] = true;
-				} else {
-					$tmpServices[] = $_SESSION['enabled_services'][$i]['id'];
-				}
-			}
-			$ugc = new usergroups_controler();
-			self::connect();
-			$userUse = \User\models\UserModel::getByLogin(['login' => $user_id, 'select' => ['id']]);
-			$stmt = self::$db->query(
-				'select distinct us.service_id from ' . USERGROUPS_SERVICES_TABLE
-				. ' us, usergroup_content uc, usergroups where us.group_id = usergroups.group_id and usergroups.id = uc.group_id and uc.user_id = ?',
-				array($userUse['id'])
-			);
-			
-			while($res = $stmt->fetchObject()) {
-				$serviceId = $res->service_id;
-				if (in_array($serviceId, $tmpServices)) {
-					$services[$serviceId] = true;
-				} else {
-					$services[$serviceId] = false;
-				}
-			}
-		}*/
-
-		$services = ['adv_search_mlb' => false];
-		$userUse = \User\models\UserModel::getByLogin(['login' => $user_id, 'select' => ['id']]);
-
-		if (PrivilegeController::hasPrivilege(['privilegeId' => 'adv_search_mlb', 'userId' => $userUse['id']])) {
-			$services['adv_search_mlb'] = true;
-		}
-
-		return $services;
-	}
-
-		/**
-	* Loads into session all the services for the superadmin
-	*
-	*/
-	private function getAllServices()
-	{
-		$services = array();
-		for($i=0; $i< count($_SESSION['enabled_services']);$i++)
-		{
-				$services[$_SESSION['enabled_services'][$i]['id']] = true;
-		}
-		return $services;
-	}
-}
-?>
diff --git a/core/class/Status.php b/core/class/Status.php
deleted file mode 100755
index 512b898f489..00000000000
--- a/core/class/Status.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/*
-*    Copyright 2008-2011 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the Status Object (herits of the BaseObject class)
-*
-*
-* @file
-* @author Claire Figueras <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-// Loads the required class
-try {
-    require_once('core/class/BaseObject.php');
-} catch (Exception $e){
-    echo functions::xssafe($e->getMessage()).' // ';
-}
-
-/**
-* @brief  Status Object, herits of the BaseObject class
-*
-* @ingroup core
-*/
-class Status extends BaseObject
-{
-    /**
-	* Returns the string representing the Status object
-	*
-	* @return string The status label (label_status)
-	*/
-    public function __toString()
-    {
-        return $this->label_status;
-    }
-}
diff --git a/core/class/StatusControler.php b/core/class/StatusControler.php
deleted file mode 100755
index ea5b9109c29..00000000000
--- a/core/class/StatusControler.php
+++ /dev/null
@@ -1,405 +0,0 @@
-<?php
-/*
-*    Copyright 2008-2011 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of the Status Object (create, save, modify)
-*
-*
-* @file
-* @author Claire Figueras <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-// Loads the required class
-try {
-    require_once 'core/class/class_db.php';
-    require_once 'core/core_tables.php';
-    require_once 'core/class/Status.php';
-    require_once 'core/class/ObjectControlerAbstract.php';
-    // require_once 'core/class/ObjectControlerIF.php';
-    require_once 'core/class/class_history.php';
-} catch (Exception $e){
-    echo functions::xssafe($e->getMessage()).' // ';
-}
-
-/**
-* @brief  Controler of the Status Object
-*
-*<ul>
-*  <li>Get an status object from an id</li>
-*  <li>Save in the database a status</li>
-*  <li>Manage the operation on the status related tables in the database
-*  (insert, select, update, delete)</li>
-*</ul>
-* @ingroup core
-*/
-class Maarch_Core_Class_StatusControler
-    extends ObjectControler
-   // implements ObjectControlerIF
-{
-
-    /**
-    * Return an Status Object based on a status identifier
-    *
-    * @param  $status_id string  Status identifier
-    * @return Status object with properties
-    *     from the database or null
-    */
-    public function get($status_id)
-    {
-        if (empty($status_id)) {
-            return null;
-        }
-
-        self::set_foolish_ids(array('id'));
-        self::set_specific_id('id');
-        $status = self::advanced_get($status_id, STATUS_TABLE);
-
-        if (isset($status)) {
-            return $status;
-        } else {
-            return null;
-        }
-    }
-
-    /**
-    * Saves in the database a Status object
-    *
-    * @param  $status Status object to be saved
-    * @param  $mode string  Saving mode : add or up
-    * @param  $params More parameters,
-    *             array('modules_services' => $_SESSION['modules_services']
-    *                                         type array,
-    *                 'log_status_up'    => 'true' / 'false':
-    *                                         log status modification ,
-    *                 'log_status_add'   => 'true' / 'false': log status
-    *                                          addition,
-    *                 'databasetype'     => Type of the database
-    *                 )
-    * @return array (  'status' => 'ok' / 'ko',
-    *                  'value'  => User identifier or empty in case of error,
-    *                  'error'  => Error message, defined only in case of error
-    *               )
-    */
-    public function save($status, $mode, $params)
-    {
-        $control = array();
-        // If status not defined or empty, return an error
-        if (!isset($status) || empty($status)) {
-            $control = array('status' => 'ko',
-                             'value'  => '',
-                             'error'  => _STATUS_EMPTY
-                       );
-            return $control;
-        }
-
-        // If mode not up or add, return an error
-        if (!isset($mode) || empty($mode)
-            || ($mode <> 'add' && $mode <> 'up' )) {
-            $control = array('status' => 'ko',
-                             'value'  => '',
-                             'error'  => _MODE . ' ' ._UNKNOWN
-                        );
-            return $control;
-        }
-
-        $status = self::isAStatus($status);
-        self::set_foolish_ids(array('id'));
-        self::set_specific_id('id');
-
-        // Data checks
-        $control = self::control($status, $mode, $params);
-
-        if ($control['status'] == 'ok') {
-            $core = new core_tools();
-            $_SESSION['service_tag'] = 'status_' . $mode;
-            $core->execute_modules_services(
-                $params['modules_services'], 'status_add_db', 'include'
-            );
-
-            if ($mode == 'up') {
-                //Update existing status
-                if (self::update($status)) {
-                    $control = array('status' => 'ok',
-                                     'value'  => $status->id
-                               );
-                    //log
-                    if ($params['log_status_up'] == 'true') {
-                        $history = new history();
-                        $history->add(
-                            STATUS_TABLE, $status->id, 'UP', 'statusup',
-                            _STATUS_MODIFIED . ' : ' . $status->id,
-                            $params['databasetype']
-                        );
-                    }
-                } else {
-                    $control = array('status' => 'ko',
-                                     'value'  => '',
-                                     'error'  => _PB_WITH_STATUS_UPDATE
-                                );
-                }
-            } else { //mode == add
-                if (self::insert($status)) {
-                    $control = array('status' => 'ok',
-                                     'value'  => $status->id);
-                    //log
-                    if ($params['log_status_add'] == 'true') {
-                        $history = new history();
-                        $history->add(
-                            STATUS_TABLE, $status->id, 'ADD', 'statusadd',
-                            _STATUS_ADDED . ' : ' . $status->id,
-                            $params['databasetype']
-                        );
-                    }
-                } else {
-                    $control = array('status' => 'ko',
-                                     'value'  => '',
-                                     'error'  => _PB_WITH_STATUS
-                                );
-                }
-            }
-        }
-        unset($_SESSION['service_tag']);
-        return $control;
-    }
-
-    /**
-    * Fill a Status object with an object if it's not a Status
-    *
-    * @param  $object ws Status object
-    * @return object Status
-    */
-    private function isAStatus($object)
-    {
-        if (get_class($object) <> 'Status') {
-            $func = new functions();
-            $statusObject = new Status();
-            $array = array();
-            $array = $func->object2array($object);
-            foreach (array_keys($array) as $key) {
-                $statusObject->{$key} = $array[$key];
-            }
-            return $statusObject;
-        } else {
-            return $object;
-        }
-    }
-
-    /**
-    * Control the data of Status object
-    *
-    * @param  $status Status object
-    * @param  $mode Mode (add or up)
-    * @param  $params More parameters,
-    *                 array('modules_services' => $_SESSION['modules_services']
-    *                                               type array,
-    *                     'log_status_up'      => 'true' / 'false': log status
-    *                                               modification,
-    *                     'log_status_add'     => 'true' / 'false': log status
-    *                                               addition,
-    *                     'databasetype'       => Type of the database
-    *                )
-    * @return array (  'status' => 'ok' / 'ko',
-    *                  'value'  => Status identifier or empty in case of error,
-    *                  'error'  => Error message, defined only in case of error
-    *                  )
-    */
-    private function control($status, $mode, $params=array())
-    {
-        $error = "";
-        $f = new functions();
-        $status->id = $f->wash($status->id, 'no', _THE_ID . ' ', 'yes', 0, 10);
-
-        if ($mode == 'add') {
-            if (self::statusExists($status->id)) {
-                $error .= _STATUS . ' ' . _ALREADY_EXISTS . '#';
-            }
-        }
-
-        $status->label_status =  $f->wash($status->label_status, 'no', _DESC, 'yes', 0, 50);
-
-        $status->is_system =  $f->wash($status->is_system, 'no', _IS_SYSTEM);
-        
-        $status->img_filename = $status->img_filename;
-        $status->maarch_module = 'apps';
-
-        if (!isset($status->can_be_searched)
-            || ($status->can_be_searched != 'Y'
-                && $status->can_be_searched != 'N')) {
-          $status->can_be_searched = 'Y';
-        }
-
-        if (!isset($status->can_be_modified)
-            || ($status->can_be_modified != 'Y'
-                && $status->can_be_modified != 'N')) {
-          $status->can_be_modified = 'Y';
-        }
-
-        $_SESSION['service_tag'] = 'status_check';
-        $core = new core_tools();
-        $core->execute_modules_services(
-            $params['modules_services'], 'status_check', 'include'
-        );
-
-        $error .= $_SESSION['error'];
-        //TODO:rewrite wash to return errors without html and not in the session
-        $error = str_replace("<br />", "#", $error);
-        $return = array();
-        if (!empty($error)) {
-                $return = array('status' => 'ko',
-                                'value'  => $status->id,
-                                'error'  => $error
-                          );
-        } else {
-            $return = array('status' => 'ok',
-                            'value'  => $status->id
-                      );
-        }
-        unset($_SESSION['service_tag']);
-        return $return;
-    }
-
-    /**
-    * Inserts in the database (status table) a Status object
-    *
-    * @param  $status Status object
-    * @return bool true if the insertion is complete, false otherwise
-    */
-    private function insert($status)
-    {
-        return self::advanced_insert($status);
-    }
-
-    /**
-    * Updates a status in the database (status table) with a Status object
-    *
-    * @param  $status Status object
-    * @return bool true if the update is complete, false otherwise
-    */
-    private function update($status)
-    {
-       return self::advanced_update($status);
-    }
-
-    /**
-    * Deletes in the database (status table) a given status (status_id)
-    *
-    * @param  $status_id string  Status identifier
-    * @return bool true if the deletion is complete, false otherwise
-    */
-    public function delete($status, $params = array())
-    {
-        $control = array();
-        if (!isset($status) || empty($status)) {
-            $control = array('status' => 'ko',
-                             'value'  => '',
-                             'error'  => _STATUS_EMPTY
-                       );
-            return $control;
-        }
-        $status = self::isAStatus($status);
-        if (!self::statusExists($status->id)) {
-            $control = array('status' => 'ko',
-                             'value'  => '',
-                             'error'  => _STATUS_NOT_EXISTS
-                       );
-            return $control;
-        }
-
-        self::set_foolish_ids(array('id'));
-        self::set_specific_id('id');
-        if (self::advanced_delete($status) == true) {
-            if (isset($params['log_status_del'])
-                && ($params['log_status_del'] == "true"
-                    || $params['log_status_del'] == true)) {
-                $history = new history();
-                $history->add(
-                    STATUS_TABLE, $status->id, 'DEL', 'statusdel',
-					_STATUS_DELETED . ' : '
-                    . $status->id, $params['databasetype']
-                );
-            }
-            $control = array('status' => 'ok',
-                             'value'  => $status->id
-                      );
-        } else {
-            $control = array('status' => 'ko',
-                             'value'  => $status->id,
-                             'error'  => $error
-                          );
-        }
-        return $control;
-    }
-
-
-    /**
-    * Asserts if a given status (status_id) exists in the database
-    *
-    * @param  $status_id String Status identifier
-    * @return bool true if the status exists, false otherwise
-    */
-    public function statusExists($status_id)
-    {
-        if (!isset($status_id) || empty($status_id)) {
-            return false;
-        }
-
-        self::$db = new Database();
-
-        $func = new functions();
-        $query = 'select id from ' . STATUS_TABLE . " where id = ?";
-
-        $stmt = self::$db->query($query, array($status_id));
-
-        if ($stmt->rowCount() > 0) {
-            return true;
-        }
-
-        return false;
-    }
-    
-    /**
-    * Return all status infos
-    * @return array of stauts
-    */
-    public function getAllInfos() {
-        $db = new Database();
-        $query = "select * from " . STATUS_TABLE . " order by label_status";
-        try {
-            $stmt = $db->query($query);
-        } catch (Exception $e) {
-            echo _NO_STATUS . ' // ';
-        }
-        if ($stmt->rowCount() > 0) {
-            $result = array ();
-            $cptId = 0;
-            while ($queryResult = $stmt->fetchObject()) {
-                $result[$cptId]['id'] = $queryResult->id;
-                $result[$cptId]['label'] = $queryResult->label_status;
-                $cptId++;
-            }
-            return $result;
-        } else {
-            return null;
-        }
-    }
-}
diff --git a/core/class/class_core_tools.php b/core/class/class_core_tools.php
index 10f45ad0089..13b1ca02c99 100755
--- a/core/class/class_core_tools.php
+++ b/core/class/class_core_tools.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*   Copyright 2008-2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /****************************************************************************/
@@ -218,46 +205,6 @@ class core_tools extends functions
         return $found;
     }
 
-    /**
-     * Loads the modules specific vars into session.
-     *
-     * @param $modules Enabled modules of the application
-     */
-    public function load_var_session($modules, $userData)
-    {
-        for ($i = 0; $i < count($modules); ++$i) {
-            if (file_exists(
-                $_SESSION['config']['corepath'].'custom'
-                    .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id']
-                    .DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR
-                    .$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'class'
-                    .DIRECTORY_SEPARATOR.'class_modules_tools.php'
-            )
-            ) {
-                $path_module_tools = $_SESSION['config']['corepath'].'custom'
-                    .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id']
-                    .DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR
-                    .$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'class'
-                    .DIRECTORY_SEPARATOR.'class_modules_tools.php';
-            } else {
-                $path_module_tools = 'modules'.DIRECTORY_SEPARATOR
-                    .$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'class'
-                    .DIRECTORY_SEPARATOR.'class_modules_tools.php';
-            }
-            if (file_exists($path_module_tools)) {
-                require_once $path_module_tools;
-                $modules_tools = new $modules[$i]['moduleid']();
-                if (method_exists(
-                    $modules[$i]['moduleid'], 'load_module_var_session'
-                )
-                ) {
-                    $modules_tools->load_module_var_session($userData);
-                }
-            }
-            //$this->show_array($_SESSION['user']['baskets']);
-        }
-    }
-
     /**
      * Loads language variables into session.
      */
@@ -325,263 +272,6 @@ class core_tools extends functions
         }
     }
 
-    /**
-     * Loads application services into session.
-     */
-    public function load_app_services()
-    {
-//        $_SESSION['app_services'] = [];
-        /*
-        // Reads the application config.xml file
-        if (file_exists(
-            $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR
-            .$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'apps'
-            .DIRECTORY_SEPARATOR.$_SESSION['config']['app_id']
-            .DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'services.xml'
-        )
-        ) {
-            $path = $_SESSION['config']['corepath'].'custom'
-                .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id']
-                .DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR
-                .$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'xml'
-                .DIRECTORY_SEPARATOR.'services.xml';
-        } else {
-            $path = 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id']
-                .DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR
-                .'services.xml';
-        }
-        $xmlconfig = simplexml_load_file($path);
-        $k = 0;
-        $m = 0;
-        include_once 'apps/'.$_SESSION['config']['app_id'].'/lang/'.$_SESSION['config']['lang'].'.php';
-        // Browses the services in that file and loads $_SESSION['app_services']
-        foreach ($xmlconfig->SERVICE as $service) {
-            $_SESSION['app_services'][$k] = array();
-            $_SESSION['app_services'][$k]['id'] = (string) $service->id;
-            $name = (string) $service->name;
-            if (!empty($name) && defined($name) && constant($name) != null) {
-                $name = constant($name);
-            }
-            $_SESSION['app_services'][$k]['name'] = $name;
-            $comment = (string) $service->comment;
-            if (!empty($comment) && defined($comment)
-                && constant($comment) != null
-            ) {
-                $comment = constant($comment);
-            }
-            $_SESSION['app_services'][$k]['comment'] = $comment;
-            if (isset($service->servicepage)) {
-                $_SESSION['app_services'][$k]['servicepage'] = (string) $service->servicepage;
-                $_SESSION['app_services'][$k]['servicepage'] = preg_replace(
-                    '/&admin/', '&amp;admin',
-                    $_SESSION['app_services'][$k]['servicepage']
-                );
-                $_SESSION['app_services'][$k]['servicepage'] = preg_replace(
-                    '/&module/', '&amp;module',
-                    $_SESSION['app_services'][$k]['servicepage']
-                );
-            }
-            $_SESSION['app_services'][$k]['servicetype'] = (string) $service->servicetype;
-
-            if (isset($service->style)) {
-                $_SESSION['app_services'][$k]['style'] = (string) $service->style;
-            }
-
-            $systemService = (string) $service->system_service;
-            if ($systemService == 'false') {
-                $_SESSION['app_services'][$k]['system_service'] = false;
-            } else {
-                $_SESSION['app_services'][$k]['system_service'] = true;
-            }
-            $_SESSION['app_services'][$k]['enabled'] = (string) $service->enabled;
-            $l = 0;
-            foreach ($service->WHEREAMIUSED as $whereAmIUsed) {
-                if (isset($whereAmIUsed)) {
-                    $_SESSION['app_services'][$k]['whereamiused'][$l]['page'] = (string) $whereAmIUsed->page;
-                    $_SESSION['app_services'][$k]['whereamiused'][$l]['nature'] = (string) $whereAmIUsed->nature;
-                    if (isset($whereAmIUsed->button_label)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['button_label'] = (string) $whereAmIUsed->button_label;
-                    }
-                    if (isset($whereAmIUsed->tab_label)) {
-                        $label = (string) $whereAmIUsed->tab_label;
-                        if (!empty($label) && defined($label)
-                            && constant($label) != null
-                        ) {
-                            $label = constant($label);
-                        }
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['tab_label'] = $label;
-                    }
-                    if (isset($whereAmIUsed->tab_order)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['tab_order'] = (string) $whereAmIUsed->tab_order;
-                    }
-                    if (isset($whereAmIUsed->width)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['width'] = (string) $whereAmIUsed->width;
-                    }
-                    if (isset($whereAmIUsed->frame_id)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['frame_id'] = (string) $whereAmIUsed->frame_id;
-                    }
-                    if (isset($whereAmIUsed->height)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['height'] = (string) $whereAmIUsed->height;
-                    }
-                    if (isset($whereAmIUsed->scrolling)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['scrolling'] = (string) $whereAmIUsed->scrolling;
-                    }
-                    if (isset($whereAmIUsed->style)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['style'] = (string) $whereAmIUsed->style;
-                    }
-                    if (isset($whereAmIUsed->border)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['border'] = (string) $whereAmIUsed->border;
-                    }
-                    ++$l;
-                }
-            }
-            $m = 0;
-            // Loads preprocess and postprocess
-            foreach ($service->PROCESSINBACKGROUND as $processInBackground) {
-                $_SESSION['app_services'][$k]['processinbackground'][$m]['page'] = (string) $processInBackground->page;
-                if ((string) $processInBackground->preprocess != '') {
-                    $_SESSION['app_services'][$k]['processinbackground'][$m]['preprocess'] = (string) $processInBackground->preprocess;
-                }
-                if ((string) $processInBackground->postprocess != '') {
-                    $_SESSION['app_services'][$k]['processinbackground'][$m]['postprocess'] = (string) $processInBackground->postprocess;
-                }
-                $_SESSION['app_services'][$k]['processinbackground'][$m]['processorder'] = (string) $processInBackground->processorder;
-                ++$m;
-            }
-            ++$k;
-        }*/
-    }
-
-    /**
-     * Loads the services of each module into session.
-     *
-     * @param $modules array Enabled modules of the application
-     */
-    public function load_modules_services($modules)
-    {
-//        $_SESSION['modules_services'] = [];
-        /*
-        // Browses the enabled modules array
-        for ($i = 0; $i < count($modules); ++$i) {
-            // Reads the module config.xml file
-            $path = '';
-            $moduleServiceXml = 'modules'.DIRECTORY_SEPARATOR.$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'services.xml';
-            if (file_exists(
-                'custom'.DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.$moduleServiceXml
-            )
-            ) {
-                $path = 'custom' .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.$moduleServiceXml;
-            } elseif (file_exists($moduleServiceXml)) {
-                $path = $moduleServiceXml;
-            }
-            if (!empty($path)) {
-                $xmlconfig = simplexml_load_file($path);
-                $k = 0;
-                $m = 0;
-                foreach ($xmlconfig->SERVICE as $service) {
-                    if ((string) $service->enabled == 'true') {
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['id'] = (string) $service->id;
-                        $name = (string) $service->name;
-                        if (!empty($name) && defined($name)
-                            && constant($name) != null
-                        ) {
-                            $name = constant($name);
-                        }
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['name'] =
-                            $name;
-    
-                        $comment = (string) $service->comment;
-                        if (!empty($comment) && defined($comment)
-                            && constant($comment) != null
-                        ) {
-                            $comment = constant($comment);
-                        }
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['comment'] =
-                            $comment;
-    
-                        if (isset($service->servicepage)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['servicepage'] = (string) $service->servicepage;
-                        }
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['servicetype'] = (string) $service->servicetype;
-    
-                        if (isset($service->style)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['style'] = (string) $service->style;
-                        }
-                        $systemService = (string) $service->system_service;
-                        if ($systemService == 'false') {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['system_service'] = false;
-                        } else {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['system_service'] = true;
-                        }
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['enabled'] = (string) $service->enabled;
-    
-                        $l = 0;
-                        foreach ($service->WHEREAMIUSED as $whereAmIUsed) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['page'] = (string) $whereAmIUsed->page;
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['nature'] = (string) $whereAmIUsed->nature;
-                            if (isset($whereAmIUsed->button_label)) {
-                                $label = (string) $whereAmIUsed->button_label;
-                                if (!empty($label) && defined($label)
-                                    && constant($label) != null
-                                ) {
-                                    $label = constant($label);
-                                }
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['button_label'] =
-                                    $label;
-                            }
-                            if (isset($whereAmIUsed->tab_label)) {
-                                $label = (string) $whereAmIUsed->tab_label;
-                                if (!empty($label) && defined($label)
-                                    && constant($label) != null
-                                ) {
-                                    $label = constant($label);
-                                }
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['tab_label'] =
-                                    $label;
-                            }
-                            if (isset($whereAmIUsed->tab_order)) {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['tab_order'] = (string) $whereAmIUsed->tab_order;
-                            }
-                            if (isset($whereAmIUsed->frame_id)) {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['frame_id'] = (string) $whereAmIUsed->frame_id;
-                            }
-                            if (isset($whereAmIUsed->width)) {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['width'] = (string) $whereAmIUsed->width;
-                            }
-                            if (isset($whereAmIUsed->height)) {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['height'] = (string) $whereAmIUsed->height;
-                            }
-                            if (isset($whereAmIUsed->scrolling)) {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['scrolling'] = (string) $whereAmIUsed->scrolling;
-                            }
-                            if (isset($whereAmIUsed->style)) {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['style'] = (string) $whereAmIUsed->style;
-                            }
-                            if (isset($whereAmIUsed->border)) {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['border'] = (string) $whereAmIUsed->border;
-                            }
-                            ++$l;
-                        }
-                        $m = 0;
-                        foreach ($service->PROCESSINBACKGROUND as $processInBackground) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['processinbackground'][$m]['page'] = (string) $processInBackground->page;
-                            if ((string) $processInBackground->preprocess != '') {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['processinbackground'][$m]['preprocess'] = (string) $processInBackground->preprocess;
-                            }
-                            if ((string) $processInBackground->postprocess != '') {
-                                $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['processinbackground'][$m]['postprocess'] = (string) $processInBackground->postprocess;
-                            }
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['processinbackground'][$m]['processorder'] = (string) $processInBackground->processorder;
-                            ++$m;
-                        }
-                        ++$k;
-                    }
-                }
-            }
-        }
-        */
-    }
-
     /**
      * Executes the module' s services in the page.
      *
@@ -687,11 +377,12 @@ class core_tools extends functions
                                     .$scrolling.' '.$style.'></iframe>';
 
                                 return $iframeStr;
-                                //break;
+                            //break;
                             } elseif ($modules_services[$id_module][$i]['whereamiused'][$k]['nature'] == 'popup'
                                 && $_SESSION['user']['services'][$modules_services[$id_module][$i]['id']]
                                 && !in_array(
-                                    $modules_services[$id_module][$i]['id'], $executedServices
+                                    $modules_services[$id_module][$i]['id'],
+                                    $executedServices
                                 )
                             ) {
                                 array_push(
@@ -699,9 +390,9 @@ class core_tools extends functions
                                     $modules_services[$id_module][$i]['id']
                                 );
                                 echo $modules_services[$id_module][$i]['name']; ?>
-                                <br />
-                                <a href='<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module='.$id_module.'&page='.$modules_services[$id_module][$i]['servicepage']; ?>' target='_blank'><?php echo _ACCESS_TO_SERVICE; ?></a><br /><br />
-                                <?php
+<br />
+<a href='<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module='.$id_module.'&page='.$modules_services[$id_module][$i]['servicepage']; ?>' target='_blank'><?php echo _ACCESS_TO_SERVICE; ?></a><br /><br />
+<?php
                                 break;
                             } elseif ($modules_services[$id_module][$i]['whereamiused'][$k]['nature'] == 'button'
                                 && $_SESSION['user']['services'][$modules_services[$id_module][$i]['id']]
@@ -720,8 +411,8 @@ class core_tools extends functions
                                 ) {
                                     $tmp = constant($tmp);
                                 } ?>
-                                <input type="button" name="<?php functions::xecho($modules_services[$id_module][$i]['id']); ?>" value="<?php functions::xecho($tmp); ?>" onclick="window.open('<?php echo   $_SESSION['config']['businessappurl'].'index.php?display=true&module='.$id_module.'&page='.$modules_services[$id_module][$i]['servicepage']; ?>', '<?php functions::xecho($modules_services[$id_module][$i]['id']); ?>','width=<?php functions::xecho($modules_services[$id_module][$i]['whereamiused'][$k]['width']); ?>,height=<?php functions::xecho($modules_services[$id_module][$i]['whereamiused'][$k]['height']); ?>,scrollbars=yes,resizable=yes' );" class="button" /><br/>
-                                <?php
+<input type="button" name="<?php functions::xecho($modules_services[$id_module][$i]['id']); ?>" value="<?php functions::xecho($tmp); ?>" onclick="window.open('<?php echo   $_SESSION['config']['businessappurl'].'index.php?display=true&module='.$id_module.'&page='.$modules_services[$id_module][$i]['servicepage']; ?>', '<?php functions::xecho($modules_services[$id_module][$i]['id']); ?>','width=<?php functions::xecho($modules_services[$id_module][$i]['whereamiused'][$k]['width']); ?>,height=<?php functions::xecho($modules_services[$id_module][$i]['whereamiused'][$k]['height']); ?>,scrollbars=yes,resizable=yes' );" class="button" /><br />
+<?php
                                 break;
                             } elseif ($modules_services[$id_module][$i]['whereamiused'][$k]['nature'] == 'include'
                                 && $_SESSION['user']['services'][$modules_services[$id_module][$i]['id']]
@@ -885,9 +576,9 @@ class core_tools extends functions
                                                 $modules_services[$value][$iService]['id']
                                             );
                                             echo $modules_services[$value][$iService]['name']; ?>
-                                            <br />
-                                            <a href='<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module='.$value.'&page='.$modules_services[$value][$iService]['servicepage']; ?>' target='_blank'><?php echo _ACCESS_TO_SERVICE; ?></a><br /><br />
-                                            <?php
+<br />
+<a href='<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module='.$value.'&page='.$modules_services[$value][$iService]['servicepage']; ?>' target='_blank'><?php echo _ACCESS_TO_SERVICE; ?></a><br /><br />
+<?php
                                         } elseif ($modules_services[$value][$iService]['whereamiused'][$k]['nature'] == 'button'
                                             && $_SESSION['user']['services'][$modules_services[$value][$iService]['id']]
                                             && ($servicenature == 'all' || $servicenature == 'button')
@@ -907,8 +598,8 @@ class core_tools extends functions
                                             ) {
                                                 $tmp = constant($tmp);
                                             } ?>
-                                            <input type="button" name="<?php functions::xecho($modules_services[$value][$iService]['id']); ?>" value="<?php functions::xecho($tmp); ?>" onclick="window.open('<?php echo  $_SESSION['config']['businessappurl'].'index.php?display=true&module='.$iServiced_module.'&page='.$modules_services[$iServiced_module][$iService]['servicepage']; ?>', '<?php functions::xecho($modules_services[$value][$iService]['id']); ?>','width=<?php functions::xecho($modules_services[$value][$iService]['whereamiused'][$k]['width']); ?>,height=<?php functions::xecho($modules_services[$value][$iService]['whereamiused'][$k]['height']); ?>,scrollbars=yes,resizable=yes' );" class="button" /><br/>
-                                            <?php
+<input type="button" name="<?php functions::xecho($modules_services[$value][$iService]['id']); ?>" value="<?php functions::xecho($tmp); ?>" onclick="window.open('<?php echo  $_SESSION['config']['businessappurl'].'index.php?display=true&module='.$iServiced_module.'&page='.$modules_services[$iServiced_module][$iService]['servicepage']; ?>', '<?php functions::xecho($modules_services[$value][$iService]['id']); ?>','width=<?php functions::xecho($modules_services[$value][$iService]['whereamiused'][$k]['width']); ?>,height=<?php functions::xecho($modules_services[$value][$iService]['whereamiused'][$k]['height']); ?>,scrollbars=yes,resizable=yes' );" class="button" /><br />
+<?php
                                         } elseif (isset($_SESSION['user']['services'][$modules_services[$value][$iService]['id']])
                                             && $modules_services[$value][$iService]['whereamiused'][$k]['nature'] == 'include'
                                             && $_SESSION['user']['services'][$modules_services[$value][$iService]['id']]
@@ -937,130 +628,22 @@ class core_tools extends functions
                 for ($u = 1; $u <= count($tab_view); ++$u) {
                     if ($u == 1) {
                         ?>
-                        <td  class="indexingtab">
-                            <a href="javascript://" onclick="opentab('myframe', '<?php functions::xecho($tab_view[$u]['frame_src']); ?>');">
-                                <?php functions::xecho($tab_view[$u]['tab_label']); ?>
-                            </a>
-                            <?php
+<td class="indexingtab">
+    <a href="javascript://" onclick="opentab('myframe', '<?php functions::xecho($tab_view[$u]['frame_src']); ?>');">
+        <?php functions::xecho($tab_view[$u]['tab_label']); ?>
+    </a>
+    <?php
                             $_SESSION['first_tab_to_open'] = $tab_view[$u]['frame_src']; ?>
-                        </td>
-                        <?php
+</td>
+<?php
                     } else {
                         ?>
-                        <td  class="indexingtab">
-                            <a href="javascript://" onclick="opentab('myframe', '<?php functions::xecho($tab_view[$u]['frame_src']); ?>');">
-                                <?php functions::xecho($tab_view[$u]['tab_label']); ?>
-                            </a>
-                        </td>
-                        <?php
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Executes the apps services in the page.
-     *
-     * @param  $apps_services array  List of the application services
-     * @param  $whereami string Page where to execute the service
-     * @param  $servicenature string Nature of the service (by default, the function takes all the services natures)
-     */
-    public function execute_app_services($appServices, $whereami, $servicenature = 'all')
-    {
-        $executedServices = array();
-        for ($i = 0; $i < count($appServices); ++$i) {
-            if (isset($appServices[$i]['whereamiused'])) {
-                for ($k = 0; $k < count($appServices[$i]['whereamiused']); ++$k) {
-                    if ($appServices[$i]['whereamiused'][$k]['page'] == $whereami) {
-                        if ($appServices[$i]['whereamiused'][$k]['nature'] == 'frame'
-                            && $_SESSION['user']['services'][$appServices[$i]['id']]
-                            && ($servicenature == 'all' || $servicenature == 'frame')
-                            && !in_array(
-                                $appServices[$i]['id'],
-                                $executedServices
-                            )
-                        ) {
-                            array_push(
-                                $executedServices,
-                                $appServices[$i]['id']
-                            ); ?>
-                               <iframe src='<?php echo  $_SESSION['config']['businessappurl'].'index.php?display=true&page='.$appServices[$i]['servicepage']; ?>' name="<?php  $appServices[$i]['id']; ?>" id="<?php  $appServices[$i]['id']; ?>" width='<?php functions::xecho($appServices[$i]['whereamiused'][$k]['width']); ?>' height='<?php functions::xecho($appServices[$i]['whereamiused'][$k]['height']); ?>' frameborder='<?php functions::xecho($appServices[$i]['whereamiused'][$k]['border']); ?>' scrolling='<?php functions::xecho($appServices[$i]['whereamiused'][$k]['scrolling']); ?>'></iframe>
-                               <?php
-                        } elseif ($appServices[$i]['whereamiused'][$k]['nature'] == 'popup'
-                            && $_SESSION['user']['services'][$appServices[$i]['id']]
-                            && ($servicenature == 'all' || $servicenature == 'popup')
-                            && !in_array(
-                                $appServices[$i]['id'],
-                                $executedServices
-                            )
-                        ) {
-                            array_push(
-                                $executedServices,
-                                $appServices[$i]['id']
-                            );
-                            echo $appServices[$i]['name']; ?>
-                            <br />
-                            <a href='<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&page='.$appServices[$i]['servicepage']; ?>' target='_blank'><?php echo _ACCESS_TO_SERVICE; ?></a><br /><br />
-                             <?php
-                        } elseif ($appServices[$i]['whereamiused'][$k]['nature'] == 'button'
-                            && $_SESSION['user']['services'][$appServices[$i]['id']]
-                            && ($servicenature == 'all' || $servicenature == 'button')
-                            && !in_array(
-                                $appServices[$i]['id'], $executedServices
-                            )
-                       ) {
-                            array_push(
-                                $executedServices,
-                                $appServices[$i]['id']
-                            );
-                            $tmp = $appServices[$i]['whereamiused'][$k]['button_label'];
-                            if (!empty($tmp) && defined($tmp)
-                                && constant($tmp) != null
-                            ) {
-                                $tmp = constant($tmp);
-                            } ?>
-                            <input type="button" name="<?php functions::xecho($appServices[$i]['id']); ?>" value="<?php functions::xecho($tmp); ?>" onclick="window.open('<?php echo  $_SESSION['config']['businessappurl'].'index.php?display=true&page='.$appServices[$i]['servicepage']; ?>', '<?php functions::xecho($appServices[$i]['id']); ?>','width=<?php functions::xecho($appServices[$i]['whereamiused'][$k]['width']); ?>,height=<?php functions::xecho($appServices[$i]['whereamiused'][$k]['height']); ?>,scrollbars=yes,resizable=yes' );" class="button" /><br/>
-                            <?php
-                        } elseif ($appServices[$i]['whereamiused'][$k]['nature'] == 'include'
-                            && isset($_SESSION['user']['services'][$appServices[$i]['id']])
-                            && $_SESSION['user']['services'][$appServices[$i]['id']]
-                            && ($servicenature == 'all' || $servicenature == 'include')
-                            && !in_array(
-                                $appServices[$i]['id'], $executedServices
-                            )
-                        ) {
-                            array_push(
-                                $executedServices, $appServices[$i]['id']
-                            );
-                            if (isset($_SESSION['custom_override_id'])
-                                && !empty($_SESSION['custom_override_id'])
-                                && file_exists(
-                                    $_SESSION['config']['corepath'].'custom'
-                                    .DIRECTORY_SEPARATOR
-                                    .$_SESSION['custom_override_id']
-                                    .DIRECTORY_SEPARATOR.'apps'
-                                    .DIRECTORY_SEPARATOR
-                                    .$_SESSION['config']['app_id']
-                                    .DIRECTORY_SEPARATOR
-                                    .$appServices[$i]['servicepage']
-                                )
-                            ) {
-                                include $_SESSION['config']['corepath']
-                                    .'custom'.DIRECTORY_SEPARATOR
-                                    .$_SESSION['custom_override_id']
-                                    .DIRECTORY_SEPARATOR.'apps'
-                                    .DIRECTORY_SEPARATOR
-                                    .$_SESSION['config']['app_id']
-                                    .DIRECTORY_SEPARATOR
-                                    .$appServices[$i]['servicepage'];
-                            } else {
-                                include 'apps'.DIRECTORY_SEPARATOR
-                                .$_SESSION['config']['app_id']
-                                .DIRECTORY_SEPARATOR
-                                .$appServices[$i]['servicepage'];
-                            }
-                        }
+<td class="indexingtab">
+    <a href="javascript://" onclick="opentab('myframe', '<?php functions::xecho($tab_view[$u]['frame_src']); ?>');">
+        <?php functions::xecho($tab_view[$u]['tab_label']); ?>
+    </a>
+</td>
+<?php
                     }
                 }
             }
@@ -1073,9 +656,9 @@ class core_tools extends functions
     public function load_html()
     {
         /*<?xml version="1.0" encoding="UTF-8"?>*/ ?>
-        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php functions::xecho($_SESSION['config']['lang']); ?>" lang="<?php functions::xecho($_SESSION['config']['lang']); ?>">
-        <?php
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php functions::xecho($_SESSION['config']['lang']); ?>" lang="<?php functions::xecho($_SESSION['config']['lang']); ?>">
+<?php
     }
 
     /**
@@ -1088,21 +671,20 @@ class core_tools extends functions
         if (empty($title)) {
             $title = $_SESSION['config']['applicationname'];
         } ?>
-        <head>
-            <title><?php functions::xecho($title); ?></title>
-            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-            <meta http-equiv="Content-Language" content="<?php functions::xecho($_SESSION['config']['lang']); ?>" />
-            <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
-            <link rel="icon" type="image/svg+xml" href="static.php?filename=logo_only.svg"/>
-            <?php
+
+<head>
+    <title><?php functions::xecho($title); ?>
+    </title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <meta http-equiv="Content-Language" content="<?php functions::xecho($_SESSION['config']['lang']); ?>" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <link rel="icon" type="image/svg+xml" href="static.php?filename=logo_only.svg" />
+    <?php
             if ($load_css) {
                 $this->load_css();
-            }
-        if ($load_js) {
-            $this->load_js();
-        } ?>
-        </head>
-        <?php
+            } ?>
+</head>
+<?php
     }
 
     /**
@@ -1111,20 +693,8 @@ class core_tools extends functions
     private function load_css()
     {
         ?>
-        <link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/all.css" media="screen" />
-        <link rel="stylesheet" href="css/font-awesome-maarch/css/font-maarch.css" media="screen" />
-        <link rel="stylesheet" type="text/css" href="merged_css.php" media="screen" />
-        <?php
-    }
-
-    /**
-     * Loads the javascript files of the application and modules.
-     */
-    public function load_js()
-    {
-        ?>
-        <script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl']; ?>merged_js.php"></script>
-        <?php
+<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/all.css" media="screen" />
+<?php
     }
 
     /**
@@ -1148,10 +718,10 @@ class core_tools extends functions
             // CVA 31 oct 2014 Security Local File Inclusion
             if ($_GET['module'] == 'tags') {
                 $this->f_page = str_replace(
-                     array('../', '..%2F'),
-                     array('', ''),
-                     $_GET['page']
-                 );
+                    array('../', '..%2F'),
+                    array('', ''),
+                    $_GET['page']
+                );
             } else {
                 $this->f_page = str_replace(
                     array('../', '..%2F'),
@@ -1263,7 +833,6 @@ class core_tools extends functions
             if (!$found) {
                 $this->loadDefaultPage();
             }
-
         } else {
             // Page is defined in the application
             $found = false;
@@ -1357,64 +926,6 @@ class core_tools extends functions
         }
     }
 
-    /**
-     * Loads the footer.
-     */
-    public function load_footer()
-    {
-        echo 'Powered by Maarch&trade; 2020';
-    }
-
-    /**
-     * Views Cookies informations, POST and SESSION variables if the mode debug is enabled in the application config.
-     */
-    public function view_debug()
-    {
-        if ($_SESSION['config']['debug'] == 'true') {
-            ?>
-            <div id="debug">
-                <p>&nbsp;</p>
-                <p>&nbsp;</p>
-                <p>&nbsp;</p>
-                <h1 class="tit">DEBUG MODE</h1>
-                    <h2 class="tit">Cookie</h2>
-                    <?php
-                    $this->show_array($_COOKIE); ?>
-                    <h2 class="tit">Session</h2>
-                    <?php
-                    $this->show_array($_SESSION); ?>
-                    <h2 class="tit">Request</h2>
-                    <?php
-                    $this->show_array($_REQUEST); ?>
-                    <h2 class="tit">Post</h2>
-                    <?php
-                    $this->show_array($_POST); ?>
-                    <h2 class="tit">Get</h2>
-                    <?php
-                    $this->show_array($_GET); ?>
-                    <h2 class="tit">SERVER</h2>
-                    <?php
-                    $this->show_array($_SERVER); ?>
-            </div>
-            <?php
-        }
-    }
-
-    /**
-     * Tests if the current user is defined in the current session.
-     */
-    public function test_user()
-    {
-        if (!isset($_SESSION['user']['UserId'])) {
-            if (trim($_SERVER['argv'][0]) != '') {
-                header('location: reopen.php?'.$_SERVER['argv'][0]);
-            } else {
-                header('location: reopen.php');
-            }
-            exit;
-        }
-    }
-
     /**
      * Tests if the module is loaded.
      *
@@ -1437,190 +948,6 @@ class core_tools extends functions
         }
     }
 
-    /**
-     * Retrieves the label corresponding to a service.
-     *
-     * @param  $id_service string Service identifier
-     *
-     * @return string Service Label or  _NO_LABEL_FOUND value
-     */
-    public function retrieve_label_service($id_service)
-    {
-        for ($i = 0; $i < count($_SESSION['enabled_services']); ++$i) {
-            if ($_SESSION['enabled_services'][$i]['id'] == $id_service) {
-                return $_SESSION['enabled_services'][$i]['label'];
-            }
-        }
-
-        return _NO_LABEL_FOUND;
-    }
-
-    /**
-     * Tests if the user has admin rights on the service.
-     *
-     * @param  $id_service string Service identifier
-     * @param  $module string Module identifier or "apps"
-     * @param  $redirect bool If true the user is redirected in the index page, else no redirection (True by default)
-     *
-     * @return bool or redirection depending on the $redirect value
-     */
-    public function test_admin($id_service, $module, $redirect = true)
-    {
-        // Application service
-        if ($module == 'apps') {
-            $system = false;
-            if (isset($_SESSION['apps_services'])) {
-                for ($i = 0; $i < count($_SESSION['apps_services']); ++$i) {
-                    if ($_SESSION['apps_services'][$i]['system_service']) {
-                        return true;
-                    }
-                }
-            }
-        }
-        // Module service
-        else {
-            if (!$this->is_module_loaded($module)) {
-                if ($redirect) {
-                    $_SESSION['error'] = _SERVICE.' '._UNKNOWN.' : '.$id_service; ?>
-                    <script type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php';</script>
-                    <?php
-                    exit();
-                } else {
-                    return false;
-                }
-            } else {
-                $system = false;
-                for ($i = 0; $i < count($_SESSION['modules_services'][$module]); ++$i) {
-                    if ($_SESSION['modules_services'][$module][$i]['id'] == $id_service) {
-                        if ($_SESSION['modules_services'][$module][$i]['system_service'] == true) {
-                            return true;
-                        }
-                    } else {
-                        break;
-                    }
-                }
-            }
-        }
-        if (!isset($_SESSION['user']['services'][$id_service])) {
-            if ($redirect) {
-                $_SESSION['error'] = _ADMIN_SERVICE.' '._UNKNOWN; ?>
-                <script type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php';</script>
-                <?php
-                exit();
-            } else {
-                return false;
-            }
-        } else {
-            if ($_SESSION['user']['services'][$id_service] == false) {
-                if ($redirect) {
-                    $label = $this->retrieve_label_service($id_service);
-                    $_SESSION['error'] = _NO_RIGHTS_ON.' : '.$label; ?>
-                    <script type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php';</script>
-                    <?php
-                    exit();
-                } else {
-                    return false;
-                }
-            } else {
-                return true;
-            }
-        }
-    }
-
-    /**
-     * Tests if the user has right on the service.
-     *
-     * @param  $id_service string Service identifier
-     * @param  $module string Module identifier or "apps"
-     * @param  $redirect bool If true the user is redirected in the index page, else no redirection (True by default)
-     *
-     * @return bool or redirection depending on the $redirect value
-     */
-    public function test_service($id_service, $module, $redirect = true)
-    {
-        // Application service
-        if ($module == 'apps') {
-            $system = false;
-            if (isset($_SESSION['apps_services'])) {
-                for ($i = 0; $i < count($_SESSION['apps_services']); ++$i) {
-                    if ($_SESSION['apps_services'][$i]['system_service']) {
-                        return true;
-                    }
-                }
-            }
-        }
-        // Module service
-        else {
-            if (!$this->is_module_loaded($module)) {
-                if ($redirect) {
-                    $_SESSION['error'] = _SERVICE.' '._UNKNOWN.' : '.$id_service; ?>
-                    <script type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php';</script>
-                    <?php
-                    exit();
-                } else {
-                    return false;
-                }
-            } else {
-                $system = false;
-                if (!empty($_SESSION['modules_services'])) {
-                    for ($i = 0; $i < count($_SESSION['modules_services'][$module]); ++$i) {
-                        if ($_SESSION['modules_services'][$module][$i]['id'] == $id_service) {
-                            if ($_SESSION['modules_services'][$module][$i]['system_service'] == true) {
-                                return true;
-                            }
-                        } else {
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-        if (!isset($_SESSION['user']['services'][$id_service])) {
-            if ($redirect) {
-                $_SESSION['error'] = _SERVICE.' '._UNKNOWN.' : '.$id_service; ?>
-                <script type="text/javascript">window.top.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php';</script>
-                <?php
-                exit();
-            } else {
-                return false;
-            }
-        } else {
-            if ($_SESSION['user']['services'][$id_service] == false) {
-                if ($redirect) {
-                    $label = $this->retrieve_label_service($id_service);
-                    $_SESSION['error'] = _NO_RIGHTS_ON.' : '.$label; ?>
-                    <script type="text/javascript" >window.top.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php';</script>
-                    <?php
-                    exit();
-                } else {
-                    return false;
-                }
-            } else {
-                return true;
-            }
-        }
-    }
-
-    /**
-     * Gets the time of session expiration.
-     *
-     * @return string time of session expiration
-     */
-    public function get_session_time_expire()
-    {
-        $time = 0;
-        $ini_time = (ini_get('session.gc_maxlifetime') - 1) / 60;
-        $maarch_time = $_SESSION['config']['cookietime'];
-
-        if ($maarch_time <= $ini_time) {
-            $time = $maarch_time;
-        } else {
-            $time = $ini_time;
-        }
-
-        return $time;
-    }
-
     /**
      * Gets the path of an action.
      *
diff --git a/core/class/class_db.php b/core/class/class_db.php
index 06070fbe3df..e43e9eb2fda 100755
--- a/core/class/class_db.php
+++ b/core/class/class_db.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*    Copyright 2008 - 2011 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -123,7 +110,6 @@ class dbquery extends functions
             if (isset($_SESSION['config']['databasename'])) {
                 $this->_database = $_SESSION['config']['databasename'];
             }
-            //$this->workspace = $_SESSION['config']['databaseworkspace'];
             if (isset($_SESSION['config']['databasetype'])) {
                 $this->_databasetype = $_SESSION['config']['databasetype'];
             }
@@ -150,14 +136,6 @@ class dbquery extends functions
                 } else {
                     $this->_user = $args[0]['user'];
                 }
-                //if(!isset($args[0]['workspace']))
-                //{
-                //  $this->workspace = 'public';
-                //}
-                //else
-                //{
-                //  $this->workspace = $args[0]['workspace'];
-                //}
                 if (! isset($args[0]['pass'])) {
                     $this->_password = '';
                 } else {
@@ -178,9 +156,6 @@ class dbquery extends functions
                 $this->_database = (string) $config->databasename;
                 $this->_user = (string) $config->databaseuser;
                 $this->_password = (string) $config->databasepassword;
-                //if (isset($config->databaseworkspace)) {
-                //  $this->workspace = (string) $config->databaseworkspace;
-                // }
                 $errorArgs = false;
             }
             if ($errorArgs) {
@@ -245,7 +220,6 @@ class dbquery extends functions
                     'UTF8'
                 );
             }
-            //$this->query("alter session set nls_date_format='dd-mm-yyyy HH24:MI:SS'");
             break;
             
         default:
@@ -273,48 +247,6 @@ class dbquery extends functions
             }
         }
     }
-
-    /**
-    * Test if the specified column exists in the database
-    *
-    * @param  $table : Name of searched table
-    * @param  $field : Name of searched field in table
-    *  ==Return : true is field is founed, false is not
-    */
-    public function test_column($table, $field)
-    {
-        switch ($this->_databasetype) {
-        
-        case 'POSTGRESQL':
-            $this->connect();
-            $this->query("select column_name from information_schema.columns where table_name = '" . $table . "' and column_name = '" . $field . "'");
-            $res = $this->nb_result();
-            $this->disconnect();
-            if ($res > 0) {
-                return true;
-            } else {
-                return false;
-            }
-            
-            // no break
-        case 'ORACLE':
-            $this->connect();
-            $this->query("SELECT * from USER_TAB_COLUMNS where TABLE_NAME = '" . $table . "' AND COLUMN_NAME = '" . $field . "'");
-            $res = $this->nb_result();
-            $this->disconnect();
-            if ($res > 0) {
-                return true;
-            } else {
-                return false;
-            }
-        
-            // no break
-        case 'SQLSERVER': return true; // TO DO
-        case 'MYSQL': return true; // TO DO
-        default: return false;
-        
-        }
-    }
     
     /**
     * Execution the sql query
@@ -405,8 +337,6 @@ class dbquery extends functions
                 $this->query = false;
             }
             
-            //$this->show();
-            
             if ($this->query == false && !$catchError) {
                 $this->_sqlError = 3;
                 $this->error();
@@ -420,22 +350,6 @@ class dbquery extends functions
         }
     }
     
-    public function start_transaction()
-    {
-        switch ($this->_databasetype) {
-        case 'MYSQL':
-            @mysqli_query($this->_sqlLink, 'BEGIN');
-            break;
-        case 'SQLSERVER':
-            break;
-        case 'POSTGRESQL':
-            @pg_query($this->_sqlLink, 'BEGIN');
-            break;
-        case 'ORACLE':
-            break;
-        }
-    }
-    
     public function rollback()
     {
         switch ($this->_databasetype) {
@@ -495,42 +409,6 @@ class dbquery extends functions
             }
         return $sqlError;
     }
-    
-    /**
-    * Returns the query results in an object
-    *
-    * @return Object
-    */
-    public function fetch_object()
-    {
-        switch ($this->_databasetype) {
-        case 'MYSQL': return @mysqli_fetch_object($this->query);
-        case 'SQLSERVER': return @mssql_fetch_object($this->query);
-        case 'POSTGRESQL': return @pg_fetch_object($this->query);
-        case 'ORACLE':
-            $myObject = @oci_fetch_object($this->query);
-            //$myLowerObject = false;
-            $myLowerObject = new stdClass();
-            if (isset($myObject) && ! empty($myObject)) {
-                foreach ($myObject as $key => $value) {
-                    $myKey = strtolower($key);
-                    if (oci_field_type($this->query, $key) == 'CLOB') {
-                        $myBlob = $myObject->{$key};
-                        if (isset($myBlob)) {
-                            $myLowerObject->{$myKey} = $myBlob->read(
-                                $myBlob->size()
-                            );
-                        }
-                    } else {
-                        $myLowerObject->{$myKey} = $myObject->{$key};
-                    }
-                }
-                return $myLowerObject;
-            } else {
-                return false;
-            }
-        }
-    }
 
     /**
     * Returns the query results in an array
@@ -548,7 +426,6 @@ class dbquery extends functions
             $tmpStatement = @oci_fetch_array($this->query);
 
             if (is_array($tmpStatement)) {
-                //$this->show_array($tmp_statement);
                 foreach (array_keys($tmpStatement) as $key) {
                     if (! is_numeric($key)
                         && oci_field_type($this->query, $key) == 'CLOB'
@@ -582,7 +459,6 @@ class dbquery extends functions
             $tmpStatement = @oci_fetch_assoc($this->query);
 
             if (is_array($tmpStatement)) {
-                //$this->show_array($tmp_statement);
                 foreach (array_keys($tmpStatement) as $key) {
                     if (! is_numeric($key)
                         && oci_field_type($this->query, $key) == 'CLOB'
@@ -599,22 +475,6 @@ class dbquery extends functions
         default: return false;
         }
     }
-    
-    /**
-    * Returns the query results in a row
-    *
-    * @return array
-    */
-    public function fetch_row()
-    {
-        switch ($this->_databasetype) {
-        case 'MYSQL': return @mysqli_fetch_row($this->query);
-        case 'POSTGRESQL': return @pg_fetch_row($this->query);
-        case 'SQLSERVER': return @mssql_fetch_row($this->query);
-        case 'ORACLE': return @oci_fetch_row($this->statement);
-        default: return false;
-        }
-    }
 
     /**
     * Returns the number of results for the current query
@@ -774,82 +634,6 @@ class dbquery extends functions
             . $this->_debugQuery . '</textarea>';
     }
     
-    /*************************************************************************
-    * Returns instruction to get date or part of the date
-    *
-    * Parameters
-    *   (string) date string
-    *   (string) date part name {year | month | day | hour | minute | second}
-    *
-    * Return
-    *   (string) date instruction
-    *
-    *************************************************************************/
-    public function extract_date($date_field, $arg = '')
-    {
-        switch ($this->_databasetype) {
-        case "SQLSERVER":
-            return '';
-        
-        case "MYSQL":
-            switch ($arg) {
-            case 'year': return ' date_format('.$date_field.', %Y)';
-            case 'month': return ' date_format('.$date_field.', %m)';
-            case 'day': return ' date_format('.$date_field.', %d)';
-            case 'hour': return ' date_format('.$date_field.', %k)';
-            case 'minute': return ' date_format('.$date_field.', %i)';
-            case 'second': return ' date_format('.$date_field.', %s)';
-            default: return ' date('.$date_field.')';
-            }
-        
-            // no break
-        case "POSTGRESQL":
-            switch ($arg) {
-            case 'year': return " date_part( 'year', ".$date_field.")";
-            case 'month': return " date_part( 'month', ".$date_field.")";
-            case 'day': return " date_part( 'day', ".$date_field.")";
-            case 'hour': return " date_part( 'hour', ".$date_field.")";
-            case 'minute': return " date_part( 'minute', ".$date_field.")";
-            case 'second': return " date_part( 'second', ".$date_field.")";
-            default: return ' date('.$date_field.')';
-            }
-        
-            // no break
-        case "ORACLE":
-            switch ($arg) {
-            case 'year': return " to_char(".$date_field.", 'YYYY')";
-            case 'month': return " to_char(".$date_field.", 'MM')";
-            case 'day': return " to_char(".$date_field.", 'DD')";
-            case 'hour': return " to_char(".$date_field.", 'HH24')";
-            case 'minute': return " to_char(".$date_field.", 'MI')";
-            case 'second': return " to_char(".$date_field.", 'SS')";
-            //default         : return " to_char(".$date_field.", 'DD/MM/YYYY')";
-            default: return $date_field;
-            }
-    
-        }
-    }
-    
-    public function escape_string($string)
-    {
-        switch ($this->_databasetype) {
-        case "SQLSERVER":
-            $string = str_replace("'", "''", $string);
-            $string = str_replace("\\", "\\\\", $string);
-            break;
-        case "ORACLE":
-            $string = str_replace("'", "''", $string);
-            $string = str_replace("\\", "\\\\", $string);
-            break;
-        case "MYSQL":
-            $string = mysql_escape_string($string);
-            break;
-        case "POSTGRESQL":
-            $string = pg_escape_string($string);
-        }
-        return $string;
-    }
-    
     /*************************************************************************
     * Returns the word to get the current timestamp on a query
     *
@@ -867,68 +651,4 @@ class dbquery extends functions
         default: return ' ';
         }
     }
-    
-    /*************************************************************************
-    * Returns a select query with limit clause
-    *
-    * Parameters
-    *   (integer) start : Offset of first result requested (default 0)
-    *   (integer) count : Number of result requested (default 0)
-    *   (string) select expression : Selected columns (comma separated)
-    *   (string) table references : One or more tables (can be prepared by function make_table_ref)
-    *   (string) where def
-    *   (string) other_clauses : group_by, order_by, having...
-    *   (string) select options : distinct
-    *
-    * Return
-    *   (string) query string
-    *
-    * Evolutions
-    *   Offset with MSSQL
-    *************************************************************************/
-    public function limit_select($start, $count, $select_expr, $table_refs, $where_def='1=1', $other_clauses='', $select_opts='')
-    {
-            
-        // LIMIT
-        if ($count || $start) {
-            switch ($this->_databasetype) {
-            case 'MYSQL':
-                $limit_clause = 'LIMIT ' . $start . ',' . $count;
-                break;
-                
-            case 'POSTGRESQL':
-                $limit_clause = 'OFFSET ' . $start . ' LIMIT ' . $count;
-                break;
-                
-            case 'SQLSERVER':
-                $select_opts .= ' TOP ' . $count;
-                break;
-                
-            case 'ORACLE':
-                if ($where_def) {
-                    $where_def .= ' AND ';
-                }
-                $where_def .= ' ROWNUM <= ' . $count;
-                break;
-                
-            default:
-                break;
-            }
-        }
-        
-        if (empty($where_def)) {
-            $where_def = '1=1';
-        }
-        
-        // CONSTRUCT QUERY
-        $query = 'SELECT' .
-            ' ' . $select_opts .
-            ' ' . $select_expr .
-            ' FROM ' . $table_refs .
-            ' WHERE ' . $where_def .
-            ' ' . $other_clauses .
-            ' ' . $limit_clause;
-        
-        return $query;
-    }
 }
diff --git a/core/class/class_db_pdo.php b/core/class/class_db_pdo.php
index c173f291892..31172986ed7 100755
--- a/core/class/class_db_pdo.php
+++ b/core/class/class_db_pdo.php
@@ -1,21 +1,8 @@
 <?php
 /*
- * Copyright (C) 2015 Maarch
- *
- * This file is part of Maarch.
- *
- * Maarch 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.
- *
- * Maarch 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 Maarch.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
  */
 /**
  * Class for database queries
@@ -222,37 +209,6 @@ class Database extends functions
         return $this->pdo->beginTransaction();
     }
 
-    /**
-     * Retrieve last record id
-     *
-     * @return PDOStatement
-     */
-    public function lastInsertId($sequenceName=null)
-    {
-        switch ($_SESSION['config']['databasetype']) {
-            case 'MYSQL': return @mysqli_insert_id($this->_sqlLink);
-            case 'POSTGRESQL':
-                $stmt_last_insert = $this->query("SELECT last_value as lastinsertid FROM " . $sequenceName);
-                $resultat_last = $stmt_last_insert->fetchObject();
-                return $resultat_last->lastinsertid;
-            case 'SQLSERVER': return '';
-            case 'ORACLE':
-                //$sequenceName = strtoupper($sequenceName);
-                $stmt_last_insert = $this->query("SELECT " . $sequenceName . ".currval as lastinsertid FROM dual");
-                $resultat_last = $stmt_last_insert->fetchObject();
-
-                if (empty($resultat_last->lastinsertid)) {
-                    $stmt_last_insert = $this->query("SELECT to_char(Last_number) as lastinsertid FROM user_sequences where upper(sequence_name) = upper('" . $sequenceName . "')");
-                    $resultat_last = $stmt_last_insert->fetchObject();
-                }
-
-                return $resultat_last->lastinsertid;
-            default: return false;
-        }
-    }
-
-
-
     /**
      * Commit a transaction
      *
@@ -318,7 +274,6 @@ class Database extends functions
             $originalData = $parameters;
             foreach ($parameters as $key => $value) {
                 if (is_array($value)) {
-                    //echo $key . $value. '<br />';
                     if (is_int($key)) {
                         $placeholders = implode(',', array_fill(0, count($value), '?'));
                         preg_match_all("/\?/", $queryString, $matches, PREG_OFFSET_CAPTURE);
@@ -339,24 +294,6 @@ class Database extends functions
                         $queryString = str_replace($key, $placeholders, $queryString);
                         unset($parameters[$key]);
                     }
-                    // var_dump($queryString);
-                    // var_dump($parameters);
-                } else {
-                    //echo $key . $value. '<br />';
-                    /*if (empty($parameters[$value])) {
-
-                    }*/
-                    if (
-                        $_SESSION['config']['databasetype'] == 'ORACLE'
-                        /*&&
-                        (
-                            stripos($queryString, 'insert') !== false ||
-                            stripos($queryString, 'update') !== false
-                        )*/
-                    ) {
-                        //$parameters[$key] = $this->normalizeAccent($value);
-                        //echo $parameters[$key] . '<br/>';
-                    }
                 }
             }
         }
@@ -380,7 +317,6 @@ class Database extends functions
                 preg_match_all("/\?|\:/", $queryString, $matches, PREG_OFFSET_CAPTURE);
                 $withParams = false;
                 if (empty($matches[0])) {
-                    //echo $queryString;
                     $executed = $this->stmt->execute();
                 } else {
                     $withParams = true;
@@ -392,10 +328,9 @@ class Database extends functions
 
                     return false;
                 } else {
-                    if (strpos($PDOException->getMessage(), 'Admin shutdown: 7') !== false || 
+                    if (strpos($PDOException->getMessage(), 'Admin shutdown: 7') !== false ||
                         strpos($PDOException->getMessage(), 'General error: 7') !== false
                     ) {
-                        //echo 'catch error:' . $PDOException->getMessage() .  '<br />';
                         $db = new Database();
                         if ($originalData) {
                             $db->query($originalQuery, $originalData);
@@ -456,8 +391,6 @@ class Database extends functions
                     break;
                     
                 case 'ORACLE':
-                    //if($where_def) $where_def .= ' AND ';
-                    //$where_def .= ' ROWNUM <= ' . $count;
                     $limit_clause = ' ROWNUM <= ' . $count;
                     break;
                     
@@ -481,21 +414,12 @@ class Database extends functions
             ' ' . $limit_clause;
 
         if ($_SESSION['config']['databasetype'] == 'ORACLE') {
-            /*$query = 'SELECT' .
-                ' ' . $select_opts .
-                ' ' . $select_expr .
-                ' FROM ' . $table_refs .
-                ' WHERE ' . $where_def .
-                ' ' . $other_clauses .
-                ' ' . $limit_clause .
-                ' ' . $order_by;*/
             $query = 'SELECT * FROM (SELECT' .
                 ' ' . $select_opts .
                 ' ' . $select_expr .
                 ' FROM ' . $table_refs .
                 ' WHERE ' . $where_def .
                 ' ' . $other_clauses .
-                // ' ' . $limit_clause .
                 ' ' . $order_by .
                 ') WHERE ' . $limit_clause;
         } else {
@@ -527,43 +451,4 @@ class Database extends functions
             default: return ' ';
         }
     }
-
-    /**
-    * Test if the specified column exists in the database
-    *
-    * @param  $table : Name of searched table
-    * @param  $field : Name of searched field in table
-    *  ==Return : true is field is founed, false is not
-    */
-    public function test_column($table, $field)
-    {
-        switch ($this->driver) {
-            case 'pgsql':
-                $stmt = $this->query(
-                    "select column_name from information_schema.columns where table_name = ? and column_name = ?",
-                    array($table, $field)
-                );
-                $res = $stmt->rowCount();
-                if ($res > 0) {
-                    return true;
-                } else {
-                    return false;
-                }
-                // no break
-            case 'oci':
-                $stmt = $this->query(
-                    "SELECT * from USER_TAB_COLUMNS where TABLE_NAME = ? AND COLUMN_NAME = ?",
-                    array($table, $field)
-                );
-                $res = $stmt->rowCount();
-                if ($res > 0) {
-                    return true;
-                } else {
-                    return false;
-                }
-                // no break
-            case 'mysql': return true; // TO DO
-            default: return false;
-        }
-    }
 }
diff --git a/core/class/class_functions.php b/core/class/class_functions.php
index 0940e4595f3..6ce28742490 100755
--- a/core/class/class_functions.php
+++ b/core/class/class_functions.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*    Copyright 2008-2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -46,37 +33,6 @@ class functions
          */
     private $f_page;
 
-    public function normalize($string)
-    {
-        $a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ'
-            . 'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ';
-        $b = 'aaaaaaaceeeeiiiidnoooooouuuuy'
-            . 'bsaaaaaaaceeeeiiiidnoooooouuuyybyRr';
-        $string = utf8_decode($string);
-        $string = strtr($string, utf8_decode($a), $b);
-        $string = strtolower($string);
-
-        return utf8_encode($string);
-    }
-
-    /**
-    * Cuts a string at the maximum number of char to displayed
-    *
-    * @param     $string string String value
-    * @param     $max integer Maximum character number
-    */
-    public function cut_string($string, $max)
-    {
-        if (strlen($string) >= $max) {
-            $string = substr($string, 0, $max);
-            $espace = strrpos($string, " ");
-            $string = substr($string, 0, $espace)."...";
-            return $string;
-        } else {
-            return $string;
-        }
-    }
-
     /**
     * Adds en error to the errors log
     *
@@ -285,74 +241,6 @@ class functions
         return stripslashes($what);
     }
 
-    /**
-    * Manages the location bar in session (4 levels max), then calls the where_am_i() function.
-    *
-    * @param     $path  string Url (empty by default)
-    * @param   $label string Label to show in the location bar (empty by default)
-    * @param   $id_pagestring  Page identifier (empty by default)
-    * @param   $init bool If true reinits the location bar (true by default)
-    * @param   $level string Level in the location bar (empty by default)
-    */
-    public function manage_location_bar($path = '', $label = '', $id_page = '', $init = true, $level = '')
-    {
-        //INIT LOCATION BAR
-        if (empty($_SESSION['location_bar_label'])) {
-            $_SESSION['location_bar_label'][0] = _WELCOME_TITLE;
-            $_SESSION['location_bar_path'][0] = 'index.php?reinit=true';
-        }
-        if (!empty($level)) {
-            //IF USER CLICKED ON LOCATION BAR
-            $arrLocationLabel = [];
-            $arrLocationPath = [];
-            foreach ($_SESSION['location_bar_label'] as $key => $value) {
-                $arrLocationLabel[] = $_SESSION['location_bar_label'][$key];
-                $arrLocationPath[] = $_SESSION['location_bar_path'][$key];
-                if ($key == $level) {
-                    break;
-                }
-            }
-            $_SESSION['location_bar_label'] = $arrLocationLabel;
-            $_SESSION['location_bar_path'] = $arrLocationPath;
-        } elseif (count($_SESSION['location_bar_label'])==4 && $_SESSION['location_bar_label'][count($_SESSION['location_bar_label'])-1] != $label) {
-            //ERASE BEGIN OF LOCATION BAR IF TOO MUCH ITEMS
-            array_shift($_SESSION['location_bar_label']);
-            array_shift($_SESSION['location_bar_path']);
-
-            $_SESSION['location_bar_label'][0] = _WELCOME_TITLE;
-            $_SESSION['location_bar_path'][0] = 'index.php?reinit=true';
-        }
-        
-        //ADD NEW LOCATION
-        if ($_SESSION['location_bar_label'][count($_SESSION['location_bar_label'])-1] != $label) {
-            $_SESSION['location_bar_label'][] = $label;
-            $_SESSION['location_bar_path'][] = $path;
-        }
-
-        //WRITE LOCATION BAR
-        foreach ($_SESSION['location_bar_label'] as $key => $value) {
-            ?>
-<script type="text/javascript">
-    writeLocationBar('<?php echo $_SESSION['location_bar_path'][$key]; ?>', '<?php echo $value; ?>', '<?php echo $key; ?>');
-</script><?php
-        }
-    }
-
-
-    /**
-    * For debug, displays an array in a more readable way
-    *
-    * @param   $arr array Array to display
-    */
-    public function show_array($arr)
-    {
-        echo "<table width=\"550\"><tr><td align=\"left\">";
-        echo "<pre>";
-        print_r($arr);
-        echo "</pre>";
-        echo "</td></tr></table>";
-    }
-
     /**
     * Formats a datetime to a dd/mm/yyyy format (date)
     *
@@ -375,46 +263,6 @@ class functions
         return $last_date;
     }
 
-    /**
-    * Formats a datetime to a dd/mm/yyyy hh:ii:ss format (timestamp)
-    *
-    * @param   $date  datetime The date to format
-    * @return   datetime  The formatted date
-    */
-    public function dateformat($realDate, $sep='/')
-    {
-        if ($realDate <> '') {
-            if (preg_match('/ /', $realDate)) {
-                $hasTime = true;
-                $tmpArr = explode(" ", $realDate);
-                $date = $tmpArr[0];
-                $time = $tmpArr[1];
-                if (preg_match('/\./', $time)) {  // POSTGRES date
-                    $tmp = explode('.', $time);
-                    $time = $tmp[0];
-                } elseif (preg_match('/,/', $time)) { // ORACLE date
-                    $tmp = explode(',', $time);
-                    $time = $tmp[0];
-                }
-            } else {
-                $hasTime = false;
-                $date = $realDate;
-            }
-            if (preg_match('/-/', $date)) {
-                $dateArr = explode("-", $date);
-            } elseif (preg_match('@\/@', $date)) {
-                $dateArr = explode("/", $date);
-            }
-            if (! $hasTime || substr($tmpArr[1], 0, 2) == "00") {
-                return $dateArr[2] . $sep . $dateArr[1] . $sep . $dateArr[0];
-            } else {
-                return $dateArr[2] . $sep . $dateArr[1] . $sep . $dateArr[0]
-                    . " " . $time;
-            }
-        }
-        return '';
-    }
-
     /**
     * Returns a formated date for SQL queries
     *
@@ -645,27 +493,6 @@ class functions
         return $result;
     }
 
-    /**
-    *  Compares to date and return dif between 2 dates
-    *
-    * @param  $date1 date First date
-    * @param  $date2 date Second date
-    * @return dif between 2 dates in days
-    */
-    public function nbDaysBetween2Dates($date1, $date2)
-    {
-        $date1 = strtotime($date1);
-        $date2 = strtotime($date2);
-        if ($date2 > $date1) {
-            $result = round((($date2 - $date1) / (3600)) / 24, 0);
-        } elseif ($date2 < $date1) {
-            $result = round((($date1 - $date2) / (3600)) / 24, 0);
-        } else {
-            $result = 0;
-        }
-        return $result;
-    }
-
     /**
     *  Checks if a directory is empty
     *
diff --git a/core/class/class_history.php b/core/class/class_history.php
index 537a92538ac..126aadc6f5e 100755
--- a/core/class/class_history.php
+++ b/core/class/class_history.php
@@ -189,29 +189,6 @@ class history
         }
     }
 
-    /**
-    * Gets the label of an history keyword
-    *
-    * @param  $id
-    *
-    * @return  string => Label of the key word or empty string
-    */
-    public function get_label_history_keyword(
-        $id
-    ) {
-        if (empty($id)) {
-            return '';
-        } else {
-            for ($i=0; $i<count($_SESSION['history_keywords']); $i++) {
-                if ($id == $_SESSION['history_keywords'][$i]['id']) {
-                    return $_SESSION['history_keywords'][$i]['label'];
-                }
-            }
-        }
-
-        return '';
-    }
-
     /**
     * Delete accents
     *
diff --git a/core/class/class_manage_status.php b/core/class/class_manage_status.php
deleted file mode 100755
index 79251d29e34..00000000000
--- a/core/class/class_manage_status.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/**
-* Core class for status
-*
-*  Contains all the functions to manage status
-*
-* @package  maarch
-* @version 3.0
-* @since 10/2005
-* @license GPL v3
-* @author  Claire Figueras  <dev@maarch.org>
-*
-*/
-
-class manage_status extends Database
-{
-	public $statusArr;
-
-	function __construct()
-	{
-		parent::__construct();
-		$this->statusArr = array();
-		$this->get_status_data_array();
-	}
-
-	public function get_searchable_status()
-	{
-		$status = array();
-		$stmt = $this->query("select id, label_status from "
-			. $_SESSION['tablename']['status'] 
-			. " where can_be_searched = 'Y'");
-		while($res = $stmt->fetchObject())
-		{
-			array_push($status, array('ID' => $res->id, 'LABEL' => $res->label_status));
-		}
-		return $status;
-	}
-
-	public function get_not_searchable_status()
-	{
-		$status = array();
-		$stmt = $this->query("select id, label_status from " 
-			. $_SESSION['tablename']['status'] 
-			. " where can_be_searched = 'N'");
-		while($res = $stmt->fetchObject())
-		{
-			array_push($status, array('ID' => $res->id, 'LABEL' => $res->label_status));
-		}
-		return $status;
-	}
-	
-	public function get_status_data_array()
-	{
-		$stmt = $this->query("select * from ".$_SESSION['tablename']['status']."");
-		while($res = $stmt->fetchObject())
-		{
-			$id_status = $res->id;
-			$status_txt = $this->show_string($res->label_status);
-			$maarch_module = $res->maarch_module;
-			$img_name = $res->img_filename;
-			if(!empty($img_name))
-			{
-				//For big
-				$big_temp_explode = explode( ".", $img_name);
-				$big_temp_explode[0] = $big_temp_explode[0]."_big";
-				$big_img_name = implode(".", $big_temp_explode);
-			}
-			if($maarch_module == 'apps' && isset($img_name) && !empty($img_name))
-			{
-				$img_path = $_SESSION['config']['businessappurl'].'static.php?filename='.$img_name;
-				$big_img_path = $_SESSION['config']['businessappurl'].'static.php?filename='.$big_img_name;
-			}
-			else if(!empty($maarch_module) && isset($maarch_module)&& isset($img_name) && !empty($img_name))
-			{
-				$img_path = $_SESSION['config']['businessappurl'].'static.php?filename='.$img_name."&module=".$maarch_module;
-				$big_img_path = $_SESSION['config']['businessappurl'].'static.php?filename='.$big_img_name."&module=".$maarch_module;
-			}
-			else
-			{
-				$img_path = $_SESSION['config']['businessappurl'].'static.php?filename=default_status.gif';
-				$big_img_path = $_SESSION['config']['businessappurl'].'static.php?filename=default_status_big.gif';
-			}
-			if(empty($status_txt) || !isset($status_txt))
-			{
-				$status_txt = $id_status;
-			}
-			$img_path = $img_name;
-			$big_img_path = $img_name;
-			array_push($this->statusArr, array('ID' => $id_status, 'LABEL' => $status_txt, 'IMG_SRC' => $img_path , 'IMG_SRC_BIG' => $big_img_path));
-		}
-	}
-	
-	public function get_status_data($id_status, $extension = '')
-	{
-		for($cptStatusArr=0;$cptStatusArr<count($this->statusArr);$cptStatusArr++)
-		{
-			if($id_status == $this->statusArr[$cptStatusArr]['ID'])
-			{
-				$status_txt = $this->statusArr[$cptStatusArr]['LABEL'];
-				if ($extension == "_big")
-					$img_path = $this->statusArr[$cptStatusArr]['IMG_SRC_BIG'];
-				else
-					$img_path = $this->statusArr[$cptStatusArr]['IMG_SRC'];
-			}
-		}
-		return array('ID'=> $id_status, 'LABEL'=> $status_txt, 'IMG_SRC' => $img_path);
-	}
-
-	public function can_be_modified($id_status)
-	{
-		$stmt = $this->query("select can_be_modified from " 
-			. $_SESSION['tablename']['status'] 
-			. " where id = ?", array($id_status));
-		if($stmt->rowCount() == 0)
-		{
-			return false;
-		}
-		$res = $stmt->fetchObject();
-		if($res->can_be_modified == 'N')
-		{
-			return false;
-		}
-		return true;
-	}
-}
diff --git a/core/class/class_portal.php b/core/class/class_portal.php
index 30fd0037e38..b80e0704dd9 100755
--- a/core/class/class_portal.php
+++ b/core/class/class_portal.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*   Copyright 2008-2012 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -40,16 +27,16 @@ class portal extends functions
     /**
     * Loads Maarch portal configuration into sessions  from an xml configuration file (core/xml/config.xml)
     */
-    public function build_config() {
-        if(!file_exists(dirname(__FILE__) . '/../xml/config.xml')) {
+    public function build_config()
+    {
+        if (!file_exists(dirname(__FILE__) . '/../xml/config.xml')) {
             $this->createXmlCoreConfig();
         }
         $xmlconfig = simplexml_load_file(
             dirname(__FILE__) . '/../xml/config.xml'
         );
-        foreach($xmlconfig->CONFIG as $CONFIG) {
-            $_SESSION['config']['defaultlang'] = (string) $CONFIG->defaultlanguage;
-            if(isset($CONFIG->default_timezone) && !empty($CONFIG->default_timezone)) {
+        foreach ($xmlconfig->CONFIG as $CONFIG) {
+            if (isset($CONFIG->default_timezone) && !empty($CONFIG->default_timezone)) {
                 $_SESSION['config']['default_timezone'] = (string) $CONFIG->default_timezone;
             } else {
                 $_SESSION['config']['default_timezone'] = 'Europe/Paris';
@@ -62,7 +49,7 @@ class portal extends functions
         $_SESSION['config']['defaultpage'] = $corePath . 'index.php';
         $_SESSION['config']['coreurl'] = str_replace('rest/', '', Url::coreurl());
         $i=0;
-        foreach($xmlconfig->BUSINESSAPPS as $BUSINESSAPPS) {
+        foreach ($xmlconfig->BUSINESSAPPS as $BUSINESSAPPS) {
             $_SESSION['businessapps'][$i] = array("appid" => (string) $BUSINESSAPPS->appid, "comment" => (string) $BUSINESSAPPS->comment);
             $i++;
         }
@@ -71,7 +58,8 @@ class portal extends functions
     /**
     * Unset session variabless
     */
-    public function unset_session() {
+    public function unset_session()
+    {
         unset($_SESSION['config']);
         unset($_SESSION['businessapps']);
     }
@@ -82,9 +70,9 @@ class portal extends functions
     private function createXmlCoreConfig()
     {
         if (!copy(
-                dirname(__FILE__) . '/../xml/config.xml.default', 
-                dirname(__FILE__) . '/../xml/config.xml'
-            )
+            dirname(__FILE__) . '/../xml/config.xml.default',
+            dirname(__FILE__) . '/../xml/config.xml'
+        )
         ) {
             echo 'ERROR WITH CREATION OF XML CORE CONFIG FILE IN ' .
                 dirname(__FILE__) . '/../xml/config.xml';
diff --git a/core/class/class_request.php b/core/class/class_request.php
index e8ff048753e..0306dba4452 100755
--- a/core/class/class_request.php
+++ b/core/class/class_request.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*    Copyright 2008,2009 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -38,170 +25,6 @@ require_once 'core/class/class_db.php';
 */
 class request extends dbquery
 {
-
-    /**
-    * Constructs the select query and returns the results in an array
-    *
-    * @param  $select array Query fields
-    * @param  $where  string Where clause of the query
-    * @param  $parameters  array An indexed or associative array of parameters
-    * @param  $other  string Query complement (order by, ...)
-    * @param  $database_type string Type of the database
-    * @param  $limit string Maximum numbers of results (500 by default)
-    * @param  $left_join boolean Is the request is a left join ? (false by default)
-    * @param  $first_join_table string Name of the first join table (empty by default)
-    * @param  $second_join_table string Name of the second join table (empty by default)
-    * @param  $join_key string  Key of the join (empty by default)
-    * @param  $add_security string  Add the user security where clause or not (true by default)
-    * @param  $distinct_argument  Add the distinct parameters in the sql query (false by default)
-    * @return array Results of the built query
-    */
-    public function PDOselect($select, $where, $parameters = null, $other, $database_type, $limit="default", $left_join=false, $first_join_table="", $second_join_table="", $join_key="", $add_security = true, $catch_error = false, $distinct_argument = false, $start = 0)
-    {
-        $db = new Database();
-        if ($limit == 0 || $limit == "default") {
-            $limit = $_SESSION['config']['nblinetoshow'];
-        }
-      
-        //Extracts data in the first argument : $select.
-        $tab_field = array();
-        $table = '';
-        $table_string = '';
-        $field_string = '';
-        foreach (array_keys($select) as $value) {
-            $table = $value;
-            $table_string .= $table.",";
-            foreach ($select[$value] as $subvalue) {
-                $field = $subvalue;
-
-                $field_string .= $table.".".$field.",";
-
-                //fix order by alt_identifier
-                if ($field == 'alt_identifier') {
-                    $field_string .= "order_alphanum(alt_identifier),";
-                }
-            }
-            //Query fields and table names have been wrote in 2 strings
-        }
-        //Strings need to be cleaned
-        $table_string = substr($table_string, 0, -1);
-        $field_string = substr($field_string, 0, -1);
-
-        //Extracts data from the second argument : the where clause
-        if (trim($where) <> "") {
-            $where_string = $where;
-            //$where_string = " where ".$where;
-        } else {
-            $where_string = "";
-        }
-        $join = '';
-        if ($left_join) {
-            //Reste table string
-            $table_string = "";
-
-            //Add more table in join syntax
-            foreach (array_keys($select) as $value) {
-                if ($value <> $first_join_table && $value <> $second_join_table) {
-                    $table_string = $value.",";
-                }
-            }
-
-            $join = " left join ";
-            $table_string .= $first_join_table;
-            $join .= $second_join_table." on ".$second_join_table.".".$join_key." = ".$first_join_table.".".$join_key;
-        }
-
-        if ($add_security) {
-            foreach (array_keys($_SESSION['user']['security']) as $coll) {
-                if (isset($_SESSION['user']['security'][$coll]['DOC']['table'])) {
-                    if (preg_match('/'.$_SESSION['user']['security'][$coll]['DOC']['table'].'/', $table_string) || preg_match('/'.$_SESSION['user']['security'][$coll]['DOC']['view'].'/', $table_string)) {
-                        if (empty($where_string)) {
-                            $where_string = "( ".$_SESSION['user']['security'][$coll]['DOC']['where']." ) ";
-                            //$where_string = " where ( ".$_SESSION['user']['security'][$coll]['DOC']['where']." ) ";
-                        } else {
-
-                            $whereFolders = "select res_id
-from resources_folders
-     left join folders on resources_folders.folder_id = folders.id
-where
-    folders.id in (
-        select folders.id
-        from folders
-        left join users on folders.user_id = users.id
-        where users.user_id = :user_id_folders
-    ) or folders.id in (
-        select entities_folders.folder_id
-        from entities_folders
-            left join entities on entities_folders.entity_id = entities.id
-            left join users_entities on entities.entity_id = users_entities.entity_id
-        where users_entities.user_id = :user_id_folders OR entities_folders.keyword = 'ALL_ENTITIES'
-    )";
-
-                            $whereFollowed = "select res_id from users_followed_resources where user_id = :user_id_followed";
-
-                            $user = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id']]);
-
-                            $where_string = ''.$where_string." and ( ".$_SESSION['user']['security'][$coll]['DOC']['where']." or res_id in (".$whereFolders.") or res_id in (".$whereFollowed.")) ";
-                            $parameters = array_merge($parameters, [
-                                "user_id_folders"  => $_SESSION['user']['UserId'],
-                                "user_id_followed" => $user['id']
-                            ]);
-
-                        }
-                        break;
-                    }
-                }
-            }
-        }
-        //Time to create the SQL Query
-        $dist = '';
-        if ($distinct_argument == true) {
-            $dist = " distinct ";
-        }
-        //LIMIT 100
-        $query = $db->limit_select($start, 500, $field_string, $table_string." ".$join, $where_string, $other, $dist);
-
-        if (preg_match('/_view/i', $query)) {
-            $_SESSION['last_select_query'] = $query;
-            $_SESSION['last_select_query_parameters'] = $parameters;
-        }
-
-        $res_query = $db->query($query, $parameters, $catch_error);
-
-        if ($catch_error && !$res_query) {
-            return false;
-        }
-        $result=array();
-        $i = 0;
-        while ($line = $res_query->fetch(PDO::FETCH_ASSOC)) {
-            if ($i >= $limit) {
-                break;
-            }
-            $temp= array();
-            foreach (array_keys($line) as $resval) {
-                if ($resval == '__full_count') {
-                    $_SESSION['save_list']['full_count'] = $line[$resval];
-                } else if (!is_int($resval)) {
-                    array_push(
-                        $temp,
-                        array(
-                            'column'=>$resval,
-                            'value'=>functions::xssafe($line[$resval]),
-                        )
-                    );
-                }
-            }
-            array_push($result, $temp);
-            ++$i;
-        }
-        if (count($result) == 0 && $catch_error) {
-            return true;
-        } else if (count($result) == 0) {
-            $_SESSION['save_list']['full_count'] = 0;
-        }
-        return $result;
-    }
-
     /**
     * Builds the insert query and sends it to the database
     *
@@ -231,127 +54,9 @@ where
         $value_string .= ")";
         $field_string .= ")";
 
-        //Time to create the SQL Query
         $query = "INSERT INTO " . $table . " " . $field_string . " VALUES " . $value_string;
-        /*echo $query . PHP_EOL;
-        var_dump($parameters);exit;*/
         $stmt = $db->query($query, $parameters);
 
         return true;
     }
-
-    /**
-    * Constructs the update query and sends it to the database with PDO
-    *
-    * @param  $table string Table to update
-    * @param  $data array Data to update
-    * @param  $where string Where clause of the query
-    * @param  $parameters array An indexed or associative array of parameters
-    * @param  $databasetype array Type of the database
-    */
-
-    public function PDOupdate($table, $data, $where, $parametersInit = null, $databasetype)
-    {
-        $db = new Database();
-        $update_string = "";
-        $parameters = array();
-        for ($i=0; $i < count($data);$i++) {
-            if ($data[$i]['type'] == "string" || $data[$i]['type'] == "date") {
-                if ($databasetype == "POSTGRESQL" && $data[$i]['type'] == "date"
-                    && ($data[$i]['value'] == '' || $data[$i]['value'] == ' ')) {
-                    $update_string .= $data[$i]['column']."=NULL,";
-                } else {
-                    if (trim(strtoupper($data[$i]['value'])) == "SYSDATE") {
-                        $update_string .= $data[$i]['column']."=sysdate,";
-                    } elseif (trim(strtoupper($data[$i]['value'])) == "CURRENT_TIMESTAMP") {
-                        $update_string .= $data[$i]['column']."=CURRENT_TIMESTAMP,";
-                    } else {
-                        $update_string .= $data[$i]['column']."=?,";
-                        $parameters[] = $data[$i]['value'];
-                    }
-                }
-            } else {
-                if ($data[$i]['value'] == 'NULL') {
-                    $update_string .= $data[$i]['column']."=NULL,";
-                } else {
-                    $update_string .= $data[$i]['column']."=?,";
-                    $parameters[] = $data[$i]['value'];
-                }
-            }
-        }
-        $update_string = substr($update_string, 0, -1);
-        if ($where <> "") {
-            $where_string = " WHERE " . $where;
-        } else {
-            $where_string = "";
-        }
-        if (is_array($parametersInit)) {
-            for ($cpt=0;$cpt<count($parametersInit);$cpt++) {
-                $parameters[] = $parametersInit[$cpt];
-            }
-        }
-        //Time to create the SQL Query
-        $query = "";
-        $query = "UPDATE " . $table . " SET " . $update_string . $where_string;
-        /*echo $query . '<br/>';
-        echo '<pre>';
-        var_dump($parameters);
-        echo '</pre>';*/
-        $stmt = $db->query($query, $parameters);
-        return $stmt;
-    }
-
-        /*************************************************************************
-    * Returns instruction to get date or part of the date
-    *
-    * Parameters
-    *   (string) date string
-    *   (string) date part name {year | month | day | hour | minute | second}
-    *
-    * Return
-    *   (string) date instruction
-    *
-    *************************************************************************/
-    public function extract_date($date_field, $arg = '')
-    {
-        switch ($_SESSION['config']['databasetype']) {
-        case "SQLSERVER":
-            return '';
-        
-        case "MYSQL":
-            switch ($arg) {
-            case 'year'     : return ' date_format('.$date_field.', %Y)';
-            case 'month'    : return ' date_format('.$date_field.', %m)';
-            case 'day'      : return ' date_format('.$date_field.', %d)';
-            case 'hour'     : return ' date_format('.$date_field.', %k)';
-            case 'minute'   : return ' date_format('.$date_field.', %i)';
-            case 'second'   : return ' date_format('.$date_field.', %s)';
-            default         : return ' date('.$date_field.')';
-            }
-        
-        case "POSTGRESQL":
-            switch ($arg) {
-            case 'year'     : return " date_part( 'year', ".$date_field.")";
-            case 'month'    : return " date_part( 'month', ".$date_field.")";
-            case 'day'      : return " date_part( 'day', ".$date_field.")";
-            case 'hour'     : return " date_part( 'hour', ".$date_field.")";
-            case 'minute'   : return " date_part( 'minute', ".$date_field.")";
-            case 'second'   : return " date_part( 'second', ".$date_field.")";
-            default         : return ' date('.$date_field.')';
-            }
-        
-        case "ORACLE":
-            switch ($arg) {
-            case 'year'     : return " to_char(".$date_field.", 'YYYY')";
-            case 'month'    : return " to_char(".$date_field.", 'MM')";
-            case 'day'      : return " to_char(".$date_field.", 'DD')";
-            case 'hour'     : return " to_char(".$date_field.", 'HH24')";
-            case 'minute'   : return " to_char(".$date_field.", 'MI')";
-            case 'second'   : return " to_char(".$date_field.", 'SS')";
-            //default         : return " to_char(".$date_field.", 'DD/MM/YYYY')";
-            default         : return $date_field;
-            }
-    
-        }
-    }
 }
diff --git a/core/class/class_resource.php b/core/class/class_resource.php
index 14a2134380d..bf184c64bb3 100755
--- a/core/class/class_resource.php
+++ b/core/class/class_resource.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*    Copyright 2008,2009 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -43,288 +30,110 @@
     * Resource identifier
     * Integer
     */
-    private $res_id;
-
-
-    /**
-    * Type identifier of the resource
-    * String
-    */
-    private $type_id;
-
-    /**
-    * Person who inserts the resource in the application
-    * String
-    */
-    private $typist;
-
-    /**
-    * File format of the resource
-    * String
-    */
-    private $format;
-
-    /**
-    * Docserver identifier of the resource
-    * String
-    */
-    private $docserver_id;
-
-    /**
-    * Path of the resource in the docserver
-    * String
-    */
-    private $path;
-
-    /**
-    * Fingerprint of the resource
-    * String
-    */
-    private $fingerprint;
-
-    /**
-    * File name of the resource
-    * String
-    */
-    private $filename;
-
-    /**
-    * File Size of the resource
-    * Integer
-    */
-    private $filesize;
-
-    /**
-    * Offset
-    * Integer
-    */
-    private $offset;
-
-    /**
-    * Logical address
-    * Integer
-    */
-    private $log_adr;
-
-    /**
-    * Status of the resource
-    * String
-    */
-    private $status;
-
-    /**
-    * Error message
-    * String
-    */
-    private $error;
-
-    /**
-    * Inserts the Resource Object data into the data base
-    *
-    * @param  $table_res string Resource table where to insert
-    * @param  $path  string Resource path in the docserver
-    * @param  $filename string Resource file name
-    * @param  $docserver_path  string Docserver path
-    * @param  $docserver_id  string Docserver identifier
-    * @param  $data  array Data array
-    * @param  $databasetype string Type of the db (MYSQL, SQLSERVER, ...)
-    */
-    public function load_into_db($table_res, $path, $filename, $docserver_path, $docserver_id, $data, $databasetype, $calledByWs=false)
-    {
-        $filetmp = $docserver_path;
-        $tmp = $path;
-        $tmp = str_replace('#', DIRECTORY_SEPARATOR, $tmp);
-        $filetmp .= $tmp;
-        $filetmp .= $filename;
-        $db = new Database();
-        require_once 'core/class/docservers_controler.php';
-        require_once 'core/class/docserver_types_controler.php';
-        require_once 'core/docservers_tools.php';
-        $docserverControler = new docservers_controler();
-        $docserverTypeControler = new docserver_types_controler();
-        $docserver = $docserverControler->get($docserver_id);
-        $docserverTypeObject = $docserverTypeControler->get($docserver->docserver_type_id);
-        $fingerprint = Ds_doFingerprint($filetmp, $docserverTypeObject->fingerprint_mode);
-        $filesize = filesize($filetmp);
-        array_push($data, array('column' => "fingerprint", 'value' => $fingerprint, 'type' => "string"));
-        array_push($data, array('column' => "filesize", 'value' => $filesize, 'type' => "int"));
-        array_push($data, array('column' => "path", 'value' => $path, 'type' => "string"));
-        array_push($data, array('column' => "filename", 'value' => $filename, 'type' => "string"));
-        array_push($data, array('column' => 'creation_date', 'value' => $db->current_datetime(), 'type' => "function"));
-        if (!$this->check_basic_fields($data)) {
-            $_SESSION['error'] = $this->error;
-            functions::xecho($this->error);
-            return false;
-        } else {
-            if (!$this->insert($table_res, $data, $_SESSION['config']['databasetype'])) {
-                if (!$calledByWs) {
-                    $this->error = _INDEXING_INSERT_ERROR."<br/>".$this->show();
-                }
-                return false;
-            } else {
-                $db2 = new Database();
-                $stmt = $db2->query(
-                    "select res_id from " . $table_res
-                        . " where docserver_id = ? and path = ? and filename= ?  order by res_id desc ",
-                    array(
-                        $docserver_id,
-                        $path,
-                        $filename
-                    )
-                );
-                $res = $stmt->fetchObject();
-                if ($table_res == 'res_letterbox') {
-                    require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php");
-                    $hist = new history();
-                    $hist->add(
-                        $table_res,
-                        $res->res_id, 'ADD', 'resadd',
-                        _DOC_CREATED, $_SESSION['config']['databasetype'], 'apps');
-                }
-
-                return $res->res_id;
-            }
-        }
-    }
-
-
-    /**
-    * Gets the error message of the resource object
-    *
-    * @return string Error message of the resource object
-    */
-    public function get_error()
-    {
-        return $this->error;
-    }
-
-    /**
-    * Checks the mininum fields required for an insert into the database
-    *
-    * @param  $data array Array of the fields to insert into the database
-    * @return bool True if all the fields are ok, False otherwise
-         */
-    private function check_basic_fields($data)
-    {
-        $error = '';
-        $db = new Database();
-        $find_format = false;
-        $find_typist = false;
-        $find_creation_date = false;
-        $find_docserver_id = false;
-        $find_path = false;
-        $find_filename = false;
-        $find_fingerprint = false;
-        $find_filesize = false;
-        $find_status = false;
-
-        foreach ($data as $value) {
-            if ($value['column'] == 'format') {
-                $find_format = true;
-                // must be tested in the file_index.php file (module = indexing_searching)
-            } elseif ($value['column'] == 'typist') {
-                $find_typist = true;
-            } elseif ($value['column'] == 'creation_date') {
-                $find_creation_date = true;
-                if ($value['value'] <> $db->current_datetime()) {
-                    $error .= _CREATION_DATE_ERROR.'<br/>';
-                }
-            } elseif ($value['column'] == 'docserver_id') {
-                $find_docserver_id =  true;
-                $db = new Database();
-                if (!$db->query("select docserver_id from ".$_SESSION['tablename']['docservers']." where docserver_id = ?", array($value['value']))) {
-                    $error .= _DOCSERVER_ID_ERROR.'<br/>';
-                }
-            } elseif ($value['column'] == 'path') {
-                $find_path = true;
-                if (empty($value['value'])) {
-                    $error .= _PATH_ERROR.'<br/>';
-                }
-            } elseif ($value['column'] == 'filename') {
-                $find_filename = true;
-                if (!preg_match("/^[\w\-.]+.([a-zA-Z-0-9][a-zA-Z-0-9][a-zA-Z-0-9][a-zA-Z-0-9]?|maarch)$/", $value['value'])) {
-                    $error .= _FILENAME_ERROR . ' ' . $value['value'] . '<br/>';
-                }
-            } elseif ($value['column'] == 'fingerprint') {
-                $find_fingerprint  = true;
-                if (!preg_match("/^[0-9A-Fa-f]+$/", $value['value'])) {
-                    $error .= _FINGERPRINT_ERROR.'<br/>';
-                }
-            } elseif ($value['column'] == 'filesize') {
-                $find_filesize = true;
-                if ($value['value'] <= 0) {
-                    $error .= _FILESIZE_ERROR.'<br/>';
-                }
-            } elseif ($value['column'] == 'status') {
-                $find_status = true;
-            }
-        }
-
-        if ($find_format == false) {
-            $error .= _MISSING_FORMAT.'<br/>';
-        }
-        if ($find_typist == false) {
-            $error .= _MISSING_TYPIST.'<br/>';
-        }
-        if ($find_creation_date == false) {
-            $error .= _MISSING_CREATION_DATE.'<br/>';
-        }
-        if ($find_docserver_id == false) {
-            $error .= _MISSING_DOCSERVER_ID.'<br/>';
-        }
-        if ($find_path == false) {
-            $error .= _MISSING_PATH.'<br/>';
-        }
-        if ($find_filename == false) {
-            $error .= _MISSING_FILENAME.'<br/>';
-        }
-        if ($find_fingerprint == false) {
-            $error .= _MISSING_FINGERPRINT.'<br/>';
-        }
-        if ($find_filesize == false) {
-            $error .= _MISSING_FILESIZE.'<br/>';
-        }
-        if ($find_status == false) {
-            $error .= _MISSING_STATUS.'<br/>';
-        }
-
-        $this->error = $error;
-        if (!empty($error)) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-    * get the adr of the document
-    *
-    * @param $view resource view
-    * @param $resId resource ID
-    * @param $whereClause security clause
-    * @return array of adr fields if is ok
-    */
-    public function getResourceAdr($view, $resId, $whereClause, $adrTable)
-    {
-        $control = array();
-        if (!isset($view) || empty($resId) || empty($whereClause)) {
-            $control = array("status" => "ko", "error" => _PB_WITH_ARGUMENTS);
-            return $control;
-        }
-        $docserverAdr = array();
-        $db = new Database();
-        $query = "select res_id, docserver_id, path, filename, format, fingerprint from " . $view
-            . " where res_id = ? ". $whereClause;
-        $stmt = $db->query($query, array($resId));
-        if ($stmt->rowCount() > 0) {
-            $line = $stmt->fetchObject();
-            $format = $line->format;
-            array_push($docserverAdr, array("docserver_id" => $line->docserver_id, "path" => $line->path, "filename" => $line->filename, "format" => $format, "fingerprint" => $line->fingerprint, "adr_priority" => ""));
-            $control = array("status" => "ok", $docserverAdr, "error" => "");
-            return $control;
-        } else {
-            $control = array("status" => "ko", "error" => _RESOURCE_NOT_FOUND);
-            return $control;
-        }
-    }
+     private $res_id;
+
+
+     /**
+      * Type identifier of the resource
+      * String
+      */
+     private $type_id;
+
+     /**
+      * Person who inserts the resource in the application
+      * String
+      */
+     private $typist;
+
+     /**
+      * File format of the resource
+      * String
+      */
+     private $format;
+
+     /**
+      * Docserver identifier of the resource
+      * String
+      */
+     private $docserver_id;
+
+     /**
+      * Path of the resource in the docserver
+      * String
+      */
+     private $path;
+
+     /**
+      * Fingerprint of the resource
+      * String
+      */
+     private $fingerprint;
+
+     /**
+      * File name of the resource
+      * String
+      */
+     private $filename;
+
+     /**
+      * File Size of the resource
+      * Integer
+      */
+     private $filesize;
+
+     /**
+      * Offset
+      * Integer
+      */
+     private $offset;
+
+     /**
+      * Logical address
+      * Integer
+      */
+     private $log_adr;
+
+     /**
+      * Status of the resource
+      * String
+      */
+     private $status;
+
+     /**
+      * Error message
+      * String
+      */
+     private $error;
+
+     /**
+     * get the adr of the document
+     *
+     * @param $view resource view
+     * @param $resId resource ID
+     * @param $whereClause security clause
+     * @return array of adr fields if is ok
+     */
+     public function getResourceAdr($view, $resId, $whereClause, $adrTable)
+     {
+         $control = array();
+         if (!isset($view) || empty($resId) || empty($whereClause)) {
+             $control = array("status" => "ko", "error" => _PB_WITH_ARGUMENTS);
+             return $control;
+         }
+         $docserverAdr = array();
+         $db = new Database();
+         $query = "select res_id, docserver_id, path, filename, format, fingerprint from " . $view
+           . " where res_id = ? ". $whereClause;
+         $stmt = $db->query($query, array($resId));
+         if ($stmt->rowCount() > 0) {
+             $line = $stmt->fetchObject();
+             $format = $line->format;
+             array_push($docserverAdr, array("docserver_id" => $line->docserver_id, "path" => $line->path, "filename" => $line->filename, "format" => $format, "fingerprint" => $line->fingerprint, "adr_priority" => ""));
+             $control = array("status" => "ok", $docserverAdr, "error" => "");
+             return $control;
+         } else {
+             $control = array("status" => "ko", "error" => _RESOURCE_NOT_FOUND);
+             return $control;
+         }
+     }
  }
diff --git a/core/class/class_security.php b/core/class/class_security.php
index 42ebfcb51f2..85ff2b9781f 100755
--- a/core/class/class_security.php
+++ b/core/class/class_security.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*    Copyright 2008-2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -42,265 +29,8 @@
  * @ingroup core
  */
 
-//Requires to launch history functions
-require_once 'core/class/class_db_pdo.php';
-require_once 'core/class/class_history.php';
-require_once 'core/class/SecurityControler.php';
-require_once 'core/class/class_core_tools.php';
-require_once 'core/class/users_controler.php';
-if (isset($_SESSION['config']['app_id'])) {
-    require_once 'apps/'.$_SESSION['config']['app_id']
-        .'/class/class_business_app_tools.php';
-}
-require_once 'core/class/usergroups_controler.php';
-require_once 'core/class/ServiceControler.php';
-
-$core = new core_tools();
-$core->load_lang();
-
 class security extends Database
 {
-    /**
-     * Gets the indice of the collection in the  $_SESSION['collections'] array.
-     *
-     * @param  $coll_id string  Collection identifier
-     *
-     * @return int Indice of the collection in the $_SESSION['collections'] or -1 if not found
-     */
-    public function get_ind_collection($coll_id)
-    {
-        for ($i = 0; $i < count($_SESSION['collections']); ++$i) {
-            if (trim($_SESSION['collections'][$i]['id']) == trim($coll_id)) {
-                return $i;
-            }
-        }
-
-        return -1;
-    }
-
-    /**
-     * Logs a user.
-     *
-     * @param  $s_login  string User login
-     * @param  $pass string User password
-     */
-    public function login($s_login, $pass, $method = false, $standardConnect = 'false')
-    {
-        $array = array();
-        $error = '';
-        $uc = new users_controler();
-
-        $s_login = str_replace('\'', '', $s_login);
-        $s_login = str_replace('=', '', $s_login);
-        $s_login = str_replace('"', '', $s_login);
-        $s_login = str_replace('*', '', $s_login);
-        $s_login = str_replace(';', '', $s_login);
-        $s_login = str_replace('--', '', $s_login);
-        $s_login = str_replace(',', '', $s_login);
-        $s_login = str_replace('$', '', $s_login);
-        $s_login = str_replace('>', '', $s_login);
-        $s_login = str_replace('<', '', $s_login);
-
-        // #TODO : Not usefull anymore, loginmode field is always in users table
-        //Compatibility test, if loginmode column doesn't exists, Maarch can't crash
-        if ($this->test_column($_SESSION['tablename']['users'], 'loginmode')) {
-            // #TODO : do evolution of the loginmethod in sql query
-            if ($method == 'activex') {
-                $comp = " and STATUS <> 'DEL' and loginmode = 'activex'";
-            } elseif ($method == 'ldap' || $method == 'shibboleth') {
-                $comp = " and STATUS <> 'DEL'";
-                $params = [];
-            } else {
-                $comp = " and STATUS <> 'DEL' "
-                      .'and loginmode in (:loginmode1)';
-                $params = ['loginmode1' => ['standard', 'sso', 'cas', 'keycloak']];
-                if ($method == 'restMode') {
-                    array_push($params['loginmode1'], 'restMode');
-                }
-            }
-        } else {
-            $comp = " and STATUS <> 'DEL'";
-            $params = [];
-        }
-
-        $check = \SrcCore\models\AuthenticationModel::authentication(['login' => $s_login, 'password' => $pass]);
-        if ($check || (in_array($method, ['ldap', 'shibboleth', 'cas', 'sso']) && $standardConnect == 'false')) {
-            $user = $uc->getWithComp($s_login, $comp, $params);
-        }
-
-        if (isset($user)) {
-            if ($user->__get('status') != 'SPD') {
-                \User\models\UserModel::update([
-                    'set'   => ['reset_token' => null],
-                    'where' => ['user_id = ?'],
-                    'data'  => [$s_login]
-                ]);
-                $ugc = new usergroups_controler();
-                $sec_controler = new SecurityControler();
-                $serv_controler = new ServiceControler();
-                if (isset($_SESSION['modules_loaded']['visa'])) {
-                    require_once 'modules'.DIRECTORY_SEPARATOR.'visa'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_user_signatures.php';
-                    $us = new UserSignatures();
-                    $db = new Database();
-                    $query = 'select path_template from '
-                        ._DOCSERVERS_TABLE_NAME
-                        ." where docserver_id = 'TEMPLATES'";
-                    $stmt = $db->query($query);
-                    $resDs = $stmt->fetchObject();
-                    $pathToDs = $resDs->path_template;
-
-                    $tab_sign = $us->getForUser($s_login);
-                    $_SESSION['user']['pathToSignature'] = array();
-                    foreach ($tab_sign as $sign) {
-                        $path = $pathToDs.str_replace(
-                            '#',
-                            DIRECTORY_SEPARATOR,
-                            $sign['signature_path']
-                        )
-                        .$sign['signature_file_name'];
-                        array_push($_SESSION['user']['pathToSignature'], $path);
-                    }
-                }
-                $array = array(
-                    'UserId' => $user->__get('user_id'),
-                    'FirstName' => $user->__get('firstname'),
-                    'LastName' => $user->__get('lastname'),
-                    'Initials' => $user->__get('initials'),
-                    'Phone' => $user->__get('phone'),
-                    'Mail' => $user->__get('mail'),
-                    'department' => $user->__get('department'),
-                    'pathToSignature' => $_SESSION['user']['pathToSignature'],
-                    'Status' => $user->__get('status'),
-                    'cookie_date' => $user->__get('cookie_date')
-                );
-
-                $tmp = $sec_controler->load_security(
-                    $array['UserId']
-                );
-                $array['collections'] = $tmp['collections'];
-                $array['security'] = $tmp['security'];
-                $serv_controler->loadEnabledServices();
-                $business_app_tools = new business_app_tools();
-                $core_tools = new core_tools();
-                $business_app_tools->load_app_var_session($array);
-                $core_tools->load_var_session($_SESSION['modules'], $array);
-
-                /************Temporary fix*************/
-                // #TODO : revoir les functions load_var_session dans class_modules_tools pour ne plus charger en session les infos
-                if (isset($_SESSION['user']['baskets'])) {
-                    $array['baskets'] = $_SESSION['user']['baskets'];
-                }
-                if (isset($_SESSION['user']['entities'])) {
-                    $array['entities'] = $_SESSION['user']['entities'];
-                }
-                if (isset($_SESSION['user']['primaryentity'])) {
-                    $array['primaryentity'] = $_SESSION['user']['primaryentity'];
-                }
-
-                if (isset($_SESSION['user']['redirect_groupbasket'])) {
-                    $array['redirect_groupbasket'] = $_SESSION['user']['redirect_groupbasket'];
-                }
-
-                if (isset($_SESSION['user']['redirect_groupbasket_by_group'])) {
-                    $array['redirect_groupbasket_by_group'] = $_SESSION['user']['redirect_groupbasket_by_group'];
-                }
-                /*************************************/
-                $array['services'] = $serv_controler->loadUserServices(
-                    $array['UserId']
-                );
-
-                if ($_SESSION['history']['userlogin'] == 'true') {
-                    //add new instance in history table for the user's connexion
-                    $hist = new history();
-                    if ($_SERVER['REMOTE_ADDR'] == '::1') {
-                        $ip = 'localhost';
-                    } else {
-                        $ip = $_SERVER['REMOTE_ADDR'];
-                    }
-                    $_SESSION['user']['UserId'] = $s_login;
-                    $_SESSION['user']['department'] = $array['department'];
-                    $hist->add(
-                        $_SESSION['tablename']['users'],
-                        $s_login,
-                        'LOGIN',
-                        'userlogin',
-                        _LOGIN_HISTORY.' '.$s_login.' IP : '.$ip,
-                        $_SESSION['config']['databasetype']
-                    );
-                }
-
-                if (isset($_SESSION['requestUri'])
-                    && trim($_SESSION['requestUri']) != ''
-                    && !preg_match('/page=login/', $_SESSION['requestUri'])) {
-                    return array(
-                        'user' => $array,
-                        'error' => $error,
-                        'url' => 'index.php?'.$_SESSION['requestUri'],
-                    );
-                } else {
-                    return array(
-                        'user' => $array,
-                        'error' => $error,
-                        'url' => 'index.php',
-                    );
-                }
-            } else {
-                $error = _SUSPENDED_ACCOUNT.'. '._MORE_INFOS
-                    .' <a href="mailto:'.$_SESSION['config']['adminmail']
-                    .'">'.$_SESSION['config']['adminname'].'</a>';
-
-                return array(
-                    'user' => $array,
-                    'error' => $error,
-                    'url' => 'index.php',
-                );
-            }
-        } else {
-            if ($standardConnect == 'false') {
-                $error = \SrcCore\controllers\AuthenticationController::handleFailedAuthentication(['userId' => $s_login]);
-            } else {
-                $error = _BAD_LOGIN_OR_PSW;
-            }
-
-            return [
-                'user'  => $array,
-                'error' => $error,
-                'url'   => 'index.php?display=true&page=login'
-            ];
-        }
-    }
-
-    /**
-     * Reopens a session with the user's cookie.
-     *
-     * @param  $s_UserId  string User identifier
-     * @param  $s_key string Cookie key
-     */
-    public function reopen($s_UserId, $s_key)
-    {
-        header('location: '.$_SESSION['config']['businessappurl'].'index.php?display=true&page=login');
-        exit();
-    }
-
-    /******************* COLLECTION MANAGEMENT FUNCTIONS *******************/
-
-    /**
-     * Returns all collections where we can insert new documents (with tables).
-     *
-     * @return array Collections where inserts are allowed
-     */
-    public function retrieve_insert_collections()
-    {
-        $arr = array();
-        for ($i = 0; $i < count($_SESSION['collections']); ++$i) {
-            if (isset($_SESSION['collections'][$i]['table']) && !empty($_SESSION['collections'][$i]['table'])) {
-                array_push($arr, $_SESSION['collections'][$i]);
-            }
-        }
-
-        return $arr;
-    }
-
     /**
      * @param  $textToHash
      *
@@ -311,49 +41,6 @@ class security extends Database
         return password_hash($textToHash, PASSWORD_DEFAULT);
     }
 
-    /**
-     * Returns the collection identifier from a table.
-     *
-     * @param  $table  string Tablename
-     *
-     * @return string Collection identifier or empty string if not found
-     */
-    public function retrieve_coll_id_from_table($table)
-    {
-        for ($i = 0; $i < count($_SESSION['collections']); ++$i) {
-            if (
-                $_SESSION['collections'][$i]['table'] == $table
-                || $_SESSION['collections'][$i]['version_table'] == $table
-            ) {
-                return $_SESSION['collections'][$i]['id'];
-            }
-        }
-
-        return '';
-    }
-
-    /**
-     * Returns the collection version table from a collId.
-     *
-     * @param  $collId string collection ID
-     *
-     * @return string version table or empty string if not found
-     */
-    public function retrieve_version_table_from_coll_id($collId)
-    {
-        if ($collId == 'letterbox_coll') {
-            return '';
-        }
-
-        for ($i = 0; $i < count($_SESSION['collections']); ++$i) {
-            if ($_SESSION['collections'][$i]['id'] == $collId) {
-                return $_SESSION['collections'][$i]['version_table'];
-            }
-        }
-
-        return '';
-    }
-
     /**
      * Returns the view of a collection from the collection identifier.
      *
@@ -371,107 +58,4 @@ class security extends Database
 
         return '';
     }
-
-    /**
-     * Returns the view of a collection from the table of the collection.
-     *
-     * @param string $table Tablename
-     *
-     * @return string View name or empty string if not found
-     */
-    public function retrieve_view_from_table($table)
-    {
-        for ($i = 0; $i < count($_SESSION['collections']); ++$i) {
-            if ($_SESSION['collections'][$i]['table'] == $table) {
-                return $_SESSION['collections'][$i]['view'];
-            }
-        }
-
-        return '';
-    }
-
-    /**
-     * Returns the table of the collection from the collection identifier.
-     *
-     * @param string $coll_id Collection identifier
-     *
-     * @return string Table name or empty string if not found
-     */
-    public function retrieve_table_from_coll($coll_id)
-    {
-        for ($i = 0; $i < count($_SESSION['collections']); ++$i) {
-            if ($_SESSION['collections'][$i]['id'] == $coll_id) {
-                return $_SESSION['collections'][$i]['table'];
-            }
-        }
-
-        return '';
-    }
-
-    /**
-     * Returns where clause of the collection for the current user from the collection identifier.
-     *
-     * @param  $coll_id string Collection identifier
-     *
-     * @return string Collection where clause or empty string if not found or the where clause is empty
-     */
-    public function get_where_clause_from_coll_id($coll_id)
-    {
-        if (isset($_SESSION['user']['security'][$coll_id]['DOC']['where'])) {
-            return $_SESSION['user']['security'][$coll_id]['DOC']['where'];
-        }
-
-        return '';
-    }
-
-    /**
-     * Returns where clause of the collection for the current user from the collection identifier and basket where clause.
-     *
-     * @param  $coll_id string Collection identifier
-     *
-     * @return string Collection where clause
-     */
-    public function get_where_clause_from_coll_id_and_basket($coll_id)
-    {
-        $collectionWhereClause = $this->get_where_clause_from_coll_id($coll_id);
-
-        if (empty($collectionWhereClause)) {
-            $collectionWhereClause = '1=0';
-        }
-
-        $userBaskets = count($_SESSION['user']['baskets']);
-
-        for ($ind_bask = 0; $ind_bask < $userBaskets; ++$ind_bask) {
-            if ($_SESSION['user']['baskets'][$ind_bask]['coll_id'] == $coll_id
-                && isset($_SESSION['user']['baskets'][$ind_bask]['clause'])
-                && trim($_SESSION['user']['baskets'][$ind_bask]['clause']) != '') {
-                $basketWhereClause .= ' or ('.$_SESSION['user']['baskets'][$ind_bask]['clause'].')';
-            }
-        }
-
-        if (empty($basketWhereClause)) {
-            $basketWhereClause = '1=0';
-        } else {
-            $basketWhereClause = preg_replace('/^ or/', '', $basketWhereClause);
-        }
-
-        $whereRequest = '('.$collectionWhereClause.' or '.$basketWhereClause.')';
-
-        return $whereRequest;
-    }
-
-    /**
-     * Checks the right on the document of a collection for the current user.
-     *
-     * @param  $coll_id string Collection identifier
-     * @param  $s_id string Document Identifier (res_id)
-     *
-     * @return bool True if the current user has the right, False otherwise
-     */
-    public function test_right_doc($coll_id, $s_id)
-    {
-        $user = \User\models\UserModel::getByLogin(['login' => $_SESSION['user']['UserId'], 'select' => ['id']]);
-
-        return \Resource\controllers\ResController::hasRightByResId(['resId' => [$s_id], 'userId' => $user['id']]);
-    }
 }
diff --git a/core/class/docserver_types_controler.php b/core/class/docserver_types_controler.php
index 21fa0781c8b..3dc6b8d4699 100755
--- a/core/class/docserver_types_controler.php
+++ b/core/class/docserver_types_controler.php
@@ -1,28 +1,15 @@
 <?php
 
 /*
-*    Copyright 2008-2011 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
 * @brief  Contains the docserver_types_controler Object (herits of the BaseObject class)
-* 
-* 
+*
+*
 * @file
 * @author Luc KEULEYAN - BULL
 * @author Laurent Giovannoni
@@ -36,16 +23,16 @@ $_ENV['DEBUG'] = false;
 
 // Loads the required class
 try {
-    require_once ("core/class/docserver_types.php");
-    require_once ("core/core_tables.php");
-    require_once ("core/class/ObjectControlerAbstract.php");
-    require_once ("core/class/ObjectControlerIF.php");
+    require_once("core/class/docserver_types.php");
+    require_once("core/core_tables.php");
+    require_once("core/class/ObjectControlerAbstract.php");
+    require_once("core/class/ObjectControlerIF.php");
 } catch (Exception $e) {
     echo functions::xssafe($e->getMessage()).' // ';
 }
 
 /**
-* @brief  Controler of the docserver_types_controler object 
+* @brief  Controler of the docserver_types_controler object
 *
 *<ul>
 *  <li>Get an docserver_types_controler object from an id</li>
@@ -54,7 +41,8 @@ try {
 *</ul>
 * @ingroup core
 */
-class docserver_types_controler extends ObjectControler implements ObjectControlerIF {
+class docserver_types_controler extends ObjectControler implements ObjectControlerIF
+{
     
     /**
      * Save given object in database:
@@ -64,7 +52,8 @@ class docserver_types_controler extends ObjectControler implements ObjectControl
      * @param docservers_types $docservers_types
      * @return array
      */
-    public function save($docserver_type, $mode = "") {
+    public function save($docserver_type, $mode = "")
+    {
     }
 
     public function delete($args)
@@ -79,42 +68,27 @@ class docserver_types_controler extends ObjectControler implements ObjectControl
     * @param  $can_be_disabled bool  if true gets the docserver_type even if it is disabled in the database (false by default)
     * @return docserver_types object with properties from the database or null
     */
-    public function get($docserver_type_id, $comp_where = '', $can_be_disabled = false) {
+    public function get($docserver_type_id, $comp_where = '', $can_be_disabled = false)
+    {
         $this->set_foolish_ids(array('docserver_type_id'));
         $this->set_specific_id('docserver_type_id');
         $docserver_type = $this->advanced_get($docserver_type_id, _DOCSERVER_TYPES_TABLE_NAME);
 
-        if (isset ($docserver_type_id))
+        if (isset($docserver_type_id)) {
             return $docserver_type;
-        else
-            return null;
-    }
-
-    /**
-    * get docserver_types with given id for a ws.
-    * Can return null if no corresponding object.
-    * @param $docserver_type_id of docserver_type to send
-    * @return docserver_types
-    */
-    public function getWs($docserver_type_id) {
-        $this->set_foolish_ids(array('docserver_type_id'));
-        $this->set_specific_id('docserver_type_id');
-        $docserver_type = $this->advanced_get($docserver_type_id, _DOCSERVER_TYPES_TABLE_NAME);
-        if (get_class($docserver_type) <> "docserver_types") {
-            return null;
         } else {
-            $docserver_type = $docserver_type->getArray();
-            return $docserver_type;
+            return null;
         }
     }
 
     /**
     * Disables a given docserver_types
-    * 
-    * @param  $docserver_type docserver_types object 
-    * @return bool true if the disabling is complete, false otherwise 
+    *
+    * @param  $docserver_type docserver_types object
+    * @return bool true if the disabling is complete, false otherwise
     */
-    public function disable($docserver_type) {
+    public function disable($docserver_type)
+    {
         if ($docserver_type <> 'TEMPLATES') {
             $control = array();
             if (!isset($docserver_type) || empty($docserver_type)) {
@@ -137,18 +111,21 @@ class docserver_types_controler extends ObjectControler implements ObjectControl
                 if ($_SESSION['history']['docserverstypesban'] == "true") {
                     $history = new history();
                     $history->add(
-                        _DOCSERVER_TYPES_TABLE_NAME, 
-                        $docserver_type->docserver_type_id, "BAN", 'docserverstypesban',
-                        _DOCSERVER_TYPE_DISABLED." : ".$docserver_type->docserver_type_id, 
-                        $_SESSION['config']['databasetype']);
+                        _DOCSERVER_TYPES_TABLE_NAME,
+                        $docserver_type->docserver_type_id,
+                        "BAN",
+                        'docserverstypesban',
+                        _DOCSERVER_TYPE_DISABLED." : ".$docserver_type->docserver_type_id,
+                        $_SESSION['config']['databasetype']
+                    );
                 }
             } else {
                 $control = array("status" => "ko", "value" => "", "error" => _PB_WITH_DOCSERVER_TYPE);
             }
         } else {
             $control = array(
-                'status' => 'ko', 
-                'value' => '', 
+                'status' => 'ko',
+                'value' => '',
                 'error' => _CANNOT_DISABLE_DOCSERVER_TYPE_ID . ' '. $docserver_type->docserver_type_id,
             );
         }
@@ -157,11 +134,12 @@ class docserver_types_controler extends ObjectControler implements ObjectControl
 
     /**
     * Enables a given docserver_types
-    * 
-    * @param  $docserver_type docserver_types object  
-    * @return bool true if the enabling is complete, false otherwise 
+    *
+    * @param  $docserver_type docserver_types object
+    * @return bool true if the enabling is complete, false otherwise
     */
-    public function enable($docserver_type) {
+    public function enable($docserver_type)
+    {
         $control = array();
         if (!isset($docserver_type) || empty($docserver_type)) {
             $control = array("status" => "ko", "value" => "", "error" => _DOCSERVER_TYPE_EMPTY);
@@ -175,10 +153,13 @@ class docserver_types_controler extends ObjectControler implements ObjectControl
             if ($_SESSION['history']['docserverstypesallow'] == "true") {
                 $history = new history();
                 $history->add(
-                    _DOCSERVER_TYPES_TABLE_NAME, 
-                    $docserver_type->docserver_type_id, "BAN", 'docserverstypesallow',
-                    _DOCSERVER_TYPE_ENABLED." : ".$docserver_type->docserver_type_id, 
-                    $_SESSION['config']['databasetype']);
+                    _DOCSERVER_TYPES_TABLE_NAME,
+                    $docserver_type->docserver_type_id,
+                    "BAN",
+                    'docserverstypesallow',
+                    _DOCSERVER_TYPE_ENABLED." : ".$docserver_type->docserver_type_id,
+                    $_SESSION['config']['databasetype']
+                );
             }
         } else {
             $control = array("status" => "ko", "value" => "", "error" => _PB_WITH_DOCSERVER_TYPE);
@@ -192,13 +173,14 @@ class docserver_types_controler extends ObjectControler implements ObjectControl
     * @param  $object ws docserver_types object
     * @return object docserver_types
     */
-    private function isADocserverType($object) {
+    private function isADocserverType($object)
+    {
         if (get_class($object) <> "docserver_types") {
             $func = new functions();
             $docserverTypesObject = new docserver_types();
             $array = array();
             $array = $func->object2array($object);
-            foreach(array_keys($array) as $key) {
+            foreach (array_keys($array) as $key) {
                 $docserverTypesObject->{$key} = $array[$key];
             }
             return $docserverTypesObject;
@@ -207,39 +189,18 @@ class docserver_types_controler extends ObjectControler implements ObjectControl
         }
     }
     
-    /** 
-    * Checks if a docserver_types exists
-    * 
-    * @param $docserver_type_id docserver_types object
-    * @return bool true if the docserver_types exists
-    */
-    public function docserverTypeExists($docserver_type_id) {
-        if (!isset ($docserver_type_id) || empty ($docserver_type_id))
-            return false;
-        $db = new Database();
-        $query = "select docserver_type_id from " 
-            . _DOCSERVER_TYPES_TABLE_NAME . " where docserver_type_id = ?";
-        try {
-            $stmt = $db->query($query, array($docserver_type_id));
-        } catch (Exception $e) {
-            echo _UNKNOWN . _LC_CYCLE . " " . functions::xssafe($docserver_type_id) . ' // ';
-        }
-        if ($stmt->rowCount() > 0) {
-            return true;
-        }
-        return false;
-    }
-    
     /**
     *  Checks if a docserver is linked
-    * 
+    *
     * @param $docserver_id docserver id
     * @return bool true if the docserver is linked
     */
-    public function docserverLinkExists($docserver_type_id) {
-        if (!isset($docserver_type_id) || empty($docserver_type_id))
+    public function docserverLinkExists($docserver_type_id)
+    {
+        if (!isset($docserver_type_id) || empty($docserver_type_id)) {
             return false;
-        $db = new Database();        
+        }
+        $db = new Database();
         $query = "select docserver_type_id from "
             . _DOCSERVERS_TABLE_NAME . " where docserver_type_id = ?";
         $stmt = $db->query($query, array($docserver_type_id));
@@ -250,70 +211,21 @@ class docserver_types_controler extends ObjectControler implements ObjectControl
     
     /**
     *  Checks if a cycle_steps is linked
-    * 
+    *
     * @param $docserver_id docserver id
     * @return bool true if the cycle_steps is linked
     */
-    public function lcCycleStepsLinkExists($docserver_type_id) {
-        if (!isset($docserver_type_id) || empty($docserver_type_id))
+    public function lcCycleStepsLinkExists($docserver_type_id)
+    {
+        if (!isset($docserver_type_id) || empty($docserver_type_id)) {
             return false;
+        }
         $db = new Database();
-        $query = "select docserver_type_id from " 
+        $query = "select docserver_type_id from "
             . _LC_CYCLE_STEPS_TABLE_NAME . " where docserver_type_id = ?";
         $stmt = $db->query($query, array($docserver_type_id));
         if ($stmt->rowCount()>0) {
             return true;
         }
     }
-
-    /**
-    * Returns in an array all the members of a docserver type (docserver_id only) 
-    *
-    * @param  $docserver_id string  Docserver identifier
-    * @return Array of docserver_id or null
-    */
-    public function getDocservers($docserver_type_id) {        
-        if (empty($docserver_type_id))
-            return null;
-        $docservers = array();
-        $db = new Database();
-        $query = "select docserver_id from "
-            . _DOCSERVERS_TABLE_NAME . " where docserver_type_id = ?";
-        try{
-            $stmt = $db->query($query, array($docserver_type_id));
-        } catch (Exception $e) {
-            echo _NO_TYPE_WITH_ID.' '.functions::xssafe($docserver_type_id).' // ';
-        }
-        while ($res = $stmt->fetchObject()) {
-            array_push($docservers, $res->docserver_id);
-        }
-        return $docservers;
-    }
-    
-    /**
-    * Return all docservers types ID
-    * @return array of docservers types
-    */
-    public function getAllId($can_be_disabled = false) {
-        $db = new Database();
-        $query = "select docserver_type_id from " . _DOCSERVER_TYPES_TABLE_NAME . " ";
-        if (!$can_be_disabled)
-            $query .= " where enabled = 'Y'";
-        try {
-            $stmt = $db->query($query);
-        } catch (Exception $e) {
-            echo _NO_DOCSERVER_TYPE . ' // ';
-        }
-        if ($stmt->rowCount() > 0) {
-            $result = array();
-            $cptId = 0;
-            while ($queryResult = $stmt->fetchObject()) {
-                $result[$cptId] = $queryResult->docserver_type_id;
-                $cptId++;
-            }
-            return $result;
-        } else {
-            return null;
-        }
-    }
 }
diff --git a/core/class/docservers_controler.php b/core/class/docservers_controler.php
index a8122e3de4c..60ae648f766 100755
--- a/core/class/docservers_controler.php
+++ b/core/class/docservers_controler.php
@@ -2,22 +2,9 @@
 
 
 /*
-*   Copyright 2008-2011 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -50,9 +37,7 @@ try {
 /**
  * Class for controling docservers objects from database
  */
-class docservers_controler
-    extends ObjectControler
-    implements ObjectControlerIF
+class docservers_controler extends ObjectControler implements ObjectControlerIF
 {
 
     /**
@@ -93,26 +78,6 @@ class docservers_controler
     {
     }
 
-
-    /**
-     * get docservers with given id for a ws.
-     * Can return null if no corresponding object.
-     * @param $docserver_id of docservers to send
-     * @return docservers
-     */
-    public function getWs($docserver_id)
-    {
-        $this->set_foolish_ids(array('docserver_id'));
-        $this->set_specific_id('docserver_id');
-        $docserver = $this->advanced_get($docserver_id, _DOCSERVERS_TABLE_NAME);
-        if (get_class($docserver) <> 'docservers') {
-            return null;
-        } else {
-            $docserver = $docserver->getArray();
-            return $docserver;
-        }
-    }
-
     /**
     * Disables a given docservers
     *
@@ -144,7 +109,8 @@ class docservers_controler
                     $history->add(
                         _DOCSERVERS_TABLE_NAME,
                         $docserver->docserver_id,
-                        'BAN','docserversban',
+                        'BAN',
+                        'docserversban',
                         _DOCSERVER_DISABLED . ' : ' . $docserver->docserver_id,
                         $_SESSION['config']['databasetype']
                     );
@@ -198,166 +164,6 @@ class docservers_controler
         }
     }
 
-    public function getDocserverToInsert($collId, $typeId = 'DOC')
-    {
-        if ($collId == 'templates') {
-            $typeId = 'TEMPLATES';
-        }
-
-        $db = new Database();
-        $query = "select docserver_id from docservers where is_readonly = 'N' and coll_id = ?  and docserver_type_id = ?";
-        $stmt = $db->query($query, [$collId, $typeId]);
-        $queryResult = $stmt->fetchObject();
-        if ($queryResult->docserver_id <> '') {
-            $docserver = $this->get($queryResult->docserver_id);
-            if (isset($docserver->docserver_id)) {
-                return $docserver;
-            } else {
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Store a new doc in a docserver.
-     * @param   $collId string collection resource
-     * @param   $fileInfos array , contains :
-     *          tmpDir : path to tmp directory
-     *          size : size of the doc
-     *          format : format of the doc
-     *          tmpFileName : file name of the doc in Maarch tmp directory
-     * @return  array of docserver data for res_x else return error
-     */
-    public function storeResourceOnDocserver($collId, $fileInfos)
-    {
-        $docserver = $this->getDocserverToInsert($collId);
-        $tmpSourceCopy = '';
-        $func = new functions();
-        if (empty($docserver)) {
-            $storeInfos = array(
-                'error' => _DOCSERVER_ERROR . ' : '
-                . _NO_AVAILABLE_DOCSERVER . ' .  ' . _MORE_INFOS . '.',
-            );
-            return $storeInfos;
-        }
-        $newSize = $this->checkSize($docserver, $fileInfos['size']);
-        if ($newSize == 0) {
-            $storeInfos = array(
-                'error' => _DOCSERVER_ERROR . ' : '
-                . _NOT_ENOUGH_DISK_SPACE . ' .  ' . _MORE_INFOS . '.',
-            );
-            return $storeInfos;
-        }
-        if ($fileInfos['tmpDir'] == '') {
-            $tmp = $_SESSION['config']['tmppath'];
-        } else {
-            $tmp = $fileInfos['tmpDir'];
-        }
-        $d = dir($tmp);
-        $pathTmp = $d->path;
-        while ($entry = $d->read()) {
-            if ($entry == $fileInfos['tmpFileName']) {
-                $tmpSourceCopy = $pathTmp . $entry;
-                $theFile = $entry;
-                break;
-            }
-        }
-        $d->close();
-        $pathOnDocserver = array();
-        $pathOnDocserver = Ds_createPathOnDocServer(
-            $docserver->path_template
-        );
-        $docinfo = $this->getNextFileNameInDocserver(
-            $pathOnDocserver['destinationDir']
-        );
-        if ($docinfo['error'] <> '') {
-             $_SESSION['error'] = _FILE_SEND_ERROR . '. '._TRY_AGAIN . '. '
-                                . _MORE_INFOS . ' : <a href=\'mailto:'
-                                . $_SESSION['config']['adminmail'] . '\'>'
-                                . $_SESSION['config']['adminname'] . '</a>';
-        }
-        require_once('core' . DIRECTORY_SEPARATOR . 'class'
-            . DIRECTORY_SEPARATOR . 'docserver_types_controler.php');
-        $docserverTypeControler = new docserver_types_controler();
-        $docserverTypeObject = $docserverTypeControler->get(
-            $docserver->docserver_type_id
-        );
-        $docinfo['fileDestinationName'] .= '.'
-            . strtolower($func->extractFileExt($tmpSourceCopy));
-        $copyResultArray = Ds_copyOnDocserver(
-            $tmpSourceCopy,
-            $docinfo,
-            $docserverTypeObject->fingerprint_mode
-        );
-
-        if (isset($copyResultArray['error']) && $copyResultArray['error'] <> '') {
-            //second chance
-            $docinfo = array();
-            $copyResultArray = array();
-            $docinfo = $this->getNextFileNameInDocserver(
-                $pathOnDocserver['destinationDir']
-            );
-            if ($docinfo['error'] <> '') {
-                 $_SESSION['error'] = _FILE_SEND_ERROR . '. '._TRY_AGAIN . '. '
-                                    . _MORE_INFOS . ' : <a href=\'mailto:'
-                                    . $_SESSION['config']['adminmail'] . '\'>'
-                                    . $_SESSION['config']['adminname'] . '</a>';
-            }
-            $docinfo['fileDestinationName'] .= '.'
-                . strtolower($func->extractFileExt($tmpSourceCopy));
-            $copyResultArray = Ds_copyOnDocserver(
-                $tmpSourceCopy,
-                $docinfo,
-                $docserverTypeObject->fingerprint_mode
-            );
-            if (isset($copyResultArray['error']) && $copyResultArray['error'] <> '') {
-                $storeInfos = array('error' => $copyResultArray['error']);
-                return $storeInfos;
-            }
-        }
-        $destinationDir = $copyResultArray['destinationDir'];
-        $fileDestinationName = $copyResultArray['fileDestinationName'];
-        $destinationDir = substr(
-            $destinationDir,
-            strlen($docserver->path_template)
-        ) . DIRECTORY_SEPARATOR;
-        $destinationDir = str_replace(
-            DIRECTORY_SEPARATOR,
-            '#',
-            $destinationDir
-        );
-        $this->setSize($docserver, $newSize);
-        $storeInfos = array(
-            'path_template' => $docserver->path_template,
-            'destination_dir' => $destinationDir,
-            'docserver_id' => $docserver->docserver_id,
-            'file_destination_name' => $fileDestinationName,
-        );
-        return $storeInfos;
-    }
-
-    /**
-    * Checks the size of the docserver plus a new file to see
-    * if there is enough disk space
-    *
-    * @param  $docserver docservers object
-    * @param  $filesize integer File size
-    * @return integer New docserver size or 0 if not enough disk space available
-    */
-    public function checkSize($docserver, $filesize)
-    {
-        $new_docserver_size = $docserver->actual_size_number + $filesize;
-        if ($docserver->size_limit_number > 0
-            && $new_docserver_size >= $docserver->size_limit_number
-        ) {
-            return 0;
-        } else {
-            return $new_docserver_size;
-        }
-    }
-
     /**
     * Calculates the next file name in the docserver
     * @param $pathOnDocserver docservers path
@@ -384,7 +190,7 @@ class docservers_controler
         }
         $nbFiles = count($fileTab);
         //Docserver is empty
-        if ($nbFiles == 0 ) {
+        if ($nbFiles == 0) {
             //Creates the directory
             if (!mkdir($pathOnDocserver . '0001', 0770)) {
                 return array(
@@ -424,11 +230,12 @@ class docservers_controler
             array_shift($fileTabBis);
             $nbFilesBis = count($fileTabBis);
             //If number of files => 1000 then creates a new subdirectory
-            if ($nbFilesBis >= 1000 ) {
+            if ($nbFilesBis >= 1000) {
                 $newDir = ($nbFiles) + 1;
                 if (!mkdir(
                     $pathOnDocserver
-                    . str_pad($newDir, 4, '0', STR_PAD_LEFT), 0770
+                    . str_pad($newDir, 4, '0', STR_PAD_LEFT),
+                    0770
                 )
                 ) {
                     return array(
@@ -501,264 +308,4 @@ class docservers_controler
         
         return $newSize;
     }
-
-    /**
-     * View the resource, returns the content of the resource
-     * @param   bigint $gedId id of th resource
-     * @param   string $tableName name of the res table
-     * @param   string $adrTable name of the res address table
-     * @return  array of elements to view the resource :
-     *          status, mime_type, extension,
-     *          file_content, tmp_path, file_path, called_by_ws error
-     */
-    public function viewResource(
-        $gedId,
-        $tableName,
-        $adrTable,
-        $calledByWS=false
-    ) {
-        $history = new history();
-        $coreTools = new core_tools();
-        //$whereClause = '';
-        //THE TEST HAVE TO BE DONE BEFORE !!!
-        $whereClause = ' and 1=1';
-/*
-        if (isset($_SESSION['origin']) && ($_SESSION['origin'] <> 'basket'
-            && $_SESSION['origin'] <> 'workflow')
-        ) {
-            if (isset(
-                $_SESSION['user']['security']
-                [$_SESSION['collection_id_choice']]
-                )
-            ) {
-                $whereClause = ' and( '
-                             . $_SESSION['user']['security']
-                             [$_SESSION['collection_id_choice']]['DOC']['where']
-                             . ' ) ';
-            } else {
-                $whereClause = ' and 1=1';
-            }
-        } else {
-            $whereClause = ' and 1=1';
-        }
-*/
-        $adr = array();
-        $resource = new resource();
-        $adr = $resource->getResourceAdr(
-            $tableName,
-            $gedId,
-            $whereClause,
-            $adrTable
-        );
-        //$coreTools->show_array($adr);
-        if ($adr['status'] == 'ko') {
-            $result = array(
-                'status' => 'ko',
-                'mime_type' => '',
-                'ext' => '',
-                'file_content' => '',
-                'tmp_path' => '',
-                'file_path' => '',
-                'called_by_ws' => $calledByWS,
-                'error' => _NO_RIGHT_ON_RESOURCE_OR_RESOURCE_NOT_EXISTS,
-            );
-            $history->add(
-                $tableName,
-                $gedId,
-                'ERR','docserverserr',
-                _NO_RIGHT_ON_RESOURCE_OR_RESOURCE_NOT_EXISTS,
-                $_SESSION['config']['databasetype']
-            );
-        } else {
-            require_once('core' . DIRECTORY_SEPARATOR . 'class'
-                . DIRECTORY_SEPARATOR . 'docserver_types_controler.php');
-            $docserverTypeControler = new docserver_types_controler();
-            $concatError = '';
-            //failover management
-            for (
-                $cptDocserver = 0;
-                $cptDocserver < count($adr[0]);
-                $cptDocserver++
-            ) {
-                $error = false;
-                //retrieve infos of the docserver
-                $fingerprintFromDb = $adr[0][$cptDocserver]['fingerprint'];
-                $format = $adr[0][$cptDocserver]['format'];
-                $docserverObject = $this->get(
-                    $adr[0][$cptDocserver]['docserver_id']
-                );
-                $docserver = $docserverObject->path_template;
-                $file = $docserver . $adr[0][$cptDocserver]['path']
-                      . $adr[0][$cptDocserver]['filename'];
-                $file = str_replace('#', DIRECTORY_SEPARATOR, $file);
-                $docserverTypeObject = $docserverTypeControler->get(
-                    $docserverObject->docserver_type_id
-                );
-                if (!file_exists($file) || empty($adr[0][$cptDocserver]['path']) || empty($adr[0][$cptDocserver]['filename'])) {
-                    
-                    $concatError .= _FILE_NOT_EXISTS_ON_THE_SERVER . ' : '
-                                  . $file . '||';
-                    $history->add(
-                        $tableName, $gedId, 'ERR','docserverserr',
-                        _FAILOVER . ' ' . _DOCSERVERS . ' '
-                        . $adr[0][$cptDocserver]['docserver_id'] . ':'
-                        . _FILE_NOT_EXISTS_ON_THE_SERVER . ' : '
-                        . $file, $_SESSION['config']['databasetype']
-                    );
-                } else {
-                    $fingerprintFromDocserver = Ds_doFingerprint(
-                        $file, $docserverTypeObject->fingerprint_mode
-                    );
-                    $adrToExtract = array();
-                    $adrToExtract = $adr[0][$cptDocserver];
-                    $adrToExtract['path_to_file'] = $file;
-                    //retrieve infos of the docserver type
-                    require_once('core' . DIRECTORY_SEPARATOR . 'class'
-                    . DIRECTORY_SEPARATOR . 'docserver_types_controler.php');
-                    $docserverTypeControler = new docserver_types_controler();
-                    $docserverTypeObject = $docserverTypeControler->get(
-                        $docserverObject->docserver_type_id
-                    );
-                    //manage compressed resource
-                    $mimeType = Ds_getMimeType(
-                        $adrToExtract['path_to_file']
-                    );
-                    //manage view of the file
-                    $use_tiny_mce = false;
-                    if (strtolower($format) == 'maarch'
-                        && $coreTools->is_module_loaded('templates')
-                    ) {
-                        $mode = 'content';
-                        $type_state = true;
-                        $use_tiny_mce = true;
-                        $mimeType = 'application/maarch';
-                    } else {
-                        require_once 'core/docservers_tools.php';
-                        $arrayIsAllowed = array();
-                        $arrayIsAllowed = Ds_isFileTypeAllowed($file);
-                        $type_state = $arrayIsAllowed['status'];
-                    }
-                    //if fingerprint from db = 0 we do not control fingerprint
-                    if ($fingerprintFromDb == '0'
-                        || ($fingerprintFromDb == $fingerprintFromDocserver)
-                        || $docserverTypeObject->fingerprint_mode == 'NONE'
-                    ) {
-                        if ($type_state <> false) {
-                            if ($_SESSION['history']['resview'] == 'true') {
-                                require_once(
-                                    'core' . DIRECTORY_SEPARATOR
-                                    . 'class' . DIRECTORY_SEPARATOR
-                                    . 'class_history.php'
-                                );
-                                $history->add(
-                                    $tableName, $gedId, 'VIEW','resview',
-                                    _VIEW_DOC_NUM . $gedId,
-                                    $_SESSION['config']['databasetype'],
-                                    'indexing_searching'
-                                );
-                            }
-                            //count number of viewed in listinstance for
-                            //the user
-                            if ($coreTools->is_module_loaded('entities')
-                                && $coreTools->is_module_loaded('basket')
-                            ) {
-                                require_once(
-                                    'modules' . DIRECTORY_SEPARATOR
-                                    . 'entities' . DIRECTORY_SEPARATOR
-                                    . 'class' . DIRECTORY_SEPARATOR
-                                    . 'class_manage_entities.php'
-                                );
-                                $ent = new entity();
-                                $ent->increaseListinstanceViewed($gedId);
-                            }
-                            $encodedContent = '';
-                            if (file_exists($file) && !$error) {
-                                if ($calledByWS) {
-                                    $content = '';
-                                    /*$content = file_get_contents(
-                                        $file, FILE_BINARY
-                                    );*/
-                                    $handle = fopen($file, 'r');
-                                    if ($handle) {
-                                        while (!feof($handle)) {
-                                            $content .= fgets($handle, 4096);
-                                        }
-                                        fclose($handle);
-                                    }
-                                    $encodedContent = base64_encode($content);
-                                } else {
-                                    $fileNameOnTmp = 'tmp_file_' . rand()
-                                        . '.' . strtolower($format);
-                                    $filePathOnTmp = $_SESSION['config']
-                                        ['tmppath'] . DIRECTORY_SEPARATOR
-                                        . $fileNameOnTmp;
-                                    copy($file, $filePathOnTmp);
-                                }
-                                $result = array(
-                                    'status' => 'ok',
-                                    'mime_type' => $mimeType,
-                                    'ext' => $format,
-                                    'file_content' => $encodedContent,
-                                    'tmp_path' => $_SESSION['config']
-                                    ['tmppath'],
-                                    'file_path' => $filePathOnTmp,
-                                    'called_by_ws' => $calledByWS,
-                                    'error' => '',
-                                );
-                                if (isset($extract)
-                                    && file_exists($extract['tmpArchive'])
-                                ) {
-                                    Ds_washTmp($extract['tmpArchive']);
-                                }
-                                return $result;
-                            } else {
-                                $concatError .= _FILE_NOT_EXISTS . '||';
-                                $history->add(
-                                    $tableName, $gedId, 'ERR','docserverserr',
-                                    _FAILOVER . ' ' . _DOCSERVERS . ' '
-                                    . $adr[0][$cptDocserver]['docserver_id']
-                                    . ':' . _FILE_NOT_EXISTS,
-                                    $_SESSION['config']['databasetype']
-                                );
-                            }
-                        } else {
-                            $concatError .= strtoupper(_WRONG_FILE_TYPE) . ' (extension => '.strtoupper($format).', mime_type => '.$mimeType.') ||';
-                            $history->add(
-                                $tableName, $gedId, 'ERR','docserverserr',
-                                _FAILOVER . ' ' . _DOCSERVERS . ' '
-                                . $adr[0][$cptDocserver]['docserver_id'] . ':'
-                                . _WRONG_FILE_TYPE,
-                                $_SESSION['config']['databasetype']
-                            );
-                        }
-                    } else {
-                        $concatError .= _PB_WITH_FINGERPRINT_OF_DOCUMENT . '||';
-                        $history->add(
-                            $tableName, $gedId, 'ERR','docserverserr',
-                            _FAILOVER . ' ' . _DOCSERVERS . ' '
-                            . $adr[0][$cptDocserver]['docserver_id'] . ':'
-                            . _PB_WITH_FINGERPRINT_OF_DOCUMENT,
-                            $_SESSION['config']['databasetype']
-                        );
-                    }
-                    if (file_exists($extract['tmpArchive'])) {
-                        Ds_washTmp($extract['tmpArchive']);
-                    }
-                }
-            }
-        }
-        //if errors :
-        $result = array(
-            'status' => 'ko',
-            'mime_type' => '',
-            'ext' => '',
-            'file_content' => '',
-            'tmp_path' => '',
-            'file_path' => '',
-            'called_by_ws' => $calledByWS,
-            'error' => $concatError,
-        );
-        return $result;
-    }
 }
-
diff --git a/core/class/usergroups.php b/core/class/usergroups.php
deleted file mode 100755
index d2ee1a385c1..00000000000
--- a/core/class/usergroups.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/*
-*    Copyright 2008,2009,2010 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the usergroups Object (herits of the BaseObject class)
-* 
-* 
-* @file
-* @author Claire Figueras <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-// Loads the required class
-try {
-	require_once("core/class/BaseObject.php");
-} catch (Exception $e){
-	echo functions::xssafe($e->getMessage()).' // ';
-}
-
-
-/**
-* @brief  usergroups Object, herits of the BaseObject class 
-*
-* @ingroup core
-*/
-class usergroups  extends BaseObject
-{
-	/**
-	* Returns the string representing the usergroups object
-	*
-	* @return string The usergroup label (group_desc field in the usergroups table)
-	*/
-	function __toString(){
-		return $this->group_desc; 
-	}
-	
-}
-?>
diff --git a/core/class/usergroups_controler.php b/core/class/usergroups_controler.php
deleted file mode 100755
index 900a40af317..00000000000
--- a/core/class/usergroups_controler.php
+++ /dev/null
@@ -1,640 +0,0 @@
-<?php
-/*
-*    Copyright 2008,2009,2010 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of the usergroup object
-*   create, save, modify, etc...)
-*
-*
-* @file
-* @author Claire Figueras <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-// Loads the required class
-try {
-    require_once 'core/core_tables.php';
-    require_once 'core/class/usergroups.php';
-    require_once 'core/class/ObjectControlerAbstract.php';
-    require_once 'core/class/ObjectControlerIF.php';
-    require_once 'core/class/SecurityControler.php';
-
-} catch (Exception $e) {
-    functions::xecho($e->getMessage()) . ' // ';
-}
-
-/**
-* @brief  Controler of the usergroup object
-*
-*<ul>
-*  <li>Get an usergroup object from an id</li>
-*  <li>Save in the database a usergroup</li>
-*  <li>Manage the operation on the usergroups related tables in the database
-*       (insert, select, update, delete)</li>
-*</ul>
-* @ingroup core
-*/
-class usergroups_controler extends ObjectControler implements ObjectControlerIF
-{
-    /**
-    * Returns an usergroup object based on a usegroup identifier
-    *
-    * @param  $groupId string  Usergroup identifier
-    * @param  $canBeDisabled bool  if true gets the group even if it is
-    *   disabled in the database (false by default)
-    * @return usergroup object with properties from the database or null
-    */
-    public function get($groupId, $canBeDisabled=false)
-    {
-        $this->set_foolish_ids(array('group_id'));
-        $this->set_specific_id('group_id');
-        return $this->advanced_get($groupId, USERGROUPS_TABLE);
-    }
-
-    /**
-    * Returns all usergroups (enabled by default) from the database in an array
-    *   of usergroup objects (ordered by group_desc by default)
-    *
-    * @param  $orderStr string  Order string passed to the query
-    *   ("order by group_desc asc" by default)
-    * @param  $enabledOnly bool  if true returns only the enabled usergroups,
-    *   otherwise returns even the disabled (true by default)
-    * @return Array of usergroup objects with properties from the database
-    */
-    public function getAllUsergroups($orderStr='order by group_desc asc',
-        $enabledOnly=true)
-    {
-        $db = new Database();
-        $query = 'select * from ' . USERGROUPS_TABLE . ' ';
-        if ($enabledOnly) {
-            $query .= "where enabled = 'Y'";
-        }
-        $query .= $orderStr;
-
-        try {
-            $stmt = $db->query($query);
-        } catch (Exception $e){}
-
-        $groups = array();
-        while ($res = $stmt->fetchObject()) {
-            $group = new usergroups();
-            $tmpArray = array(
-                'group_id'   => $res->group_id,
-                'group_desc' => $res->group_desc,
-                'enabled'    => $res->enabled,
-            );
-            $group->setArray($tmpArray);
-            array_push($groups, $group);
-        }
-        return $groups;
-    }
-
-    /**
-    * Returns in an array all the members of a usergroup (user_id only)
-    *
-    * @param  $groupId string  Usergroup identifier
-    * @return Array of user_id or null
-    */
-    public function getUsers($groupId)
-    {
-        if (empty($groupId)) {
-            return null;
-        }
-
-        $groupUse = \Group\models\GroupModel::getByGroupId(['groupId' => $groupId, 'select' => ['id']]);
-        $userGroup = \User\models\UserGroupModel::get(['select' => ['user_id'], 'where' => ['group_id = ?'], 'data' => [$groupUse['id']]]);
-        $userGroup = array_column($userGroup, 'user_id');
-
-        $userUse = [];
-        if (empty($userGroup)) {
-            echo _NO_GROUP_WITH_ID . ' ' . functions::xssafe($groupId) . ' // ';
-        } else {
-            $userUse = \User\models\UserModel::get(['select' => ['user_id'], 'where' => ['id in (?)'], 'data' => [$userGroup]]);
-            $userUse = array_column($userUse, 'user_id');
-        }
-
-        return $userUse;
-    }
-
-    /**
-    * Returns in an array all the baskets associated with a usergroup
-    *   (basket_id only)
-    *
-    * @param  $groupId string  Usergroup identifier
-    * @return Array of basket_id or null
-    */
-    public function getBaskets($groupId)
-    {
-        if (empty($groupId)) {
-            return null;
-        }
-        $baskets = array();
-        $db = new Database();
-        $query = 'select basket_id from groupbasket where group_id = ?';
-        try {
-            $stmt = $db->query($query, array($groupId));
-        } catch (Exception $e) {
-            echo _NO_GROUP_WITH_ID.' '.functions::xssafe($groupId).' // ';
-        }
-        while ($res = $stmt->fetchObject()) {
-            array_push($baskets, $res->basket_id);
-        }
-        return $baskets;
-    }
-
-    /**
-    * Returns in an array all the services linked to a usergroup
-    *   (service_id only)
-    *
-    * @param  $groupId string  Usergroup identifier
-    * @return Array of service_id or null
-    */
-    public function getServices($groupId)
-    {
-        if (empty($groupId)) {
-            return null;
-        }
-        $db = new Database();
-        $query = 'select service_id from ' . USERGROUPS_SERVICES_TABLE
-               . " where group_id = ?";
-        try {
-            $stmt = $db->query($query, array($groupId));
-        } catch (Exception $e){
-            echo _NO_GROUP_WITH_ID . ' ' . functions::xssafe($groupId) . ' // ';
-        }
-
-        $services = array();
-        while ($queryResult = $stmt->fetchObject()) {
-            array_push($services, trim($queryResult->service_id));
-        }
-        return $services;
-    }
-
-
-    /**
-    * Saves in the database a usergroup object
-    *
-    * @param  $group usergroup object to be saved
-    * @param  $security Security access data, array(
-    *       'COLL_ID' => collection identifier,
-    *       'WHERE_CLAUSE' => where clause on the view,
-    *       'COMMENT' => comment on the access,
-    *                                               )
-    * @param  $services Array of services identifier
-    * @param  $mode Mode (add or up)
-    * @param  $params More parameters, array(
-    *      'modules_services'      => $_SESSION['modules_services'] type array,
-    *      'log_group_up'          => 'true' / 'false': log group modification ,
-    *      'log_group_add'         => 'true' / 'false': log group addition ,
-    *      'databasetype'          => Type of the database,
-    *      'user_id'               => Current user identifier (used to process
-    *                                 context variables : @entities, ...)
-    *       )
-    * @return array (
-    *       'status' => 'ok' / 'ko',
-    *       'value'  => Usergroup identifier or empty in case of error,
-    *       'error'  => Error message, defined only in case of error
-    *       )
-    */
-    public function save($group, $security = array(), $services = array(),
-        $mode = '', $params = array())
-    {
-        $secCtrl = new SecurityControler();
-        $sec = new security();
-        $func = new functions();
-        // If usergroup not defined or empty, return an error
-        if (!isset($group) || empty($group)) {
-            $control = array(
-                'status' => 'ko',
-                'value' => '',
-                'error' => _GROUP_EMPTY,
-            );
-            return $control;
-        }
-        // If mode not up or add, return an error
-        if (!isset($mode) || empty($mode)
-            || ($mode <> 'add' && $mode <> 'up' )
-        ) {
-            $control = array(
-                'status' => 'ko',
-                'value' => '',
-                'error' => _MODE . ' ' . _UNKNOWN,
-            );
-            return $control;
-        }
-        $group = $this->_isAGroup($group);
-        $this->set_foolish_ids(array('group_id'));
-        $this->set_specific_id('group_id');
-        // Data checks
-        $control = $this->control($group, $security, $services, $mode, $params);
-        // Security checks
-        for ($i = 0; $i < count($security); $i ++) {
-            $view = $sec->retrieve_view_from_coll_id(
-                $security[$i]['COLL_ID']
-            );
-            if ($secCtrl->isUnsecureRequest($security[$i]['WHERE_CLAUSE'])) {
-                $res['RESULT'] = false;
-                $res['TXT'] = WHERE_CLAUSE_NOT_SECURE;
-                $control = array(
-                    'status' => 'ko',
-                    'value'  => '',
-                    'error'  => WHERE_CLAUSE_NOT_SECURE
-                );
-            } else {
-               $res = $secCtrl->check_where_clause(
-                    $security[$i]['COLL_ID'], $security[$i]['WHERE_CLAUSE'], $view, $params['user_id']
-                );
-            }
-            if ($res['RESULT'] == false) {
-                $control = array(
-                    'status' => 'ko',
-                    'value'  => '',
-                    'error'  => $res['TXT']
-                );
-                break;
-            }
-        }
-        /*print_r($res);
-        print_r($control);exit;*/
-        if ($control['status'] == 'ok') {
-            $secCtrl->deleteForGroup($group->group_id);
-            for ($i = 0; $i < count($security); $i ++) {
-                if ($security[$i] <> "") {
-                    $values = array(
-                        'group_id'       => $group->group_id,
-                        'coll_id'        => $security[$i]['COLL_ID'],
-                        'where_clause'   => $security[$i]['WHERE_CLAUSE'],
-                        'maarch_comment' => $security[$i]['COMMENT'],
-                        );
-
-
-                    $sec = new SecurityObj();
-                    $sec->setArray($values);
-                    $secCtrl->save($sec);
-                }
-            }
-            $this->deleteServicesForGroup($group->group_id);
-            for ($i = 0; $i < count($services); $i ++) {
-                if (!empty($services[$i])) {
-                    $this->insertServiceForGroup(
-                        $group->group_id, $services[$i]
-                    );
-                }
-            }
-            $core = new core_tools();
-
-            $_SESSION['service_tag'] = 'group_' . $mode;
-            $core->execute_modules_services(
-                $params['modules_services'], 'groups_add_db', 'include'
-            );
-
-            if ($mode == 'up') {
-                //Update existing group
-                if ($this->update($group)) {
-                    $control = array(
-                        'status' => 'ok',
-                        'value'  => $group->group_id
-                    );
-                    //log
-                    if ($params['log_group_up'] == 'true') {
-                        $history = new history();
-                        $history->add(
-                            USERGROUPS_TABLE, $group->group_id, 'UP', 'usergroupup',
-                            _GROUP_UPDATE . ' : ' . $group->group_id,
-                            $params['databasetype']
-                        );
-                    }
-                } else {
-                    $control = array(
-                        'status' => 'ko',
-                        'value'  => '',
-                        'error'  => _PB_WITH_GROUP_UPDATE,
-                    );
-                }
-            } else { //mode == add
-                if ($this->insert($group)) {
-                    $control = array(
-                        'status' => 'ok',
-                        'value'  => $group->group_id
-                    );
-                    //log
-                    if ($params['log_group_add'] == 'true') {
-                        $history = new history();
-                        $history->add(
-                            USERGROUPS_TABLE, $group->group_id, 'ADD','usergroupadd',
-                            _GROUP_ADDED.' : '.$group->group_id,
-                            $params['databasetype']
-                        );
-                    }
-                } else {
-                    $control = array(
-                        'status' => 'ko',
-                        'value'  => '',
-                        'error'  => _PB_WITH_USERGROUP,
-                    );
-                }
-            }
-        }
-        unset($_SESSION['service_tag']);
-        return $control;
-    }
-
-    /**
-    * Control the data of usergroups object
-    *
-    * @param  $group Usergroups object
-    * @param  $security Security access data
-    * @param  $services Array of services identifier
-    * @param  $mode Mode (add or up)
-    * @param  $params More parameters, array(
-    *           'modules_services'  => $_SESSION['modules_services'] type array,
-    *           'log_group_up'      => 'true' / 'false': log group modification,
-    *           'log_group_add'     => 'true' / 'false': log group addition ,
-    *           'databasetype'      => Type of the database
-    *          )
-    * @return array (
-    *           'status' => 'ok' / 'ko',
-    *           'value'  => Usergroup identifier or empty in case of error,
-    *           'error'  => Error message, defined only in case of error
-    *          )
-    */
-    private function control($group, $security, $services, $mode,
-        $params = array())
-    {
-        $error = "";
-        $func = new functions();
-
-        $group->group_id = $func->wash($group->group_id, 'no', _THE_GROUP, 'yes', 0, 32);
-
-        if (isset($group->group_desc) && !empty($group->group_desc)) {
-            $group->group_desc  = $func->wash($group->group_desc, 'no', _GROUP_DESC, 'yes', 0, 255);
-        }
-
-        if ($mode == "add" && $this->groupExists($group->group_id)) {
-            $func->add_error(
-                $group->group_id . ' ' . _ALREADY_EXISTS . "<br />"
-            );
-        }
-
-        $_SESSION['service_tag'] = 'group_check';
-        $core = new core_tools();
-        $core->execute_modules_services(
-            $params['modules_services'], 'group_check', 'include'
-        );
-
-        $error .= $_SESSION['error'];
-        //TODO:rewrite wash to return errors without html and not in the session
-        $error = str_replace("<br />", '#', $error);
-        $return = array();
-        if (!empty($error)) {
-            $return = array(
-                'status' => 'ko',
-                'value'  => $group->group_id,
-                'error'  => $error
-            );
-        } else {
-            $return = array(
-                'status' => 'ok',
-                'value'  => $group->group_id
-            );
-        }
-        unset($_SESSION['service_tag']);
-        return $return;
-    }
-
-    /**
-    * Inserts in the database (usergroups table) a usergroup object
-    *
-    * @param  $group usergroups object
-    * @return bool true if the insertion is complete, false otherwise
-    */
-    private function insert($group)
-    {
-        return $this->advanced_insert($group);
-    }
-
-    /**
-    * Updates a usergroup in the database (usergroups table) with an usergroup
-    *   object
-    *
-    * @param  $group usergroup object
-    * @return bool true if the update is complete, false otherwise
-    */
-    private function update($group)
-    {
-        return $this->advanced_update($group);
-    }
-
-
-    /**
-     * Deletes in the database (usergroups related tables) a given usergroup
-     *
-     * @param  $group usergroup object
-     * @return bool true if the deletion is complete, false otherwise
-     */
-    public function delete($group, $params = array())
-    {
-    }
-
-
-    /**
-    * Disables a given usergroup
-    *
-    * @param  $group usergroup object
-    * @return bool true if the disabling is complete, false otherwise
-    */
-    public function disable($group, $params=array())
-    {
-        $control = array();
-        if (!isset($group) || empty($group)) {
-            $control = array(
-                'status' => 'ko',
-                'value'  => '',
-                'error'  => _GROUP_EMPTY,
-            );
-            return $control;
-        }
-        $group = $this->_isAGroup($group);
-        $this->set_foolish_ids(array('group_id'));
-        $this->set_specific_id('group_id');
-
-        if ($this->advanced_disable($group)) {
-            $control = array(
-                'status' => 'ok',
-                'value'  => $group->group_id
-            );
-            if (isset($params['log_group_disabled'])
-                && ($params['log_group_disabled'] == 'true'
-                    || $params['log_group_disabled'] == true)
-            ) {
-                $history = new history();
-                $history->add(
-                    USERGROUPS_TABLE, $group->group_id, 'BAN','usergroupban',
-                    _SUSPENDED_GROUP . ' : ' . $group->group_id,
-                    $params['databasetype']
-                );
-            }
-        } else {
-            $control = array(
-                'status' => 'ko',
-                'value'  => '',
-                'error'  => _PB_WITH_GROUP_ID,
-            );
-        }
-        return $control;
-    }
-
-    /**
-    * Enables a given usergroup
-    *
-    * @param  $group usergroup object
-    * @return bool true if the enabling is complete, false otherwise
-    */
-    public function enable($group, $params=array())
-    {
-    }
-
-    /**
-    * Asserts if a given usergroup (group_id) exists in the database
-    *
-    * @param  $groupId String Usergroup identifier
-    * @return bool true if the usergroup exists, false otherwise
-    */
-    public function groupExists($groupId)
-    {
-        if (!isset($groupId) || empty($groupId)) {
-            return false;
-        }
-
-        $db = new Database();
-        $query = 'select group_id from ' . USERGROUPS_TABLE
-               . " where group_id = ?";
-
-        try {
-            $stmt = $db->query($query, array($groupId));
-        } catch (Exception $e) {
-            echo _UNKNOWN . _GROUP . ' ' . functions::xssafe($groupId) . ' // ';
-        }
-
-        if ($stmt->rowCount() > 0) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-    * Deletes all the services for a given usergroup in the usergroups_service
-    *   table
-    *
-    * @param  $groupId String Usergroup identifier
-    * @return bool true if the deleting is complete, false otherwise
-    */
-    public function deleteServicesForGroup($groupId)
-    {
-        if (!isset($groupId)|| empty($groupId)) {
-            return false;
-        }
-        $db = new Database();
-        $query = 'delete from ' . USERGROUPS_SERVICES_TABLE
-               . " where group_id=?";
-        try {
-            $stmt = $db->query($query, array($groupId));
-            $ok = true;
-        } catch (Exception $e) {
-            echo _CANNOT_DELETE_GROUP_ID . ' ' . functions::xssafe($groupId) . ' // ';
-            $ok = false;
-        }
-        return $ok;
-    }
-
-    /**
-    * Inserts a given service for a given group into the usergroups_services
-    *   table
-    *
-    * @param  $groupId String Usergroup identifier
-    * @param  $serviceId String Service identifier
-    * @return bool true if the insertion is complete, false otherwise
-    */
-    public function insertServiceForGroup($groupId, $serviceId)
-    {
-        if (!isset($groupId)|| empty($groupId) || !isset($serviceId)
-            || empty($serviceId)
-        ) {
-            return false;
-        }
-        $db = new Database();
-        $query = 'insert into ' . USERGROUPS_SERVICES_TABLE
-               . " (group_id, service_id) values (?, ?)";
-        try {
-            $stmt = $db->query($query, array($groupId, $serviceId));
-            $ok = true;
-        } catch (Exception $e) {
-            echo _CANNOT_INSERT . ' ' . functions::xssafe($groupId) 
-                . ' ' . functions::xssafe($serviceId) . ' // ';
-            $ok = false;
-        }
-        return $ok;
-    }
-
-    /**
-    * Checks if a given user is a member of the given group
-    *
-    * @param  $userId String User identifier
-    * @param  $groupId String Usergroup identifier
-    * @return bool true if the user is a member, false otherwise
-    */
-    public function inGroup($userId, $groupId)
-    {
-        if (!isset($groupId) || empty($groupId) || !isset($userId)
-            || empty($userId)
-        ) {
-            return false;
-        }
-        $userUse = \User\models\UserModel::getByLogin(['login' => $userId, 'select' => ['id']]);
-        $groupUse = \Group\models\GroupModel::getByGroupId(['groupId' => $groupId, 'select' => ['id']]);
-        $userGroup = \User\models\UserGroupModel::get(['select' => [1], 'where' => ['user_id = ?', 'group_id = ?'], 'data' => [$userUse['id'], $groupUse['id']]]);
-
-        return !empty($userGroup);
-    }
-
-     /**
-    * Fill a group object with an object if it's not a group
-    *
-    * @param  $object ws group object
-    * @return object usergroups
-    */
-    private function _isAGroup($object)
-    {
-        if (get_class($object) <> 'usergroups') {
-            $func = new functions();
-            $groupObject = new usergroups();
-            $array = array();
-            $array = $func->object2array($object);
-            foreach (array_keys($array) as $key) {
-                $userObject->{$key} = $array[$key];
-            }
-            return $groupObject;
-        } else {
-            return $object;
-        }
-    }
-}
diff --git a/core/class/users_controler.php b/core/class/users_controler.php
index c55c8197fe3..7c771a3a4f9 100755
--- a/core/class/users_controler.php
+++ b/core/class/users_controler.php
@@ -1,21 +1,8 @@
 <?php
 /*
-*   Copyright 2008-2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -548,41 +535,4 @@ class users_controler extends ObjectControler implements ObjectControlerIF
 
         return $entities;
     }
-    
-    /**
-    * Returns in an array all the parent entities associated with a specific entitiy type
-    *
-    * @param  $userId string  $entityType string
-    * @return Array or null
-    */
-    public function getParentEntitiesWithType($userId, $entityType)
-    {
-        $userEntities = self::getEntities($userId);
-        $parentEntitiesWithType = array();
-
-        foreach ($userEntities as $entity) {
-            $entity = $entity['ENTITY_ID'];
-            $isRightEntityType = false;
-            while (!$isRightEntityType) {
-                $query = "SELECT parent_entity_id, entity_type"
-                        . " FROM entities"
-                        . " WHERE entity_id = ?";
-                $stmt = self::$db->query($query, array($entity));
-
-                $res = $stmt->fetchObject();
-                if (!$res) {
-                    $isRightEntityType = true;
-                } elseif ($res->entity_type == $entityType) {
-                    if (!in_array($entity, $parentEntitiesWithType)) {
-                        $parentEntitiesWithType[] = $entity;
-                    }
-                    $isRightEntityType = true;
-                } else {
-                    $entity = $res->parent_entity_id;
-                }
-            }
-        }
-
-        return $parentEntitiesWithType;
-    }
 }
diff --git a/core/core_tables.php b/core/core_tables.php
index 11cdbb1cf44..6b73a85ad9c 100755
--- a/core/core_tables.php
+++ b/core/core_tables.php
@@ -1,22 +1,9 @@
 <?php
 
 /*
-*    Copyright 2008 - 2011 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -43,12 +30,6 @@ if (! defined('_LC_CYCLE_STEPS_TABLE_NAME')) {
 if (! defined('HISTORY_TABLE')) {
     define('HISTORY_TABLE', 'history');
 }
-if (! defined('PARAM_TABLE')) {
-    define('PARAM_TABLE', 'parameters');
-}
-if (! defined('SAVED_QUERIES')) {
-    define('SAVED_QUERIES', 'saved_queries');
-}
 if (! defined('SECURITY_TABLE')) {
     define('SECURITY_TABLE', 'security');
 }
diff --git a/core/docservers_tools.php b/core/docservers_tools.php
index f6473db9531..2376fe37e6e 100755
--- a/core/docservers_tools.php
+++ b/core/docservers_tools.php
@@ -1,22 +1,9 @@
 <?php
 
 /*
-*   Copyright 2008-2011 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
 */
 
 /**
@@ -49,7 +36,7 @@ try {
 function Ds_copyOnDocserver(
     $sourceFilePath,
     $infoFileNameInTargetDocserver,
-    $docserverSourceFingerprint='NONE'
+    $docserverSourceFingerprint = 'NONE'
 ) {
     error_reporting(0);
     $destinationDir = $infoFileNameInTargetDocserver['destinationDir'];
@@ -81,13 +68,6 @@ function Ds_copyOnDocserver(
         return $storeInfos;
     }
 
-    /*$ofile = fopen($destinationDir.$fileDestinationName, 'r');
-    if (Ds_isCompleteFile($ofile)) {
-        fclose($ofile);
-    } else {
-        $storeInfos = array('error' => _COPY_OF_DOC_NOT_COMPLETE);
-        return $storeInfos;
-    }*/
     if (isset($GLOBALS['currentStep'])) {
         $destinationDir = str_replace(
             $GLOBALS['docservers'][$GLOBALS['currentStep']]['docserver']
@@ -142,7 +122,7 @@ function Ds_createPathOnDocServer($docServer)
     }
     if (isset($GLOBALS['wb']) && $GLOBALS['wb'] <> '') {
         $path = $docServer . date('Y') . DIRECTORY_SEPARATOR.date('m')
-              . DIRECTORY_SEPARATOR . 'BATCH' . DIRECTORY_SEPARATOR 
+              . DIRECTORY_SEPARATOR . 'BATCH' . DIRECTORY_SEPARATOR
               . $GLOBALS['wb'] . DIRECTORY_SEPARATOR;
         if (!is_dir($path)) {
             mkdir($path, 0770, true);
@@ -189,7 +169,7 @@ function Ds_doFingerprint($path, $fingerprintMode)
 function Ds_controlFingerprint(
     $pathInit,
     $pathTarget,
-    $fingerprintMode='NONE'
+    $fingerprintMode = 'NONE'
 ) {
     $result = array();
     if (Ds_doFingerprint(
@@ -218,13 +198,13 @@ function Ds_controlFingerprint(
  */
 function Ds_setRights($dest)
 {
-    if (
-        DIRECTORY_SEPARATOR == '/'
+    if (DIRECTORY_SEPARATOR == '/'
         && (isset($GLOBALS['apacheUserAndGroup'])
         && $GLOBALS['apacheUserAndGroup'] <> '')
     ) {
-        exec('chown ' 
-            . escapeshellarg($GLOBALS['apacheUserAndGroup']) . ' ' 
+        exec(
+            'chown '
+            . escapeshellarg($GLOBALS['apacheUserAndGroup']) . ' '
             . escapeshellarg($dest)
         );
     }
@@ -239,29 +219,16 @@ function Ds_setRights($dest)
 */
 function Ds_getMimeType($filePath)
 {
-    //require_once 'MIME/Type.php';
-    //return MIME_Type::autoDetect($filePath);
     return mime_content_type($filePath);
 }
 
-/**
-* get the mime type of a file with a buffer
-* @param $fileBuffer buffer of the file
-* @return string of the mime type
-*/
-function Ds_getMimeTypeWithBuffer($fileBuffer)
-{
-    $finfo = new finfo(FILEINFO_MIME);
-    return $finfo->buffer($fileBuffer);
-}
-
 /**
  * del tmp files
  * @param   $dir dir to wash
  * @param   $contentOnly boolean true if only the content
  * @return  boolean
  */
-function Ds_washTmp($dir, $contentOnly=false)
+function Ds_washTmp($dir, $contentOnly = false)
 {
     if (is_dir($dir)) {
         $objects = scandir($dir);
@@ -283,32 +250,6 @@ function Ds_washTmp($dir, $contentOnly=false)
     }
 }
 
-/**
-* Return true when the file is completed
-* @param  $file
-* @param  $delay
-* @param  $pointer position in the file
-*/
-function Ds_isCompleteFile($file, $delay=500, $pointer=0)
-{
-    if ($file == null) {
-        return false;
-    }
-    fseek($file, $pointer);
-    $currentLine = fgets($file);
-    while (!feof($file)) {
-        $currentLine = fgets($file);
-    }
-    $currentPos = ftell($file);
-    //Wait $delay ms
-    usleep($delay * 1000);
-    if ($currentPos == $pointer) {
-        return true;
-    } else {
-        return Ds_isCompleteFile($file, $delay, $currentPos);
-    }
-}
-
 /**
  * Check the mime type of a file with the extension config file
 * Return array with the status of the check and the mime type of the file
@@ -317,7 +258,6 @@ function Ds_isCompleteFile($file, $delay=500, $pointer=0)
 */
 function Ds_isFileTypeAllowed($filePath, $extDefault = '')
 {
-    
     $mimeType = Ds_getMimeType(
         $filePath
     );
@@ -345,8 +285,8 @@ function Ds_isFileTypeAllowed($filePath, $extDefault = '')
         . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml'
         . DIRECTORY_SEPARATOR . 'extensions.xml';
     } else {
-        $path = $_SESSION['config']['corepath'] . 'apps' 
-		. DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
+        $path = $_SESSION['config']['corepath'] . 'apps'
+        . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
         . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'extensions.xml';
     }
     $xmlconfig = simplexml_load_file($path);
@@ -360,12 +300,10 @@ function Ds_isFileTypeAllowed($filePath, $extDefault = '')
         $i++;
     }
     $type_state = false;
-    for ($i=0;$i<count($ext_list);$i++) {
-        if (
-            $ext_list[$i]['mime'] == $mimeType 
+    for ($i=0; $i<count($ext_list); $i++) {
+        if ($ext_list[$i]['mime'] == $mimeType
             && strtolower($ext_list[$i]['name']) == $ext
         ) {
-
             $type_state = true;
             break;
         }
diff --git a/core/init.php b/core/init.php
index 7afb2cfe3cb..e4a08111b0c 100755
--- a/core/init.php
+++ b/core/init.php
@@ -15,7 +15,7 @@
 
 require_once dirname(__file__) . '/class/Url.php';
 //dynamic session name
-$sessionName = str_replace("\\","/", dirname(__file__));
+$sessionName = str_replace("\\", "/", dirname(__file__));
 $sessionName = str_replace($_SERVER['DOCUMENT_ROOT'], '', $sessionName);
 $sessionName = str_replace("/", '', $sessionName);
 $sessionName = str_replace('core', '', $sessionName);
@@ -27,10 +27,10 @@ $secure = empty($_SERVER["HTTPS"]) ? null : $_SERVER["HTTPS"];
 $httponly = true;
 $cookieParams = session_get_cookie_params();
 session_set_cookie_params(
-    0, 
-    $cookieParams["path"], 
-    $cookieParams["domain"], 
-    $secure, 
+    0,
+    $cookieParams["path"],
+    $cookieParams["domain"],
+    $secure,
     $httponly
 );
 session_name($sessionName);
@@ -59,7 +59,6 @@ if (isset($_SESSION['config']['corepath'])
 ) {
     chdir($_SESSION['config']['corepath']);
 }
-//ini_set('error_reporting', E_ALL);
 if (isset($_SESSION['custom_override_id'])
     && ! empty($_SESSION['custom_override_id'])
     && isset($_SESSION['config']['corepath'])
@@ -71,7 +70,7 @@ if (isset($_SESSION['custom_override_id'])
         $path . PATH_SEPARATOR . $_SESSION['config']['corepath']
         . PATH_SEPARATOR . get_include_path()
     );
-} else if (isset($_SESSION['config']['corepath'])
+} elseif (isset($_SESSION['config']['corepath'])
     && ! empty($_SESSION['config']['corepath'])
 ) {
     set_include_path(
@@ -79,14 +78,10 @@ if (isset($_SESSION['custom_override_id'])
     );
 }
 
-
-if(file_exists('installed.lck')) {
-
+if (file_exists('installed.lck')) {
     require_once 'vendor/autoload.php';
-
 }
 
-
 /**
  * Get an array that represents directory tree
  * @param string $directory     Directory path
@@ -113,13 +108,13 @@ function maarchFilesWhiteList($directory, $isCustom = false, $recursive = true,
                 if (is_dir($directory. DIRECTORY_SEPARATOR . $file)) {
                     if ($recursive) {
                         $arrayItems = array_merge(
-                            $arrayItems, 
+                            $arrayItems,
                             maarchFilesWhiteList(
-                                $directory. DIRECTORY_SEPARATOR . $file, 
-                                $isCustom, 
-                                $recursive, 
-                                $listDirs, 
-                                $listFiles, 
+                                $directory. DIRECTORY_SEPARATOR . $file,
+                                $isCustom,
+                                $recursive,
+                                $listDirs,
+                                $listFiles,
                                 $exclude
                             )
                         );
@@ -131,16 +126,12 @@ function maarchFilesWhiteList($directory, $isCustom = false, $recursive = true,
                     }
                 } else {
                     if ($listFiles) {
-                        //$fileName = $file;
                         $file = $directory . DIRECTORY_SEPARATOR . $file;
-                        if (
-                            $isCustom 
+                        if ($isCustom
                             && file_exists('custom/' . $_SESSION['custom_override_id'] . '/' . $file)
                         ) {
-                            //$arrayItems[$fileName] = 'custom/' . $_SESSION['custom_override_id'] . '/' . $file;
                             array_push($arrayItems, 'custom'. DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . $file);
                         } else {
-                            //$arrayItems[$fileName] = $file;
                             array_push($arrayItems, $file);
                         }
                     }
@@ -153,16 +144,15 @@ function maarchFilesWhiteList($directory, $isCustom = false, $recursive = true,
 }
 
 
-if (!isset($_SESSION['maarchFilesWhiteList']) || $_SESSION['maarchFilesWhiteListTurn'] == 1 ) {
+if (!isset($_SESSION['maarchFilesWhiteList']) || $_SESSION['maarchFilesWhiteListTurn'] == 1) {
     $isCustom = false;
-    if (
-        is_dir('custom/' . $_SESSION['custom_override_id']) 
+    if (is_dir('custom/' . $_SESSION['custom_override_id'])
         && !empty($_SESSION['custom_override_id'])
     ) {
         $isCustom = true;
     }
 
-    if(!isset($_SESSION['maarchFilesWhiteListTurn'])){
+    if (!isset($_SESSION['maarchFilesWhiteListTurn'])) {
         $_SESSION['maarchFilesWhiteListTurn'] = 1;
     } else {
         $_SESSION['maarchFilesWhiteListTurn'] = 2;
@@ -177,51 +167,41 @@ if (!isset($_SESSION['maarchFilesWhiteList']) || $_SESSION['maarchFilesWhiteList
     $handle = opendir('modules');
     if ($handle) {
         while (false !== ($file = readdir($handle))) {
-            //echo $file . '<br/>';
             if (is_dir($_SESSION['config']['corepath'] . '/modules/' . $file) && $file <> '.' && $file <> '..') {
                 array_push($modules, $file);
             }
         }
     }
     $countModules = count($modules);
-    for ($z=0;$z<$countModules;$z++) {
+    for ($z=0; $z<$countModules; $z++) {
         $_SESSION['maarchFilesWhiteList']['modules'][$modules[$z]] = maarchFilesWhiteList(
             'modules' . DIRECTORY_SEPARATOR . $modules[$z],
             $isCustom
         );
     }
     if (
-        is_dir($_SESSION['config']['corepath'] . '/custom/' . $_SESSION['custom_override_id']) 
+        is_dir($_SESSION['config']['corepath'] . '/custom/' . $_SESSION['custom_override_id'])
         && !empty($_SESSION['custom_override_id'])
     ) {
         if (is_dir($_SESSION['config']['corepath'] . 'custom/' . $_SESSION['custom_override_id'] . '/core')) {
             $_SESSION['maarchFilesWhiteList']['custom']['core'] = maarchFilesWhiteList('custom'. DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR .'core');
-            $_SESSION['maarchFilesWhiteList']['core'] 
+            $_SESSION['maarchFilesWhiteList']['core']
                 = array_merge($_SESSION['maarchFilesWhiteList']['core'], $_SESSION['maarchFilesWhiteList']['custom']['core']);
         }
         if (is_dir($_SESSION['config']['corepath'] . 'custom/' . $_SESSION['custom_override_id']. '/apps')) {
             $_SESSION['maarchFilesWhiteList']['custom']['apps'] = maarchFilesWhiteList('custom' . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']. DIRECTORY_SEPARATOR .'apps');
-            $_SESSION['maarchFilesWhiteList']['apps'] 
+            $_SESSION['maarchFilesWhiteList']['apps']
                 = array_merge($_SESSION['maarchFilesWhiteList']['apps'], $_SESSION['maarchFilesWhiteList']['custom']['apps']);
-
         }
-        for ($z=0;$z<$countModules;$z++) {
+        for ($z=0; $z<$countModules; $z++) {
             if (is_dir($_SESSION['config']['corepath'] . 'custom/' . $_SESSION['custom_override_id']. '/modules/' . $modules[$z])) {
                 $_SESSION['maarchFilesWhiteList']['custom']['modules'][$modules[$z]] = maarchFilesWhiteList(
                     'custom'. DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']. DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $modules[$z],
                     $isCustom
                 );
-                $_SESSION['maarchFilesWhiteList']['modules'][$modules[$z]] 
+                $_SESSION['maarchFilesWhiteList']['modules'][$modules[$z]]
                     = array_merge($_SESSION['maarchFilesWhiteList']['modules'][$modules[$z]], $_SESSION['maarchFilesWhiteList']['custom']['modules'][$modules[$z]]);
             }
-            
         }
     }
-
-    // echo '<pre>';
-    // print_r($_SESSION['maarchFilesWhiteList']);
-    // echo '</pre>';
-    // exit;
 }
-
-
diff --git a/core/manage_action.php b/core/manage_action.php
deleted file mode 100755
index 19d55eb7695..00000000000
--- a/core/manage_action.php
+++ /dev/null
@@ -1,383 +0,0 @@
-<?php
-/*
-*    Copyright 2008-2015 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief   Manage core actions
-*
-* @file
-* @author Claire Figueras <dev@maarch.org>
-* @date $date$
-* @version $Revision$
-* @ingroup core
-*/
-
-$db = new Database();
-$core = new core_tools();
-$core->load_lang();
-$res_action = array();
-
-/*
-* Puts the values that are in a string into an array.
-* $$ field separator, # field_name / value separator
-*
-* @param $val string Values to split
-* @return array Values in array
-*/
-function get_values_in_array($val)
-{
-    $tab = explode('$$', $val);
-    $values = array();
-    for ($i=0; $i<count($tab);$i++) {
-        $tmp = explode('#', $tab[$i]);
-
-        $val_tmp=array();
-        for ($idiese=1;$idiese<count($tmp);$idiese++) {
-            $val_tmp[]=$tmp[$idiese];
-        }
-        $valeurDiese = implode("#", $val_tmp);
-        if (isset($tmp[1])) {
-            array_push($values, array('ID' => $tmp[0], 'VALUE' => $valeurDiese));
-        }
-    }
-    return $values;
-}
-
-// Form validation
-if ($_POST['req'] == 'valid_form' && !empty($_POST['action_id']) && isset($_POST['action_id']) && !empty($_POST['form_to_check'])&& isset($_POST['form_to_check'])) {
-    $id_action = $_POST['action_id'];
-    // Gets the action informations from the database
-    $stmt = $db->query("select * from ".$_SESSION['tablename']['actions']." where id = ?", array($id_action));
-
-    if ($stmt->rowCount() < 1) {
-        $_SESSION['action_error'] = _ACTION_NOT_IN_DB;
-        echo "{status : 5, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-        exit();
-    }
-
-    $res = $stmt->fetchObject();
-    $label_action = $res->label_action;
-    $status = $res->id_status;
-    $action_page = $res->action_page;
-    if ($res->history == 'Y' && $_POST['hist']!='N') {
-        $bool_history = $res->history;
-    } else {
-        $bool_history = 'N';
-    }
-
-    //No script defined for this action
-    if ($action_page == '') {
-        $_SESSION['action_error'] = _ACTION_NOT_IN_DB;
-        echo "{status : 5, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-        exit();
-    }
-    $custom_path = '';
-    $path_action_page = $core->get_path_action_page($action_page);
-
-    if (isset($_SESSION['custom_override_id']) && !empty($_SESSION['custom_override_id'])) {
-        $custom_path = 'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.$path_action_page;
-    }
-    if ($custom_path <> '' && file_exists($_SESSION['config']['corepath'].$custom_path)) {
-        include($custom_path);
-    } else {
-        if (file_exists($path_action_page)) {
-            include($path_action_page);
-        } else {
-            // Invalid path to script
-            $_SESSION['action_error'] = $label_action.' '._ACTION_PAGE_MISSING;
-            echo "{status : 8, error_txt: '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-            exit();
-        }
-    }
-
-
-    $frm_error = check_form(trim($_POST['form_to_check']), get_values_in_array($_POST['form_values']));
-    if ($frm_error == false) {
-        echo "{status : 1, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-        exit();
-    } else {
-        echo "{status : 0, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."', page_result : '', manage_form_now : false}";
-        exit();
-    }
-} elseif (trim($_POST['req']) == 'change_status' && !empty($_POST['values']) && !empty($_POST['new_status']) && !empty($_POST['table'])) {
-    $stmt = $db->query("select id, label_status from status where id = ?", array($_POST['new_status']));
-    $lineStatus = $stmt->fetchObject();
-    if ($lineStatus->id <> '') {
-        $arr_id = explode(',', $_POST['values']);
-        $result = '';
-        for ($i=0; $i<count($arr_id);$i++) {
-            $arr_id[$i] = str_replace('#', '', $arr_id[$i]);
-            $result .= $arr_id[$i].'#';
-            if (trim($_POST['new_status']) <> '' && is_numeric($arr_id[$i])) {
-                
-                $query_str = "update " . $_POST['table']
-                    . " set status = ? where res_id = ?";
-                
-                $stmt = $db->query($query_str, array($_POST['new_status'], $arr_id[$i]));
-                if (!$stmt) {
-                    $_SESSION['action_error'] = _SQL_ERROR.' : '.$query_str;
-                    echo "{status : 1, error_txt : '".addslashes(_ERROR_WITH_STATUS." ".functions::xssafe($query_str))."'}";
-                    exit();
-                }
-            }
-        }
-        echo json_encode(['status' => 0, 'error_txt' => _STATUS_UPDATED.' : '.functions::xssafe($_POST['new_status']) ]);
-        exit();
-    } else {
-        echo json_encode(['status' => 0, 'error_txt' => _STATUS_NOT_EXISTS.' : '.functions::xssafe($_POST['new_status']) ]);
-        exit();
-    }
-}
-// Post variables error
-elseif (empty($_POST['values']) || !isset($_POST['action_id']) || empty($_POST['action_id']) ||
-($_POST['mode'] <> 'mass' && $_POST['mode'] <> 'page')  || empty($_POST['table'])
-|| empty($_POST['coll_id']) || empty($_POST['module']) || ($_POST['req'] <> 'first_request' && $_POST['req'] <> 'second_request' && $_POST['req'] <> 'change_status')) {
-    $tmp = 'values : '.$_POST['values'].', action_id : '.$_POST['action_id'].', mode : '. $_POST['mode'].', table : '.$_POST['table'].', coll_id : '.$_POST['coll_id'].', module : '.$_POST['module'].', req : '.$_POST['req'];
-    $_SESSION['action_error'] = $tmp._AJAX_PARAM_ERROR;
-    echo "{status : 1, error_txt : '".functions::xssafe($id_action).addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-    exit();
-} else {
-    // Puts the res_id into an array
-    $arr_id = explode(',', $_POST['values']);
-    $id_action = $_POST['action_id'];
-    // Gets the action informations from the database
-    $stmt = $db->query("select * from ".$_SESSION['tablename']['actions']." where id = ?", array($id_action));
-    if ($stmt->rowCount() < 1) {
-        $_SESSION['action_error'] = _ACTION_NOT_IN_DB;
-        echo "{status : 5, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-        exit();
-    }
-
-    $res = $stmt->fetchObject();
-    $label_action = $res->label_action;
-    $status = $res->id_status;
-    $action_page = $res->action_page;
-    if ($res->history == 'Y' && $_POST['hist']!='N') {
-        $bool_history = $res->history;
-    } else {
-        $bool_history = 'N';
-    }
-    //No script defined for this action
-    if ($action_page == '') {
-        //If second request : Error
-        if ($_POST['req'] == 'second_request') {
-            $_SESSION['action_error'] = _ACTION_NOT_IN_DB;
-            echo "{status : 5, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-            exit();
-        }
-
-        //If no status defined in the action file , error
-        if ($status == '' || $status == 'NONE') {
-            $_SESSION['action_error'] = $label_action.' : '._ERROR_PARAM_ACTION;
-            echo "{status : 6, error_txt : '".functions::xssafe(addslashes($_SESSION['action_error']))."'}";
-            exit();
-        }
-        $stmt = $db->query("select id from status where id = ?", array($status));
-        $lineStatus = $stmt->fetchObject();
-        if ($lineStatus->id <> '') {
-            // Update the status
-            $result = '';
-            for ($i=0;$i<count($arr_id);$i++) {
-                $arr_id[$i] = str_replace('#', '', $arr_id[$i]);
-                $result .= $arr_id[$i].'#';
-                if (trim($status) <> '') {
-                    
-                        $query_str = "update " . $_POST['table']
-                            .  " set status = ? where res_id = ?";
-                    
-                    $stmt = $db->query($query_str, array($status, $arr_id[$i]));
-                    if (!$stmt) {
-                        $_SESSION['action_error'] = _SQL_ERROR . ' : ' . $query_str;
-                        echo "{status : 7, error_txt : '" . addslashes(functions::xssafe($label_action)
-                            . ' : ' . functions::xssafe($_SESSION['action_error'])) . "'}";
-                        exit();
-                    }
-                }
-            }
-        }
-        $res_action = array('result' => $result, 'history_msg' => '');
-        $_SESSION['action_error'] = _ACTION_DONE.' : '.$label_action;
-        echo "{status : 0, error_txt : '".addslashes($_SESSION['action_error']).", status : "
-            .functions::xssafe($status).", ".functions::xssafe($_POST['values'])."', page_result : ''}";
-    }
-    // There is a script for the action
-    else {
-        $custom_path = '';
-        $path_action_page = $core->get_path_action_page($action_page);
-
-        if (isset($_SESSION['custom_override_id']) && !empty($_SESSION['custom_override_id'])) {
-            $custom_path = 'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.$path_action_page;
-        }
-        if ($custom_path <> '' && file_exists($_SESSION['config']['corepath'].$custom_path)) {
-            include($custom_path);
-        } else {
-            if (file_exists($path_action_page)) {
-                include($path_action_page);
-            } else {
-                // Invalid path to script
-                $_SESSION['action_error'] = $label_action.' '._ACTION_PAGE_MISSING;
-                echo "{status : 8, error_txt: '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-                exit();
-            }
-        }
-
-        if ($_POST['req'] == 'first_request' && in_array('form', $etapes) && $error_visa_workflow_signature_book != true) {
-            $frm_test = get_form_txt($arr_id, $_SESSION['config']['businessappurl'].'index.php?display=true&page=manage_action&module=core', $id_action, $_POST['table'], $_POST['module'], $_POST['coll_id'], $_POST['mode']);
-            echo "{status : 3, form_content : '".$frm_test."', height : '".$frm_height."', width : '".$frm_width."', 'mode_frm' : '".$mode_form."', 'action_status' : '".functions::xssafe($status)."'}";
-            exit();
-        } elseif ($_POST['req'] == 'first_request' && in_array('no_attachment', $etapes)) {
-            echo "{status : 3, form_content : '<div class=\"h2_title\">" . addslashes(_ADD_ATTACHMENT_TO_SEND_TO_CONTACT) .
-                "</div><p class=\"buttons\"><input type=\"button\" class=\"button\" value=\""._CANCEL."\" onclick=\"destroyModal(\'modal_" .$id_action . "\')\" id=\"submit\" name=\"submit\"></p>', height : '250px', width : '300px', 'mode_frm' : '', validate : 'OK', 'action_status' : '".functions::xssafe($status)."'}";
-            exit();
-        } elseif ($_POST['req'] == 'first_request' && $error_visa_workflow_signature_book == true) {
-            echo "{status : 4, error : '".addslashes(_NO_RESPONSE_PROJECT_VISA)."', validate : 'OK', 'action_status' : '".functions::xssafe($status)."'}";
-            exit();
-        } elseif ($_POST['req'] == 'first_request' && $error_visa == true) {
-            echo "{status : 4, error : '".addslashes(_NO_VISA)."', validate : 'OK', 'action_status' : '".functions::xssafe($status)."'}";
-            exit();
-        } elseif ($_POST['req'] == 'first_request' && $error_visa_response_project == true) {
-            echo "{status : 3, form_content : '<div class=\"h2_title\">" . addslashes($visa->errorMessageVisa) .
-                "</div><p class=\"buttons\"><input type=\"button\" onclick=\"destroyModal(\'modal_" .$id_action . "\')\" class=\"button\" value=\"OK\" id=\"submit\" name=\"submit\"></p>', height : 'auto', width : 'auto', 'mode_frm' : '', validate : 'OK', 'action_status' : '".functions::xssafe($status)."'}";
-            exit();
-        } elseif ($_POST['req'] == 'first_request' && $error_visa_workflow == true) {
-            echo "{status : 4, error : '".addslashes(_NO_NEXT_STEP_VISA)."', validate : 'OK', 'action_status' : '".functions::xssafe($status)."'}";
-            exit();
-        } elseif ($_POST['req'] == 'first_request' && $confirm == true) {
-            if (!empty($warnMsg)) {
-                echo "{status : 2, confirm_content : '".addslashes("<p style='font-size: 12px;text-align: center;color: white;background: #F99830;padding: 5px;margin: -10px -10px 20px -10px;'><i class='fa fa-exclamation-triangle'></i> ".$warnMsg."<p>"._ACTION_CONFIRM." ".functions::xssafe($label_action))."', validate : '"._VALIDATE."', cancel : '"._CANCEL."', label_action : '".addslashes(functions::xssafe($label_action))."', 'action_status' : '".functions::xssafe($status)."'}";
-            } else {
-                echo "{status : 2, confirm_content : '".addslashes(_ACTION_CONFIRM." ".functions::xssafe($label_action))."', validate : '"._VALIDATE."', cancel : '"._CANCEL."', label_action : '".addslashes(functions::xssafe($label_action))."', 'action_status' : '".functions::xssafe($status)."'}";
-            }
-            exit();
-        } elseif ($_POST['req'] == 'first_request' && $confirm == false && $action_page == 'close_mail_with_attachment') {
-            echo "{status : 3, form_content : '<div class=\"h2_title\">" . addslashes(_ADD_ATTACHMENT_OR_NOTE) .
-                "</div><p class=\"buttons\"><input type=\"button\" class=\"button\" value=\""._CANCEL."\" onclick=\"destroyModal(\'modal_" .$id_action . "\')\" id=\"submit\" name=\"submit\"></p>', height : '250px', width : '300px', 'mode_frm' : '', validate : 'OK', 'action_status' : '".functions::xssafe($status)."'}";
-            exit();
-        } else {
-            if ($confirm == false) {
-                $_SESSION['action_error'] = $label_action.' : '._ERROR_SCRIPT;
-            }
-            for ($i=0; $i<count($etapes);$i++) {
-                if ($etapes[$i] <> 'status') {
-                    if (function_exists('manage_'.$etapes[$i])) {
-                        try {
-                            if ($_POST['req'] == 'second_request') {
-                                $res_action = call_user_func('manage_'.$etapes[$i], $arr_id, $bool_history, $id_action, $label_action, $status, $_POST['coll_id'], $_POST['table'], get_values_in_array($_POST['form_values']));
-                            } else {
-                                $res_action = call_user_func('manage_'.$etapes[$i], $arr_id, $bool_history, $id_action, $label_action, $status, $_POST['coll_id'], $_POST['table']);
-                            }
-                        } catch (Exception $e) {
-                            echo "{status : 9, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-                            exit();
-                        }
-                    } else {
-                        echo "{status : 9, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-                        exit();
-                    }
-                }
-            }
-            //print_r($res_action);
-            if ($res_action == false) {
-                echo "{status : 9, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'}";
-                exit();
-            }
-            $comp = ", page_result  : ''";
-            if (isset($res_action['page_result']) && !empty($res_action['page_result'])) {
-                $comp = ", page_result  : '".$res_action['page_result']."'";
-            }
-            if (isset($res_action['table_dest']) && !empty($res_action['table_dest'])) {
-                $comp .= ", table : '".$res_action['table_dest']."'";
-            }
-            
-            
-            if (isset($res_action['newResultId']) && !empty($res_action['newResultId'])) {
-                $comp .= ", newResultId : '".$res_action['newResultId']."'";
-            }
-            if (isset($res_action['action_status']) && !empty($res_action['action_status'])) {
-                $comp .= ", action_status : '".$res_action['action_status']."'";
-            }
-            
-            $_SESSION['action_error'] = _ACTION_DONE.' : '.$label_action;
-            echo "{status : 0, error_txt : '".addslashes(functions::xssafe($_SESSION['action_error']))."'".$comp.", result_id : '".$res_action['result']."'}";
-        }
-    }
-
-    require_once 'apps/maarch_entreprise/actions/docLocker.php';
-    require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php");
-    $hist = new history();
-    $arr_res = explode('#', $res_action['result']);
-    if (!is_array($res_action['history_msg'])) {
-        $res_action['history_msg'] = [$res_action['history_msg']];
-    }
-    
-    for ($i=0; $i<count($arr_res);$i++) {
-        if (!empty($arr_res[$i])) {
-            if (is_numeric($arr_res[$i])) {
-                $docLocker = new docLocker($arr_res[$i]);
-                $docLocker->unlock();
-            }
-            // Save action in history if needed
-            if ($bool_history=='Y') {
-                $what = '';
-                if (isset($_SESSION['current_basket']['id']) && !empty($_SESSION['current_basket']['id'])) {
-                    if (isset($_SESSION['current_basket']['basket_owner']) && !empty($_SESSION['current_basket']['basket_owner'])) {
-                        $pos =stripos($_SESSION['current_basket']['id'], $_SESSION['current_basket']['basket_owner']);
-                        $string = substr($_SESSION['current_basket']['id'], 0, $pos -1);
-                        $stmt = $db->query("SELECT basket_name FROM baskets WHERE basket_id = ?", array($string));
-                        while ($data = $stmt->fetchObject()) {
-                            $what = $data->basket_name;
-                            $what .= " (".$_SESSION['current_basket']['basket_owner'].")";
-                        }
-                    } else {
-                        $stmt = $db->query("SELECT basket_name FROM baskets WHERE basket_id = ?", array($_SESSION['current_basket']['id']));
-                        while ($data = $stmt->fetchObject()) {
-                            $what = $data->basket_name;
-                        }
-                    }
-                    
-                    $what .= ' : ';
-                }
-                //$what .= $label_action.'('._NUM.$arr_res[$i].') ';
-                $what .= $label_action;
-                if (isset($res_action['history_msg'][$i]) && !empty($res_action['history_msg'][$i])) {
-                    $what .= $res_action['history_msg'][$i];
-                }
-//                $_SESSION['info'] = $what . ' ';
-                if ($_POST['module'] == 'null') {
-                    $_POST['module'] = '';
-                }
-                $hist->add(
-                    $_POST['table'],
-                    $arr_res[$i],
-                    'ACTION#'.$id_action,
-                    $id_action,
-                    $what,
-                    $_SESSION['config']['databasetype'],
-                    $_POST['module']
-                );
-
-                // SEND MESSAGE EXCHANGE REVIEW M2M
-                // RM
-
-            }
-        }
-    }
-
-    exit();
-}
diff --git a/core/xml/config.xml b/core/xml/config.xml
index bebf93b1231..066b9e3498b 100755
--- a/core/xml/config.xml
+++ b/core/xml/config.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <ROOT>
     <CONFIG>
-        <defaultlanguage>fr</defaultlanguage>
         <default_timezone>Europe/Paris</default_timezone>
     </CONFIG>
     <BUSINESSAPPS>
@@ -10,7 +9,6 @@
     </BUSINESSAPPS>
     <TABLENAME>
         <actions>actions</actions>
-        <authors>authors</authors>
         <docservers>docservers</docservers>
         <doctypes>doctypes</doctypes>
         <history>history</history>
diff --git a/core/xml/config.xml.default b/core/xml/config.xml.default
index bebf93b1231..066b9e3498b 100755
--- a/core/xml/config.xml.default
+++ b/core/xml/config.xml.default
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <ROOT>
     <CONFIG>
-        <defaultlanguage>fr</defaultlanguage>
         <default_timezone>Europe/Paris</default_timezone>
     </CONFIG>
     <BUSINESSAPPS>
@@ -10,7 +9,6 @@
     </BUSINESSAPPS>
     <TABLENAME>
         <actions>actions</actions>
-        <authors>authors</authors>
         <docservers>docservers</docservers>
         <doctypes>doctypes</doctypes>
         <history>history</history>
diff --git a/src/frontend/app/save-numeric-package.component.ts b/src/frontend/app/save-numeric-package.component.ts
index 7caec04d88c..ac800c3a850 100755
--- a/src/frontend/app/save-numeric-package.component.ts
+++ b/src/frontend/app/save-numeric-package.component.ts
@@ -97,7 +97,6 @@ export class SaveNumericPackageComponent implements OnInit {
 
                         if (data.basketRedirection != null) {
                             window.location.href = data.basketRedirection;
-                            // action_send_first_request('index.php?display=true&page=manage_action&module=core', 'page',  22, '', 'res_letterbox', 'basket', 'letterbox_coll');
                         }
                     }
                 }, (err) => {
-- 
GitLab