From 123e5d2e50884634952acb712dee2df24b95432d Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Wed, 2 Aug 2023 21:36:49 +0200 Subject: [PATCH 01/24] #1 [Mod] add: project structure --- .editorconfig | 19 + .github/workflows/changelog.yml | 17 + COPYING | 621 ++++++++++++++++++++++++++++++ README.md | 54 ++- admin/index.php | 2 + admin/setup.php | 78 ++++ core/index.php | 2 + core/modules/index.php | 2 + core/modules/modTinyURL.class.php | 262 +++++++++++++ img/index.php | 2 + img/object_tinyurl_color.png | Bin 0 -> 3788 bytes img/tinyurl.png | Bin 0 -> 3558 bytes img/tinyurl_color.png | Bin 0 -> 3788 bytes index.php | 2 + langs/fr_FR/index.php | 2 + langs/fr_FR/tinyurl.lang | 37 ++ langs/index.php | 2 + lib/index.php | 2 + lib/tinyurl.lib.php | 56 +++ modulebuilder.txt | 3 + tinyurl.main.inc.php | 35 ++ tinyurlindex.php | 35 ++ 22 files changed, 1231 insertions(+), 2 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/changelog.yml create mode 100644 COPYING create mode 100644 admin/index.php create mode 100644 admin/setup.php create mode 100644 core/index.php create mode 100644 core/modules/index.php create mode 100644 core/modules/modTinyURL.class.php create mode 100644 img/index.php create mode 100644 img/object_tinyurl_color.png create mode 100644 img/tinyurl.png create mode 100644 img/tinyurl_color.png create mode 100644 index.php create mode 100644 langs/fr_FR/index.php create mode 100644 langs/fr_FR/tinyurl.lang create mode 100644 langs/index.php create mode 100644 lib/index.php create mode 100644 lib/tinyurl.lib.php create mode 100644 modulebuilder.txt create mode 100644 tinyurl.main.inc.php create mode 100644 tinyurlindex.php diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5b0885a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +# EditorConfig is awesome: https://editorconfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.php] +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 0000000..19d9a59 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,17 @@ +name: 'Generate Auto Changelog' +on: + push: + branches: + - main +jobs: + master: + name: 'build' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + fetch-depth: 0 + - name: Generate Auto Changelog + uses: Evarisk/action-auto-changelog@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a0453 --- /dev/null +++ b/COPYING @@ -0,0 +1,621 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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 diff --git a/README.md b/README.md index 3fd204c..5a86ae4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,52 @@ -# TinyURL - Creation of shortened urls for yourls and Dolibarr +# TinyURL sur [DOLIBARR ERP CRM](https://dolibarr.org) + +## Informations + +- Numéro du module : 436305 +- Dernière mise à jour : 02/08/2023 +- Éditeur : [Eoxia](https://eoxia.com) +- Thème : Eldy Menu +- Licence : GPLv3 +- Disponible sur : Windows - MacOS - Linux + +## Version + +- Version : 1.0.0 +- Compatibilité : Dolibarr 16.0.0 - 17.0.2 +- Saturne framework : 1.1.1 + +## Liens + +- Support & Assistance : [Forum dolibarr.fr](https://dolibarr.fr) / Par mail à technique@eoxia.com +- Demo : [Demo TinyURL](https://demodoli.digirisk.com) - ID: demo - Password: demo +- Documentation : [Wiki TinyURL](https://wiki.dolibarr.org/index.php/Module_TinyURL) +- Projet GitHub : [Projet TinyURL](https://github.com/Eoxia/tinyurl/projects?query=is%3Aopen) +- Saturne Framework : [Télécharger Saturne](https://dolistore.com/fr/modules/1906-Saturne.html) +- D'autres modules développés par Eoxia disponibles sur [DoliStore.com](https://dolistore.com) + +## Fonctionnalités + +- Création d'urls raccourcies pour YOURLS et Dolibarr + +## Traductions + +- Français +- Anglais + +## Installation + +### Méthode 1 : + +- Depuis le menu "Déployer/Installer un module externe" de Dolibarr : +- Glisser l'archive ZIP 'module_tinyurl-X.Y.Z' et cliquer sur "ENVOYER FICHIER" +- Glisser l'archive ZIP 'module_saturne-X.Y.Z' et cliquer sur "ENVOYER FICHIER" +- Activer le module dans la liste des Modules/Applications installés + +### Méthode 2 : + +- Dans le dossier "dolibarr/htdocs/custom" copier la ligne suivante : +``` +git clone -b main https://github.com/Eoxia/tinyurl.git tinyurl +git clone -b main https://github.com/Evarisk/saturne.git saturne +``` +- Activer le module dans la liste des Modules/Applications installés diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 0000000..cd6990e --- /dev/null +++ b/admin/index.php @@ -0,0 +1,2 @@ + + * + * 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 . + */ + +/** + * \file admin/setup.php + * \ingroup tinyurl + * \brief TinyURL setup page + */ + +// Load TinyURL environment +if (file_exists('../tinyurl.main.inc.php')) { + require_once __DIR__ . '/../tinyurl.main.inc.php'; +} elseif (file_exists('../../tinyurl.main.inc.php')) { + require_once __DIR__ . '/../../tinyurl.main.inc.php'; +} else { + die('Include of tinyurl main fails'); +} + +// Load Dolibarr libraries +require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; + +// Load TinyURL libraries +require_once __DIR__ . '/../lib/tinyurl.lib.php'; + +// Global variables definitions +global $conf, $db, $langs, $user; + +// Load translation files required by the page +saturne_load_langs(['admin']); + +// Get parameters +$action = GETPOST('action', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + +// Initialize view objects +$form = new Form($db); + +// Security check - Protection if external user +$permissionToRead = $user->rights->tinyurl->adminpage->read; +saturne_check_access($permissionToRead); + +/* + * Actions + */ + +/* + * View + */ + +$title = $langs->trans('ModuleSetup', 'TinyURL'); +$help_url = 'FR:Module_TinyURL'; + +saturne_header(0,'', $title, $help_url); + +// Subheader +$linkback = '' . $langs->trans('BackToModuleList') . ''; +print load_fiche_titre($title, $linkback, 'tinyurl_color@tinyurl'); + +// Configuration header +$head = tinyurl_admin_prepare_head(); +print dol_get_fiche_head($head, 'settings', $title, -1, 'tinyurl_color@tinyurl'); + +$db->close(); +llxFooter(); diff --git a/core/index.php b/core/index.php new file mode 100644 index 0000000..cd6990e --- /dev/null +++ b/core/index.php @@ -0,0 +1,2 @@ + + * + * 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 . + */ + +/** + * \defgroup tinyurl Module TinyURL + * \brief TinyURL module descriptor + * + * \file core/modules/modTinyURL.class.php + * \ingroup tinyurl + * \brief Description and activation file for module TinyURL + */ + +// Load Dolibarr libraries +require_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php'; + +/** + * Description and activation class for module TinyURL + */ +class modTinyURL extends DolibarrModules +{ + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $langs, $conf; + $this->db = $db; + + if (file_exists(__DIR__ . '/../../../saturne/lib/saturne_functions.lib.php')) { + require_once __DIR__ . '/../../../saturne/lib/saturne_functions.lib.php'; + saturne_load_langs(['tinyurl@tinyurl']); + } else { + $this->error++; + $this->errors[] = $langs->trans('activateModuleDependNotSatisfied', 'TinyURL', 'Saturne'); + } + + // ID for module (must be unique) + $this->numero = 436305; + + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'tinyurl'; + + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' + // It is used to group modules by family in module setup page + $this->family = ''; + + // Module position in the family on 2 digits ('01', '10', '20', ...) + $this->module_position = ''; + + // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) + $this->familyinfo = ['Eoxia' => ['position' => '01', 'label' => 'Eoxia']]; + // Module label (no space allowed), used if translation string 'ModuleTinyURLName' not found (TinyURL is name of module) + $this->name = preg_replace('/^mod/i', '', get_class($this)); + + // Module description, used if translation string 'ModuleTinyURLDesc' not found (TinyURL is name of module) + $this->description = $langs->trans('TinyURLDescription'); + // Used only if file README.md and README-LL.md not found + $this->descriptionlong = $langs->trans('TinyURLDescriptionLong'); + + // Author + $this->editor_name = 'Eoxia'; + $this->editor_url = 'https://eoxia.com'; + + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' + $this->version = '1.0.0'; + + // Url to the file with your last numberversion of this module + //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; + + // Key used in llx_const table to save module status enabled/disabled (where TINYURL is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); + + // Name of image file used for this module + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' + // To use a supported fa-xxx css style of font awesome, use this->picto='xxx' + $this->picto = 'tinyurl_color@tinyurl'; + + // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) + $this->module_parts = [ + // Set this to 1 if module has its own trigger directory (core/triggers) + 'triggers' => 1, + // Set this to 1 if module has its own login method file (core/login) + 'login' => 0, + // Set this to 1 if module has its own substitution function file (core/substitutions) + 'substitutions' => 0, + // Set this to 1 if module has its own menus handler directory (core/menus) + 'menus' => 0, + // Set this to 1 if module overwrite template dir (core/tpl) + 'tpl' => 1, + // Set this to 1 if module has its own barcode directory (core/modules/barcode) + 'barcode' => 0, + // Set this to 1 if module has its own models' directory (core/modules/xxx) + 'models' => 1, + // Set this to 1 if module has its own printing directory (core/modules/printing) + 'printing' => 0, + // Set this to 1 if module has its own theme directory (theme) + 'theme' => 0, + // Set this to relative path of css file if module has its own css file + 'css' => [], + // Set this to relative path of js file if module must load a js on all pages + 'js' => [], + // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all' + 'hooks' => [], + // Set this to 1 if features of module are opened to external users + 'moduleforexternal' => 1, + ]; + + // Data directories to create when module is enabled + // Example: this->dirs = array("/tinyurl/temp","/tinyurl/subdir"); + $this->dirs = ['/tinyurl/temp']; + + // Config pages. Put here list of php page, stored into tinyurl/admin directory, to use to set up module + $this->config_page_url = ['setup.php@tinyurl']; + + // Dependencies + // A condition to hide module + $this->hidden = false; + + // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) + $this->depends = ['modSaturne']; + $this->requiredby = []; // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) + $this->conflictwith = []; // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) + + // The language file dedicated to your module + $this->langfiles = ['tinyurl@tinyurl']; + + // Prerequisites + $this->phpmin = [7, 4]; // Minimum version of PHP required by module + $this->need_dolibarr_version = [16, 0]; // Minimum version of Dolibarr required by module + + // Messages at activation + $this->warnings_activation = []; // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','MX'='textmx'...) + $this->warnings_activation_ext = []; // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','MX'='textmx'...) + //$this->automatic_activation = array('FR'=>'TinyURLWasAutomaticallyActivatedBecauseOfYourCountryChoice'); + //$this->always_enabled = true; // If true, can't be disabled + + // Constants + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(1 => array('TINYURL_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1), + // 2 => array('TINYURL_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) + // ); + $i = 0; + $this->const = [ + // CONST MODULE + $i++ => ['TINYURL_VERSION','chaine', $this->version, '', 0, 'current'], + $i++ => ['TINYURL_DB_VERSION', 'chaine', $this->version, '', 0, 'current'], + $i => ['TINYURL_SHOW_PATCH_NOTE', 'integer', 1, '', 0, 'current'] + ]; + + // Some keys to add into the overwriting translation tables + /*$this->overwrite_translation = array( + 'en_US:ParentCompany'=>'Parent company or reseller', + 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' + )*/ + + if (!isset($conf->tinyurl) || !isset($conf->tinyurl->enabled)) { + $conf->tinyurl = new stdClass(); + $conf->tinyurl->enabled = 0; + } + + // Array to add new pages in new tabs + $this->tabs = []; + + // Dictionaries. + $this->dictionaries = []; + + // Boxes/Widgets + // Add here list of php file(s) stored in tinyurl/core/boxes that contains a class to show a widget + $this->boxes = []; + + // Cronjobs (List of cron jobs entries to add when module is enabled) + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week + $this->cronjobs = []; + + // Permissions provided by this module + $this->rights = []; + $r = 0; + + /* TINYURL PERMISSIONS */ + $this->rights[$r][0] = $this->numero . sprintf('%02d', $r + 1); // Permission id (must not be already used) + $this->rights[$r][1] = $langs->trans('LireModule', 'TinyURL'); // Permission label + $this->rights[$r][4] = 'lire'; // In php code, permission will be checked by test if ($user->rights->tinyurl->session->read) + $this->rights[$r][5] = 1; + $r++; + $this->rights[$r][0] = $this->numero . sprintf('%02d', $r + 1); + $this->rights[$r][1] = $langs->trans('ReadModule', 'TinyURL'); + $this->rights[$r][4] = 'read'; + $this->rights[$r][5] = 1; + $r++; + + /* ADMINPAGE PANEL ACCESS PERMISSIONS */ + $this->rights[$r][0] = $this->numero . sprintf('%02d', $r + 1); + $this->rights[$r][1] = $langs->transnoentities('ReadAdminPage', 'TinyURL'); + $this->rights[$r][4] = 'adminpage'; + $this->rights[$r][5] = 'read'; + + // Main menu entries to add + $this->menu = []; + } + + /** + * Function called when module is enabled + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + * @throws Exception + */ + public function init($options = ''): int + { + global $conf; + + // Permissions + $this->remove($options); + + $sql = []; + + dolibarr_set_const($this->db, 'TINYURL_VERSION', $this->version, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($this->db, 'TINYURL_DB_VERSION', $this->version, 'chaine', 0, '', $conf->entity); + + // Create extrafields during init +// require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; +// $extraFields = new ExtraFields($this->db); +// +// //$extraFields->update('label', $langs->transnoentities('Label'), 'varchar', '', 'contrat', 0, 0, 1040, '', '', '', 1); +// //$extraFields->addExtraField('label', $langs->transnoentities('Label'), 'varchar', 1040, '', 'contrat', 0, 0, '', '', '', '', 1); + + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled + * Remove from database constants, boxes and permissions from Dolibarr database + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = ''): int + { + $sql = []; + return $this->_remove($sql, $options); + } +} diff --git a/img/index.php b/img/index.php new file mode 100644 index 0000000..cd6990e --- /dev/null +++ b/img/index.php @@ -0,0 +1,2 @@ +g!rZS0RTcK#;48# z0C6b<(7ar5q!oH{VVA!#IRF6U{BMCwWBNh?5cV)RrEeRO`EA6?Pud96@?!}fKF#|p zlbI>>+RoBdCT5fLRdrBbaY zqhD_wzb+u>*gof5_Au(mwZ4w;-@mW2ZFA>h%S7M#pvMze7M{utiM}&LkJGpo?6p!f z%pbV57=XTTxMX^?KB+l^U#^(O13|8i10p|s>V@TM7q^`>f9l`B`>en~*)(fiQf=9( zCVu2C+b!}j$IKPO%z26PR3$aC7tUW=j<|m{TOJMEC#UM4vXXRhHIWYas|GWOy^P?W ze|E;k)($C7Nv3}mgj}QlU8|@4oY++)N0MaTHS>$ax)OHV~g}0)-pYQ<9(*ik!^b9TdFd9}R934lgi2|x9=nPc<^_Dv_gCO-%iavl+#ZxS23 z8<0l4A=?-X=rz|pkqKIpRDk!I&T<4A-gFM#U>bXN_vnd&P?i>e(@eH@NWjAgki>~_ z8`qUn0y(NEpk_hg*^7qf9e4%RGnz6%p`Z=i$>RRjNK*!4z_)M4l(~V1 zuh({f#=&cIArrVi!`_nLmrSr@T&jjkulgSe&k(1DTar zd;`C#y*JyZR)ol%UIF|jo9jCx-Dg#ct0Ut^;sj!)i~TA_hO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hGQ16w@ghn1TM)w9G$`>#I%HfQ7s%Qik2YVKz zvV}b^=8=Vf2D`WM3;Xl>r!}kOw2n`WuUV`J@aAF>Vezkw9c{9$jhQ_&0?4~SeQ&HX zny$}onT3${I6cWkRuGUROhNB4fA=Q4G>Zw@PiC%L!40{7?P?2w>fAE!1+5@-``D{lx>g$`A1}c&Q_8~NZKS}Mb8+R+gA%Pee16(eo&&i zAgs7LZD@(u9${4WQ3wxw_w$83XiT216a}e=Be0r~a#qt#$FkR^XxPV+e`iB*J8|XR zm^u}gDGxZ;8q#;J=F(mnmIDPF1`jiR=ZCpnrh?cEim7%mTOP#>!60*5BP9{8>B(N* zWNc&6t)>WZ!|DJO)0m<4JlCcnf?QS|=^!lw6uX}u0L@%iJG6AZYSKPThCln;K9^@~ zDr6C*sP@li(<834v&pLAWd@1%LffML=d_Z@N>FF)kW{N<=VC~2r@JO=`8%qVfYmy!tnJqy?%ry z)lll5W0x*AiH9^B77X)wBHNT(gO4In zAkBVy#b@@J8t8|Wliu~OKmkP&8YJR!eE8iQ&ResraG8-T37%DE=P0ack8xE`3)w9 LmZx4CxZe05u2YD8 literal 0 HcmV?d00001 diff --git a/img/tinyurl.png b/img/tinyurl.png new file mode 100644 index 0000000000000000000000000000000000000000..4f2c8030a15dc34e7e3dc7b6c72350c8b5fc3c1f GIT binary patch literal 3558 zcmc&%i8mBn8^5zL){!a65|X`8$d)DhPR5d*WEUdY8E@gWRkH7st-;JtmLf8}WyzYI z!cYihiOCwi>HE(4{)P9R^W5k6JomZh{LVf1p8Na~%}jJz7`Ye$04(}?TIK*iXb=LB zbTnrlhXB~iWhuZoJI*;jJ}Gr81R)y;zRu+8IS{*x-6 z_|8^J-&XXmjg80PJyqmQ2)`s0AX5N<3IZ${3HYV|jWBwyC*-z(n#^7-YDcWR;WuHv ztvZy(ku3MM=W_Yo0`qXb!~33H!sT~!&6`ccrn4gL;8;|GSUF}-@$VxS*){R%NbyY+vL;3u?`959Of&X!6GPZFv%2q9po==mI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z?C&a*-Ec`j@+q)lgukdfv~pU3DM(V4uzy#X?nH}$=IsyqPsgEJnAY5B55ICyoT7v-!&j}Aqr`s850boTuQ}ci`GQsTYS+A| z=Vb~#;4fZ5VgBD+$GhA+U!ODaD;IE9to*|w+y1^m3or-SMKFoTzI*S<1(BX=czK#R z-N;@SP7Z*Bisn*=*>Sl(V071I0d^jAT-rkXQ%EG#T#5yp-~JK@f(|#7ekIay5e@qi z9pp8wVPAIq=!>8!6RPas_HvePO!AQcF1v;!WTJ#YnnhXo>7&#iLN2TjX@~LBh=oIA z{(R!X*BJ)DYp4NCC%Rc}-Q@=b0QEw7I=!Cx_5g7mrwx{xA4kpP2(o?7yt>y{b5;mY ziMQ6t1H{%#E%^Me$JGm0j$LVg$aHp0o_V+?MI9M(nM-!7@kUA*aO=Ir9QvUN+Bad) z5V9N=Ckio}F;Ysnr-tdjp>E^jHC|&kdG;Yqh?JuKeL+GKLRA?<#{e(xd0syuyBiw=aT-R_?9Uj&r2ldH+9p~g4d=i914V`&jQ{`u literal 0 HcmV?d00001 diff --git a/img/tinyurl_color.png b/img/tinyurl_color.png new file mode 100644 index 0000000000000000000000000000000000000000..b3c18a363af541dc26cfe97b32355917e601f336 GIT binary patch literal 3788 zcmc&%`9IX#8$X|!!DJVWVwh2yTQb5WgbXG7QiPdoVQiH&WDTENvLq?u7D8o9CK*dv zVs6%<$xhiKvJ6GKvh$sO`Th&{yk5_Fzn}AZ&Urnr=Pb{2;;k)>g!rZS0RTcK#;48# z0C6b<(7ar5q!oH{VVA!#IRF6U{BMCwWBNh?5cV)RrEeRO`EA6?Pud96@?!}fKF#|p zlbI>>+RoBdCT5fLRdrBbaY zqhD_wzb+u>*gof5_Au(mwZ4w;-@mW2ZFA>h%S7M#pvMze7M{utiM}&LkJGpo?6p!f z%pbV57=XTTxMX^?KB+l^U#^(O13|8i10p|s>V@TM7q^`>f9l`B`>en~*)(fiQf=9( zCVu2C+b!}j$IKPO%z26PR3$aC7tUW=j<|m{TOJM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ubk&B%Dh;N^KrnHzFdd#=RI{R~y%Qw&emLg&s$hw)@VkBfJK+UBL@W zZNh&wvTxVAR6oI0G)@b&O7B4O_&_I)>Tew%&+AJe+`9qn}p zZ{20gPp{|o0Kvq2_4zHn%3!-?)tZ?|GIJb&LDA@Sm5@*kt@Qkr_t=;VX$udz`O09d z)<4+w2=V^vdOAauEhjG#EFDWBR#m2atqBqbXV08|VUoAz{O3OWo%pEG1;TkrG)%W0 ztttj(K=40UYOLTzjg4B`jCf&aN?ezAfu~!b#fDlI}2O`y9qWfmx`a( zuDv*OosR;}hF13VIE(zig);JH7Pg<|b@9(iIreYAYE|LctH=lIKzdSd9wZ0F8uhGQ16w@ghn1TM)w9G$`>#I%HfQ7s%Qik2YVKz zvV}b^=8=Vf2D`WM3;Xl>r!}kOw2n`WuUV`J@aAF>Vezkw9c{9$jhQ_&0?4~SeQ&HX zny$}onT3${I6cWkRuGUROhNB4fA=Q4G>Zw@PiC%L!40{7?P?2w>fAE!1+5@-``D{lx>g$`A1}c&Q_8~NZKS}Mb8+R+gA%Pee16(eo&&i zAgs7LZD@(u9${4WQ3wxw_w$83XiT216a}e=Be0r~a#qt#$FkR^XxPV+e`iB*J8|XR zm^u}gDGxZ;8q#;J=F(mnmIDPF1`jiR=ZCpnrh?cEim7%mTOP#>!60*5BP9{8>B(N* zWNc&6t)>WZ!|DJO)0m<4JlCcnf?QS|=^!lw6uX}u0L@%iJG6AZYSKPThCln;K9^@~ zDr6C*sP@li(<834v&pLAWd@1%LffML=d_Z@N>FF)kW{N<=VC~2r@JO=`8%qVfYmy!tnJqy?%ry z)lll5W0x*AiH9^B77X)wBHNT(gO4In zAkBVy#b@@J8t8|Wliu~OKmkP&8YJR!eE8iQ&ResraG8-T37%DE=P0ack8xE`3)w9 LmZx4CxZe05u2YD8 literal 0 HcmV?d00001 diff --git a/index.php b/index.php new file mode 100644 index 0000000..cd6990e --- /dev/null +++ b/index.php @@ -0,0 +1,2 @@ + +# +# 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 . + +# +# Générique +# + +# Data - Donnée +ModuleTinyURLName = TinyURL +ModuleTinyURLDesc = Création d'urls raccourcies pour YOURLS et Dolibarr +TinyURLDescription = Création d'urls raccourcies pour YOURLS et Dolibarr +TinyURLDescriptionLong = Création d'urls raccourcies pour YOURLS et Dolibarr + +# +# Config page - Page d'administration +# + +# Data - Donnée + + +# +# Other - Autre +# + +# Data - Donnée diff --git a/langs/index.php b/langs/index.php new file mode 100644 index 0000000..cd6990e --- /dev/null +++ b/langs/index.php @@ -0,0 +1,2 @@ + + * + * 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 . + */ + +/** + * \file lib/tinyurl.lib.php + * \ingroup tinyurl + * \brief Library files with common functions for Admin conf + */ + +/** + * Prepare admin pages header + * + * @return array $head Array of tabs + */ +function tinyurl_admin_prepare_head(): array +{ + // Global variables definitions + global $langs, $conf; + + // Load translation files required by the page + saturne_load_langs(); + + // Initialize values + $h = 0; + $head = []; + + $head[$h][0] = dol_buildpath('/tinyurl/admin/setup.php', 1); + $head[$h][1] = '' . $langs->trans('ModuleSettings'); + $head[$h][2] = 'settings'; + $h++; + + $head[$h][0] = dol_buildpath('/saturne/admin/about.php', 1) . '?module_name=TinyURL'; + $head[$h][1] = '' . $langs->trans('About'); + $head[$h][2] = 'about'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'tinyurl@tinyurl'); + + complete_head_from_modules($conf, $langs, null, $head, $h, 'tinyurl@tinyurl', 'remove'); + + return $head; +} diff --git a/modulebuilder.txt b/modulebuilder.txt new file mode 100644 index 0000000..670a177 --- /dev/null +++ b/modulebuilder.txt @@ -0,0 +1,3 @@ +# DO NOT DELETE THIS FILE MANUALLY +# File to flag module built using official module template. +# When this file is present into a module directory, you can edit it with the module builder tool. \ No newline at end of file diff --git a/tinyurl.main.inc.php b/tinyurl.main.inc.php new file mode 100644 index 0000000..2fe867c --- /dev/null +++ b/tinyurl.main.inc.php @@ -0,0 +1,35 @@ + + * + * 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 . + */ + +/** + * \file tinyurl.main.inc.php + * \ingroup tinyurl + * \brief File that defines environment for Saturne common functions + */ + +$moduleName = 'TinyURL'; +$moduleNameLowerCase = strtolower($moduleName); +$moduleNameUpperCase = strtoupper($moduleName); + +// Load Saturne environment +if (file_exists(__DIR__ . '/../saturne/saturne.main.inc.php')) { + require_once __DIR__ . '/../saturne/saturne.main.inc.php'; +} elseif (file_exists(__DIR__ . '/../../saturne/saturne.main.inc.php')) { + require_once __DIR__ . '/../../saturne/saturne.main.inc.php'; +} else { + die('Include of saturne main fails'); +} diff --git a/tinyurlindex.php b/tinyurlindex.php new file mode 100644 index 0000000..44610c8 --- /dev/null +++ b/tinyurlindex.php @@ -0,0 +1,35 @@ + + * + * 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 . + */ + +/** + * \file tinyurlindex.php + * \ingroup tinyurl + * \brief Home page of tinyurl top menu + */ + +// Load TinyURL environment +if (file_exists('tinyurl.main.inc.php')) { + require_once __DIR__ . '/tinyurl.main.inc.php'; +} elseif (file_exists('../tinyurl.main.inc.php')) { + require_once __DIR__ . '/../tinyurl.main.inc.php'; +} else { + die('Include of tinyurl main fails'); +} + +$showDashboard = false; + +require_once __DIR__ . '/../saturne/core/tpl/index/index_view.tpl.php'; From 64f58f3b5a7cb1b7f10f7f10364c08cda3ec44d4 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Wed, 2 Aug 2023 22:28:16 +0200 Subject: [PATCH 02/24] #2 [Triggers] add: config yourls api and triggers bill validate --- admin/setup.php | 56 +++++++++- core/triggers/index.php | 2 + ...ce_99_modTinyurl_TinyurlTriggers.class.php | 103 ++++++++++++++++++ 3 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 core/triggers/index.php create mode 100644 core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php diff --git a/admin/setup.php b/admin/setup.php index d576741..f46fa03 100644 --- a/admin/setup.php +++ b/admin/setup.php @@ -57,6 +57,28 @@ * Actions */ +if ($action == 'set_config') { + $userNameYourlsAPI = GETPOST('username_yourls_api'); + $keyYourlsAPI = GETPOST('key_yourls_api'); + $signatureTokenYourlsAPI = GETPOST('signature_token_yourls_api'); + + if (dol_strlen($userNameYourlsAPI) > 0) { + dolibarr_set_const($db, 'TINYURL_USERNAME_YOURLS_API', $userNameYourlsAPI, 'chaine', 0, '', $conf->entity); + } + if (dol_strlen($keyYourlsAPI) > 0) { + dolibarr_set_const($db, 'TINYURL_KEY_YOURLS_API', $keyYourlsAPI, 'chaine', 0, '', $conf->entity); + } + if (dol_strlen($signatureTokenYourlsAPI) > 0) { + dolibarr_set_const($db, 'TINYURL_SIGNATURE_TOKEN_YOURLS_API', $signatureTokenYourlsAPI, 'chaine', 0, '', $conf->entity); + } + + setEventMessage('SavedConfig'); + header('Location: ' . $_SERVER['PHP_SELF']); + exit; +} + + + /* * View */ @@ -68,11 +90,43 @@ // Subheader $linkback = '' . $langs->trans('BackToModuleList') . ''; -print load_fiche_titre($title, $linkback, 'tinyurl_color@tinyurl'); +print load_fiche_titre($title, $linkback, 'title_setup'); // Configuration header $head = tinyurl_admin_prepare_head(); print dol_get_fiche_head($head, 'settings', $title, -1, 'tinyurl_color@tinyurl'); +print load_fiche_titre($langs->trans('Config'), '', ''); + +print '
'; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print '
' . $langs->trans('Parameters') . '' . $langs->trans('Description') . '' . $langs->trans('Value') . '
' . $langs->trans('UserNameYourlsAPIDescription') . '
' . $langs->trans('KeyYourlsAPIDescription') . '
' . $langs->trans('SignatureTokenYourlsAPIDescription') . '
'; +print $form->buttonsSaveCancel('Save', '', [], 0, 'butAction'); +print '
'; + $db->close(); llxFooter(); diff --git a/core/triggers/index.php b/core/triggers/index.php new file mode 100644 index 0000000..17927e6 --- /dev/null +++ b/core/triggers/index.php @@ -0,0 +1,2 @@ + + * + * 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 . + */ + +/** + * \file core/triggers/interface_99_modTinyURL_DolisirhTriggers.class.php + * \ingroup tinyurl + * \brief TinyURL trigger + */ + +// Load Dolibarr libraries +require_once DOL_DOCUMENT_ROOT . '/core/triggers/dolibarrtriggers.class.php'; + +/** + * Class of triggers for TinyURL module + */ +class InterfaceTinyURLTriggers extends DolibarrTriggers +{ + /** + * @var DoliDB Database handler + */ + protected $db; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = 'demo'; + $this->description = 'TinyURL triggers.'; + $this->version = '1.0.0'; + $this->picto = 'tinyurl@tinyurl'; + } + + /** + * Trigger name + * + * @return string Name of trigger file + */ + public function getName(): string + { + return parent::getName(); + } + + /** + * Trigger description + * + * @return string Description of trigger file + */ + public function getDesc(): string + { + return parent::getDesc(); + } + + /** + * Function called when a Dolibarr business event is done + * All functions "runTrigger" are triggered if file + * is inside directory core/triggers + * + * @param string $action Event action code + * @param CommonObject $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param Conf $conf Object conf + * @return int 0 < if KO, 0 if no triggered ran, >0 if OK + * @throws Exception + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf): int + { + if (!isModEnabled('tinyurl')) { + return 0; // If module is not enabled, we do nothing + } + + saturne_load_langs(); + + // Data and type of action are stored into $object and $action + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . '. id=' . $object->id); + + switch ($action) { + case 'BILL_VALIDATE': + break; + } + return 0; + } +} From 8a8b1ea01f9f0acdbf764e0e262b8544f4700d64 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 3 Aug 2023 16:15:29 +0200 Subject: [PATCH 03/24] #2 [Admin] add: config sortURL --- admin/setup.php | 29 +++++++++++++---------------- langs/fr_FR/tinyurl.lang | 10 +++++++++- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/admin/setup.php b/admin/setup.php index f46fa03..01a00b8 100644 --- a/admin/setup.php +++ b/admin/setup.php @@ -58,15 +58,11 @@ */ if ($action == 'set_config') { - $userNameYourlsAPI = GETPOST('username_yourls_api'); - $keyYourlsAPI = GETPOST('key_yourls_api'); + $URLYourlsAPI = GETPOST('url_yourls_api'); $signatureTokenYourlsAPI = GETPOST('signature_token_yourls_api'); - if (dol_strlen($userNameYourlsAPI) > 0) { - dolibarr_set_const($db, 'TINYURL_USERNAME_YOURLS_API', $userNameYourlsAPI, 'chaine', 0, '', $conf->entity); - } - if (dol_strlen($keyYourlsAPI) > 0) { - dolibarr_set_const($db, 'TINYURL_KEY_YOURLS_API', $keyYourlsAPI, 'chaine', 0, '', $conf->entity); + if (dol_strlen($URLYourlsAPI) > 0) { + dolibarr_set_const($db, 'TINYURL_URL_YOURLS_API', $URLYourlsAPI, 'chaine', 0, '', $conf->entity); } if (dol_strlen($signatureTokenYourlsAPI) > 0) { dolibarr_set_const($db, 'TINYURL_SIGNATURE_TOKEN_YOURLS_API', $signatureTokenYourlsAPI, 'chaine', 0, '', $conf->entity); @@ -109,14 +105,9 @@ print '' . $langs->trans('Value') . ''; print ''; -print ''; -print '' . $langs->trans('UserNameYourlsAPIDescription') . ''; -print ''; -print ''; - -print ''; -print '' . $langs->trans('KeyYourlsAPIDescription') . ''; -print ''; +print ''; +print '' . $langs->trans('URLYourlsAPIDescription') . ''; +print ''; print ''; print ''; @@ -124,8 +115,14 @@ print ''; print ''; +print '' . $langs->trans('UseShaUrl') . ''; +print '' . $langs->trans('UseShaUrlDescription') . ''; +print ''; +print ajax_constantonoff('TINYURL_USE_SHA_URL'); +print ''; + print ''; -print $form->buttonsSaveCancel('Save', '', [], 0, 'butAction'); +print $form->buttonsSaveCancel('Save', ''); print ''; $db->close(); diff --git a/langs/fr_FR/tinyurl.lang b/langs/fr_FR/tinyurl.lang index d820ff6..b408821 100644 --- a/langs/fr_FR/tinyurl.lang +++ b/langs/fr_FR/tinyurl.lang @@ -28,10 +28,18 @@ TinyURLDescriptionLong = Création d'urls raccourcies pour YOURLS et Dolibarr # # Data - Donnée +URLYourlsAPI = URL API YOURLS +URLYourlsAPIDescription = Cette option permet de configurer l'url d'API YOURLS +SignatureTokenYourlsAPI = Token de signature +SignatureTokenYourlsAPIDescription = Cette option permet de configurer le token de signature d'API YOURLS +UseShaUrl = SHA dans la short URL +UseShaUrlDescription = Cette option permet de d'utiliser un SHA (8 caractères) dans la transformation d'une URL en short URL # -# Other - Autre +# TinyURL - TinyURL # # Data - Donnée +TinyUrlLink = Short URL +TinyUrlLinkHelp = Transformation d'une URL en short URL (Lien de paiement) From c522b5cf20c36ff9194a80909e358d7fd9886fcc Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 3 Aug 2023 16:16:48 +0200 Subject: [PATCH 04/24] #3 [Triggers] add: sortUrl on validate triggers --- ...ce_99_modTinyurl_TinyurlTriggers.class.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php index 5eba495..5f75d61 100644 --- a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php +++ b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php @@ -95,7 +95,46 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . '. id=' . $object->id); switch ($action) { + case 'PROPAL_VALIDATE': + case 'ORDER_VALIDATE': case 'BILL_VALIDATE': + $useOnlinePayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); + $checkConf = getDolGlobalString('TINYURL_URL_YOURLS_API') && getDolGlobalString('TINYURL_SIGNATURE_TOKEN_YOURLS_API'); + if ($useOnlinePayment && $checkConf) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; + + $object->fetch($object->id); + $onlinePaymentURL = getOnlinePaymentUrl(0, 'invoice', $object->ref); + + $title = dol_sanitizeFileName($conf->global->MAIN_INFO_SOCIETE_NOM . '-' . strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); + + // Init the CURL session + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $conf->global->TINYURL_URL_YOURLS_API); + curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request + curl_setopt($ch, CURLOPT_POSTFIELDS, [ // Data to POST + 'action' => 'shorturl', + 'signature' => $conf->global->TINYURL_SIGNATURE_TOKEN_YOURLS_API, + 'format' => 'json', + 'title' => $title, + 'keyword' => $title, + 'url' => $onlinePaymentURL + ]); + + // Fetch and return content + $data = curl_exec($ch); + curl_close($ch); + + // Do something with the result + $data = json_decode($data); + $object->array_options['options_tiny_url_link'] = $data->shorturl; + $object->update($user, false); + } + break; } return 0; From 8874fbe16f1c76d4b1e650cc83c771dc5bd97af6 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 3 Aug 2023 16:17:24 +0200 Subject: [PATCH 05/24] #4 [Mod] add: extrafields tiny_url_link --- core/modules/modTinyURL.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/modules/modTinyURL.class.php b/core/modules/modTinyURL.class.php index c898fa1..238953e 100644 --- a/core/modules/modTinyURL.class.php +++ b/core/modules/modTinyURL.class.php @@ -237,11 +237,15 @@ public function init($options = ''): int dolibarr_set_const($this->db, 'TINYURL_DB_VERSION', $this->version, 'chaine', 0, '', $conf->entity); // Create extrafields during init -// require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; -// $extraFields = new ExtraFields($this->db); -// -// //$extraFields->update('label', $langs->transnoentities('Label'), 'varchar', '', 'contrat', 0, 0, 1040, '', '', '', 1); -// //$extraFields->addExtraField('label', $langs->transnoentities('Label'), 'varchar', 1040, '', 'contrat', 0, 0, '', '', '', '', 1); + require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; + $extraFields = new ExtraFields($this->db); + + $extraFields->update('tiny_url_link', 'TinyUrlLink', 'url', '', 'propal', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + $extraFields->addExtraField('tiny_url_link', 'TinyUrlLink', 'url', 2000, '', 'propal', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + $extraFields->update('tiny_url_link', 'TinyUrlLink', 'url', '', 'commande', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + $extraFields->addExtraField('tiny_url_link', 'TinyUrlLink', 'url', 2000, '', 'commande', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + $extraFields->update('tiny_url_link', 'TinyUrlLink', 'url', '', 'facture', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + $extraFields->addExtraField('tiny_url_link', 'TinyUrlLink', 'url', 2000, '', 'facture', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); return $this->_init($sql, $options); } From 3d4c7e3eeeb682f61b04a8b648fae4fc3e230cd8 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 3 Aug 2023 16:31:56 +0200 Subject: [PATCH 06/24] #6 [Substitutons] add: tinyurl_completesubstitutionarray for use __TINY_URL_LINK__ in mail or sms template --- core/modules/modTinyURL.class.php | 2 +- core/substitutions/functions_tinyurl.lib.php | 43 ++++++++++++++++++++ core/substitutions/index.php | 2 + 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 core/substitutions/functions_tinyurl.lib.php create mode 100644 core/substitutions/index.php diff --git a/core/modules/modTinyURL.class.php b/core/modules/modTinyURL.class.php index 238953e..2529e8c 100644 --- a/core/modules/modTinyURL.class.php +++ b/core/modules/modTinyURL.class.php @@ -99,7 +99,7 @@ public function __construct($db) // Set this to 1 if module has its own login method file (core/login) 'login' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions) - 'substitutions' => 0, + 'substitutions' => 1, // Set this to 1 if module has its own menus handler directory (core/menus) 'menus' => 0, // Set this to 1 if module overwrite template dir (core/tpl) diff --git a/core/substitutions/functions_tinyurl.lib.php b/core/substitutions/functions_tinyurl.lib.php new file mode 100644 index 0000000..d7b0ea4 --- /dev/null +++ b/core/substitutions/functions_tinyurl.lib.php @@ -0,0 +1,43 @@ + + * + * 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 . + * or see https://www.gnu.org/ + */ + +/** + * \file core/substitutions/functions_tinyurl.lib.php + * \ingroup functions_tinyurl + * \brief File of functions to substitutions array + */ + +/** Function called to complete substitution array (before generating on ODT, or a personalized email) + * functions xxx_completesubstitutionarray are called by make_substitutions() if file + * is inside directory htdocs/core/substitutions + * + * @param array $substitutionarray Array with substitution key => val + * @param Translate $langs Output langs + * @param Object $object Object to use to get values + * @return void The entry parameter $substitutionarray is modified + */ +function tinyurl_completesubstitutionarray(&$substitutionarray, $langs, $object) +{ + switch ($object->element) { + case 'propal': + case 'commande': + case 'facture': + $substitutionarray['__TINY_URL_LINK__'] = $object->array_options['options_tiny_url_link']; + break; + } +} diff --git a/core/substitutions/index.php b/core/substitutions/index.php new file mode 100644 index 0000000..cd6990e --- /dev/null +++ b/core/substitutions/index.php @@ -0,0 +1,2 @@ + Date: Thu, 3 Aug 2023 16:52:31 +0200 Subject: [PATCH 07/24] #3 [Triggers] fix: fatal server --- core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php index 5f75d61..bad5ef4 100644 --- a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php +++ b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php @@ -89,8 +89,6 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf return 0; // If module is not enabled, we do nothing } - saturne_load_langs(); - // Data and type of action are stored into $object and $action dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . '. id=' . $object->id); From daa4f5887612973665bd5b1f570298e45ffe60de Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 3 Aug 2023 19:09:28 +0200 Subject: [PATCH 08/24] #10 [Hook] add: action set_tiny_url for set tiny url on extrafields --- class/actions_tinyurl.class.php | 115 ++++++++++++++++++ core/modules/modTinyURL.class.php | 6 +- ...ce_99_modTinyurl_TinyurlTriggers.class.php | 41 +------ langs/fr_FR/tinyurl.lang | 7 +- lib/tinyurl_function.lib.php | 74 +++++++++++ 5 files changed, 203 insertions(+), 40 deletions(-) create mode 100644 class/actions_tinyurl.class.php create mode 100644 lib/tinyurl_function.lib.php diff --git a/class/actions_tinyurl.class.php b/class/actions_tinyurl.class.php new file mode 100644 index 0000000..fb2c68a --- /dev/null +++ b/class/actions_tinyurl.class.php @@ -0,0 +1,115 @@ + + * + * 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 . + */ + +/** + * \file class/actions_tinyurl.class.php + * \ingroup tinyurl + * \brief TinyURL hook overload + */ + +/** + * Class ActionsTinyurl + */ +class ActionsTinyurl +{ + /** + * @var DoliDB Database handler + */ + public DoliDB $db; + + /** + * @var string Error code (or message) + */ + public string $error = ''; + + /** + * @var array Errors. + */ + public array $errors = []; + + /** + * @var array Hook results. Propagated to $hookmanager->resArray for later reuse + */ + public array $results = []; + + /** + * @var string String displayed by executeHook() immediately after return + */ + public string $resprints; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + } + + /** + * Overloading the printCommonFooter function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @return int 0 < on error, 0 on success, 1 to replace standard code + * @throws Exception + */ + public function printCommonFooter(array $parameters): int + { + global $object, $langs; + + if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard'])) { + if ($object->status > $object::STATUS_DRAFT) { + $jQueryElement = '.' . $object->element . '_extras_tiny_url_link'; + $output = ''; + $output .= img_picto($langs->trans('SetTinyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; ?> + + id); + exit; + } + } + + return 0; // or return 1 to replace standard code + } +} diff --git a/core/modules/modTinyURL.class.php b/core/modules/modTinyURL.class.php index 2529e8c..c25f098 100644 --- a/core/modules/modTinyURL.class.php +++ b/core/modules/modTinyURL.class.php @@ -117,7 +117,11 @@ public function __construct($db) // Set this to relative path of js file if module must load a js on all pages 'js' => [], // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all' - 'hooks' => [], + 'hooks' => [ + 'propalcard', + 'ordercard', + 'invoicecard' + ], // Set this to 1 if features of module are opened to external users 'moduleforexternal' => 1, ]; diff --git a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php index bad5ef4..970c4ce 100644 --- a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php +++ b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php @@ -24,6 +24,9 @@ // Load Dolibarr libraries require_once DOL_DOCUMENT_ROOT . '/core/triggers/dolibarrtriggers.class.php'; +// Load TinyURL libraries +require_once __DIR__ . '/../../lib/tinyurl_function.lib.php'; + /** * Class of triggers for TinyURL module */ @@ -96,43 +99,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf case 'PROPAL_VALIDATE': case 'ORDER_VALIDATE': case 'BILL_VALIDATE': - $useOnlinePayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); - $checkConf = getDolGlobalString('TINYURL_URL_YOURLS_API') && getDolGlobalString('TINYURL_SIGNATURE_TOKEN_YOURLS_API'); - if ($useOnlinePayment && $checkConf) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; - require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; - - $object->fetch($object->id); - $onlinePaymentURL = getOnlinePaymentUrl(0, 'invoice', $object->ref); - - $title = dol_sanitizeFileName($conf->global->MAIN_INFO_SOCIETE_NOM . '-' . strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); - - // Init the CURL session - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $conf->global->TINYURL_URL_YOURLS_API); - curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request - curl_setopt($ch, CURLOPT_POSTFIELDS, [ // Data to POST - 'action' => 'shorturl', - 'signature' => $conf->global->TINYURL_SIGNATURE_TOKEN_YOURLS_API, - 'format' => 'json', - 'title' => $title, - 'keyword' => $title, - 'url' => $onlinePaymentURL - ]); - - // Fetch and return content - $data = curl_exec($ch); - curl_close($ch); - - // Do something with the result - $data = json_decode($data); - $object->array_options['options_tiny_url_link'] = $data->shorturl; - $object->update($user, false); - } - + set_tiny_url_link($object); break; } return 0; diff --git a/langs/fr_FR/tinyurl.lang b/langs/fr_FR/tinyurl.lang index b408821..8834879 100644 --- a/langs/fr_FR/tinyurl.lang +++ b/langs/fr_FR/tinyurl.lang @@ -41,5 +41,8 @@ UseShaUrlDescription = Cette option permet de d'utiliser un SHA (8 # # Data - Donnée -TinyUrlLink = Short URL -TinyUrlLinkHelp = Transformation d'une URL en short URL (Lien de paiement) +TinyUrlLink = Short URL +TinyUrlLinkHelp = Transformation d'une URL en short URL (Lien de paiement) +SetTinyURLLink = Créer short URL +SetTinyURLSuccess = Création réussie d'une short URL +SetTinyURLErrors = Erreur : création d'une short URL diff --git a/lib/tinyurl_function.lib.php b/lib/tinyurl_function.lib.php new file mode 100644 index 0000000..bf59b2b --- /dev/null +++ b/lib/tinyurl_function.lib.php @@ -0,0 +1,74 @@ + + * + * 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 . + */ + +/** +* \file lib/tinyurl_function.lib.php +* \ingroup tinyurl +* \brief Library files with common functions for TinyURL +*/ + +/** + * Set tiny url link + * + * @param CommonObject $object Object + */ +function set_tiny_url_link(CommonObject $object) { + global $conf, $langs, $user; + + $useOnlinePayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); + $checkConf = getDolGlobalString('TINYURL_URL_YOURLS_API') && getDolGlobalString('TINYURL_SIGNATURE_TOKEN_YOURLS_API'); + if ($useOnlinePayment && $checkConf) { + // Load Dolibarr libraries + require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; + + $object->fetch($object->id); + $onlinePaymentURL = getOnlinePaymentUrl(0, 'invoice', $object->ref); + + $title = dol_sanitizeFileName($conf->global->MAIN_INFO_SOCIETE_NOM . '-' . strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); + + // Init the CURL session + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $conf->global->TINYURL_URL_YOURLS_API); + curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request + curl_setopt($ch, CURLOPT_POSTFIELDS, [ // Data to POST + 'action' => 'shorturl', + 'signature' => $conf->global->TINYURL_SIGNATURE_TOKEN_YOURLS_API, + 'format' => 'json', + 'title' => $title, + 'keyword' => $title, + 'url' => $onlinePaymentURL + ]); + + // Fetch and return content + $data = curl_exec($ch); + curl_close($ch); + + // Do something with the result + $data = json_decode($data); + $object->array_options['options_tiny_url_link'] = $data->shorturl; + $object->update($user, false); + if ($data->status == 'success') { + setEventMessage($langs->trans('SetTinyURLSuccess')); + } else { + setEventMessage($langs->trans('SetTinyURLErrors'), 'errors'); + } + } +} From 9e66ec2c07066c5fb28af0758fb8c2d265c11eed Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 3 Aug 2023 19:15:26 +0200 Subject: [PATCH 09/24] #10 [Lib] fix: strtolower for prevent name conflict --- lib/tinyurl_function.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyurl_function.lib.php b/lib/tinyurl_function.lib.php index bf59b2b..fdabb86 100644 --- a/lib/tinyurl_function.lib.php +++ b/lib/tinyurl_function.lib.php @@ -39,7 +39,7 @@ function set_tiny_url_link(CommonObject $object) { $object->fetch($object->id); $onlinePaymentURL = getOnlinePaymentUrl(0, 'invoice', $object->ref); - $title = dol_sanitizeFileName($conf->global->MAIN_INFO_SOCIETE_NOM . '-' . strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); + $title = dol_sanitizeFileName(strtolower($conf->global->MAIN_INFO_SOCIETE_NOM) . '-' . strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); // Init the CURL session $ch = curl_init(); From 07b49d9bd829f3242a4b62de83ba0076c1f7c616 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 7 Aug 2023 10:33:34 +0200 Subject: [PATCH 10/24] #12 #13 [Hook] add: check url and error code --- class/actions_tinyurl.class.php | 26 +++++++++------ langs/fr_FR/tinyurl.lang | 2 ++ lib/tinyurl_function.lib.php | 59 ++++++++++++++++++++++++++++++--- 3 files changed, 72 insertions(+), 15 deletions(-) diff --git a/class/actions_tinyurl.class.php b/class/actions_tinyurl.class.php index fb2c68a..b796d90 100644 --- a/class/actions_tinyurl.class.php +++ b/class/actions_tinyurl.class.php @@ -21,6 +21,9 @@ * \brief TinyURL hook overload */ +// Load TinyURL libraries +require_once __DIR__ . '/../lib/tinyurl_function.lib.php'; + /** * Class ActionsTinyurl */ @@ -74,14 +77,18 @@ public function printCommonFooter(array $parameters): int if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard'])) { if ($object->status > $object::STATUS_DRAFT) { - $jQueryElement = '.' . $object->element . '_extras_tiny_url_link'; - $output = ''; - $output .= img_picto($langs->trans('SetTinyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; ?> - - element . '_extras_tiny_url_link'; + $output = ''; + $output .= img_picto($langs->trans('SetTinyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; + $output .= '' . img_picto($langs->trans('GetTinyURLErrors'), 'fontawesome_fa-exclamation-triangle_fas_#bc9526') . ''; ?> + + id); diff --git a/langs/fr_FR/tinyurl.lang b/langs/fr_FR/tinyurl.lang index 8834879..1f114a2 100644 --- a/langs/fr_FR/tinyurl.lang +++ b/langs/fr_FR/tinyurl.lang @@ -46,3 +46,5 @@ TinyUrlLinkHelp = Transformation d'une URL en short URL (Lien de paiement) SetTinyURLLink = Créer short URL SetTinyURLSuccess = Création réussie d'une short URL SetTinyURLErrors = Erreur : création d'une short URL +GetTinyURLErrors = Erreur : short URL non trouvée + diff --git a/lib/tinyurl_function.lib.php b/lib/tinyurl_function.lib.php index fdabb86..f1744d5 100644 --- a/lib/tinyurl_function.lib.php +++ b/lib/tinyurl_function.lib.php @@ -37,9 +37,20 @@ function set_tiny_url_link(CommonObject $object) { require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; $object->fetch($object->id); - $onlinePaymentURL = getOnlinePaymentUrl(0, 'invoice', $object->ref); + switch ($object->element) { + case 'commande' : + $type = 'order'; + break; + case 'facture' : + $type = 'invoice'; + break; + default : + $type = $object->element; + break; + } + $onlinePaymentURL = getOnlinePaymentUrl(0, $type, $object->ref); - $title = dol_sanitizeFileName(strtolower($conf->global->MAIN_INFO_SOCIETE_NOM) . '-' . strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); + $title = dol_sanitizeFileName(dol_strtolower($conf->global->MAIN_INFO_SOCIETE_NOM) . '-' . strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); // Init the CURL session $ch = curl_init(); @@ -63,12 +74,52 @@ function set_tiny_url_link(CommonObject $object) { // Do something with the result $data = json_decode($data); - $object->array_options['options_tiny_url_link'] = $data->shorturl; - $object->update($user, false); if ($data->status == 'success') { + $object->array_options['options_tiny_url_link'] = $data->shorturl; + $object->update($user, false); setEventMessage($langs->trans('SetTinyURLSuccess')); } else { setEventMessage($langs->trans('SetTinyURLErrors'), 'errors'); } } } + +/** + * get tiny url link + * + * @param CommonObject $object Object + * @return int 0 < on error, 1 = statusCode 200, 0 = other statusCode (ex : 404) + */ +function get_tiny_url_link(CommonObject $object) { + global $conf; + + $useOnlinePayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); + $checkConf = getDolGlobalString('TINYURL_URL_YOURLS_API') && getDolGlobalString('TINYURL_SIGNATURE_TOKEN_YOURLS_API'); + if ($useOnlinePayment && $checkConf) { + $object->fetch($object->id); + + // Init the CURL session + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $conf->global->TINYURL_URL_YOURLS_API); + curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request + curl_setopt($ch, CURLOPT_POSTFIELDS, [ // Data to POST + 'action' => 'url-stats', + 'signature' => $conf->global->TINYURL_SIGNATURE_TOKEN_YOURLS_API, + 'format' => 'json', + 'shorturl' => $object->array_options['options_tiny_url_link'] + ]); + + // Fetch and return content + $data = curl_exec($ch); + curl_close($ch); + + // Do something with the result + $data = json_decode($data); + return $data->statusCode == 200 ? 1 : 0; + } else { + return -1; + } +} From c01c5531fb6038cc9203bfd9f1e63ac27e104125 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 7 Aug 2023 10:48:45 +0200 Subject: [PATCH 11/24] #14 [Admin] add: conf for manage tinyUrl generation --- admin/setup.php | 12 ++++++++++++ class/actions_tinyurl.class.php | 2 +- core/modules/modTinyURL.class.php | 4 ++++ ...face_99_modTinyurl_TinyurlTriggers.class.php | 4 +++- langs/fr_FR/tinyurl.lang | 17 +++++++++++------ 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/admin/setup.php b/admin/setup.php index 01a00b8..8cbd529 100644 --- a/admin/setup.php +++ b/admin/setup.php @@ -121,6 +121,18 @@ print ajax_constantonoff('TINYURL_USE_SHA_URL'); print ''; +print '' . $langs->trans('AutomaticTinyUrlGeneration') . ''; +print '' . $langs->trans('AutomaticTinyUrlGenerationDescription') . ''; +print ''; +print ajax_constantonoff('TINYURL_AUTOMATIC_GENERATION'); +print ''; + +print '' . $langs->trans('ManualTinyUrlGeneration') . ''; +print '' . $langs->trans('ManualTinyUrlGenerationDescription') . ''; +print ''; +print ajax_constantonoff('TINYURL_MANUAL_GENERATION'); +print ''; + print ''; print $form->buttonsSaveCancel('Save', ''); print ''; diff --git a/class/actions_tinyurl.class.php b/class/actions_tinyurl.class.php index b796d90..402f55e 100644 --- a/class/actions_tinyurl.class.php +++ b/class/actions_tinyurl.class.php @@ -76,7 +76,7 @@ public function printCommonFooter(array $parameters): int global $object, $langs; if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard'])) { - if ($object->status > $object::STATUS_DRAFT) { + if ($object->status > $object::STATUS_DRAFT && getDolGlobalInt('TINYURL_MANUAL_GENERATION')) { $checkTinyUrlLink = get_tiny_url_link($object); if ($checkTinyUrlLink == 0) { $jQueryElement = '.' . $object->element . '_extras_tiny_url_link'; diff --git a/core/modules/modTinyURL.class.php b/core/modules/modTinyURL.class.php index c25f098..b7eb703 100644 --- a/core/modules/modTinyURL.class.php +++ b/core/modules/modTinyURL.class.php @@ -162,6 +162,10 @@ public function __construct($db) // ); $i = 0; $this->const = [ + // CONST CONFIGURATION + $i++ => ['TINYURL_AUTOMATIC_GENERATION','integer', 1, '', 0, 'current'], + $i++ => ['TINYURL_MANUAL_GENERATION', 'integer', 1, '', 0, 'current'], + // CONST MODULE $i++ => ['TINYURL_VERSION','chaine', $this->version, '', 0, 'current'], $i++ => ['TINYURL_DB_VERSION', 'chaine', $this->version, '', 0, 'current'], diff --git a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php index 970c4ce..ab472b9 100644 --- a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php +++ b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php @@ -99,7 +99,9 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf case 'PROPAL_VALIDATE': case 'ORDER_VALIDATE': case 'BILL_VALIDATE': - set_tiny_url_link($object); + if (getDolGlobalInt('TINYURL_AUTOMATIC_GENERATION')) { + set_tiny_url_link($object); + } break; } return 0; diff --git a/langs/fr_FR/tinyurl.lang b/langs/fr_FR/tinyurl.lang index 1f114a2..5e61071 100644 --- a/langs/fr_FR/tinyurl.lang +++ b/langs/fr_FR/tinyurl.lang @@ -28,12 +28,17 @@ TinyURLDescriptionLong = Création d'urls raccourcies pour YOURLS et Dolibarr # # Data - Donnée -URLYourlsAPI = URL API YOURLS -URLYourlsAPIDescription = Cette option permet de configurer l'url d'API YOURLS -SignatureTokenYourlsAPI = Token de signature -SignatureTokenYourlsAPIDescription = Cette option permet de configurer le token de signature d'API YOURLS -UseShaUrl = SHA dans la short URL -UseShaUrlDescription = Cette option permet de d'utiliser un SHA (8 caractères) dans la transformation d'une URL en short URL +URLYourlsAPI = URL API YOURLS +URLYourlsAPIDescription = Cette option permet de configurer l'url d'API YOURLS +SignatureTokenYourlsAPI = Token de signature +SignatureTokenYourlsAPIDescription = Cette option permet de configurer le token de signature d'API YOURLS +UseShaUrl = SHA dans la short URL +UseShaUrlDescription = Cette option permet de d'utiliser un SHA (8 caractères) dans la transformation d'une URL en short URL +AutomaticTinyUrlGeneration = Génération automatique des shorts URL +AutomaticTinyUrlGenerationDescription = Crée automatiquement la short URL lors de la validation d'un objet
(propositon commerciale, commande, facture) +ManualTinyUrlGeneration = Génération manuelle des shorts URL +ManualTinyUrlGenerationDescription = Ajout d'un bouton pour créer une short URL sur un objet
(propositon commerciale, commande, facture) + # From ae6d76bffc4466f517c0f3249f1b480964523917 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 7 Aug 2023 11:07:29 +0200 Subject: [PATCH 12/24] #11 [Hook] add: copy/paste url --- class/actions_tinyurl.class.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/class/actions_tinyurl.class.php b/class/actions_tinyurl.class.php index 402f55e..5081087 100644 --- a/class/actions_tinyurl.class.php +++ b/class/actions_tinyurl.class.php @@ -76,19 +76,22 @@ public function printCommonFooter(array $parameters): int global $object, $langs; if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard'])) { - if ($object->status > $object::STATUS_DRAFT && getDolGlobalInt('TINYURL_MANUAL_GENERATION')) { + if ($object->status > $object::STATUS_DRAFT) { $checkTinyUrlLink = get_tiny_url_link($object); - if ($checkTinyUrlLink == 0) { - $jQueryElement = '.' . $object->element . '_extras_tiny_url_link'; - $output = ''; + $jQueryElement = '.' . $object->element . '_extras_tiny_url_link'; + if ($checkTinyUrlLink == 0 && getDolGlobalInt('TINYURL_MANUAL_GENERATION')) { + $output = ''; $output .= img_picto($langs->trans('SetTinyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; - $output .= '' . img_picto($langs->trans('GetTinyURLErrors'), 'fontawesome_fa-exclamation-triangle_fas_#bc9526') . ''; ?> - - ' . img_picto($langs->trans('GetTinyURLErrors'), 'fontawesome_fa-exclamation-triangle_fas_#bc9526') . ''; } + if (!empty($object->array_options['options_tiny_url_link']) && $checkTinyUrlLink > 0) { + $output = showValueWithClipboardCPButton($object->array_options['options_tiny_url_link'], 0, 'none'); + } ?> + + Date: Mon, 7 Aug 2023 16:38:37 +0200 Subject: [PATCH 13/24] #15 [Mod] add: new extrafields management for use online signature link --- class/actions_tinyurl.class.php | 33 ++++++++-------- core/modules/modTinyURL.class.php | 21 +++++++--- core/substitutions/functions_tinyurl.lib.php | 3 +- ...ce_99_modTinyurl_TinyurlTriggers.class.php | 6 ++- langs/fr_FR/tinyurl.lang | 13 ++++--- lib/tinyurl_function.lib.php | 38 ++++++++++++++----- 6 files changed, 75 insertions(+), 39 deletions(-) diff --git a/class/actions_tinyurl.class.php b/class/actions_tinyurl.class.php index 5081087..36b3514 100644 --- a/class/actions_tinyurl.class.php +++ b/class/actions_tinyurl.class.php @@ -77,21 +77,24 @@ public function printCommonFooter(array $parameters): int if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard'])) { if ($object->status > $object::STATUS_DRAFT) { - $checkTinyUrlLink = get_tiny_url_link($object); - $jQueryElement = '.' . $object->element . '_extras_tiny_url_link'; - if ($checkTinyUrlLink == 0 && getDolGlobalInt('TINYURL_MANUAL_GENERATION')) { - $output = ''; - $output .= img_picto($langs->trans('SetTinyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; - $output .= '' . img_picto($langs->trans('GetTinyURLErrors'), 'fontawesome_fa-exclamation-triangle_fas_#bc9526') . ''; + $urlTypes = ['payment', 'signature']; + foreach ($urlTypes as $urlType) { + $checkTinyUrlLink = get_tiny_url_link($object, $urlType); + $jQueryElement = '.' . $object->element . '_extras_tiny_url_' . $urlType . '_link'; + if ($checkTinyUrlLink == 0 && getDolGlobalInt('TINYURL_MANUAL_GENERATION')) { + $output = ''; + $output .= img_picto($langs->trans('SetTinyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; + $output .= '' . img_picto($langs->trans('GetTinyURLErrors'), 'fontawesome_fa-exclamation-triangle_fas_#bc9526') . ''; + } + if (!empty($object->array_options['options_tiny_url_' . $urlType . '_link']) && $checkTinyUrlLink > 0) { + $output = showValueWithClipboardCPButton($object->array_options['options_tiny_url_' . $urlType . '_link'], 0, 'none'); + } ?> + + array_options['options_tiny_url_link']) && $checkTinyUrlLink > 0) { - $output = showValueWithClipboardCPButton($object->array_options['options_tiny_url_link'], 0, 'none'); - } ?> - - id); exit; diff --git a/core/modules/modTinyURL.class.php b/core/modules/modTinyURL.class.php index b7eb703..4821f25 100644 --- a/core/modules/modTinyURL.class.php +++ b/core/modules/modTinyURL.class.php @@ -248,12 +248,21 @@ public function init($options = ''): int require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $extraFields = new ExtraFields($this->db); - $extraFields->update('tiny_url_link', 'TinyUrlLink', 'url', '', 'propal', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); - $extraFields->addExtraField('tiny_url_link', 'TinyUrlLink', 'url', 2000, '', 'propal', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); - $extraFields->update('tiny_url_link', 'TinyUrlLink', 'url', '', 'commande', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); - $extraFields->addExtraField('tiny_url_link', 'TinyUrlLink', 'url', 2000, '', 'commande', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); - $extraFields->update('tiny_url_link', 'TinyUrlLink', 'url', '', 'facture', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); - $extraFields->addExtraField('tiny_url_link', 'TinyUrlLink', 'url', 2000, '', 'facture', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + // Propal extrafiels + $extraFields->update('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', '', 'propal', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + $extraFields->addExtraField('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', 2000, '', 'propal', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + + // Order extrafiels + $extraFields->update('tiny_url_payment_link', 'TinyUrlPaymentLink', 'url', '', 'commande', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + $extraFields->addExtraField('tiny_url_payment_link', 'TinyUrlPaymentLink', 'url', 2000, '', 'commande', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + //$extraFields->update('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', '', 'commande', 0, 0, 2010, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + //$extraFields->addExtraField('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', 2010, '', 'commande', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + + // Invoice extrafiels + $extraFields->update('tiny_url_payment_link', 'TinyUrlPaymentLink', 'url', '', 'facture', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + $extraFields->addExtraField('tiny_url_payment_link', 'TinyUrlPaymentLink', 'url', 2000, '', 'facture', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + //$extraFields->update('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', '', 'facture', 0, 0, 2010, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + //$extraFields->addExtraField('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', 2010, '', 'facture', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); return $this->_init($sql, $options); } diff --git a/core/substitutions/functions_tinyurl.lib.php b/core/substitutions/functions_tinyurl.lib.php index d7b0ea4..e6bf994 100644 --- a/core/substitutions/functions_tinyurl.lib.php +++ b/core/substitutions/functions_tinyurl.lib.php @@ -37,7 +37,8 @@ function tinyurl_completesubstitutionarray(&$substitutionarray, $langs, $object) case 'propal': case 'commande': case 'facture': - $substitutionarray['__TINY_URL_LINK__'] = $object->array_options['options_tiny_url_link']; + $substitutionarray['__TINY_URL_PAYMENT_LINK__'] = $object->array_options['options_tiny_url_payment_link']; + $substitutionarray['__TINY_URL_SIGNATURE_LINK__'] = $object->array_options['options_tiny_url_signature_link']; break; } } diff --git a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php index ab472b9..a7e8f19 100644 --- a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php +++ b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php @@ -97,10 +97,14 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf switch ($action) { case 'PROPAL_VALIDATE': + if (getDolGlobalInt('TINYURL_AUTOMATIC_GENERATION')) { + set_tiny_url_link($object, 'signature'); + } + break; case 'ORDER_VALIDATE': case 'BILL_VALIDATE': if (getDolGlobalInt('TINYURL_AUTOMATIC_GENERATION')) { - set_tiny_url_link($object); + set_tiny_url_link($object, 'payment'); } break; } diff --git a/langs/fr_FR/tinyurl.lang b/langs/fr_FR/tinyurl.lang index 5e61071..4d75ecb 100644 --- a/langs/fr_FR/tinyurl.lang +++ b/langs/fr_FR/tinyurl.lang @@ -46,10 +46,11 @@ ManualTinyUrlGenerationDescription = Ajout d'un bouton pour créer une short # # Data - Donnée -TinyUrlLink = Short URL -TinyUrlLinkHelp = Transformation d'une URL en short URL (Lien de paiement) -SetTinyURLLink = Créer short URL -SetTinyURLSuccess = Création réussie d'une short URL -SetTinyURLErrors = Erreur : création d'une short URL -GetTinyURLErrors = Erreur : short URL non trouvée +TinyUrlPaymentLink = Short URL de paiement +TinyUrlSignatureLink = Short URL de signature +TinyUrlLinkHelp = Transformation d'une URL en short URL (lien de paiement, lien de signature) +SetTinyURLLink = Créer short URL +SetTinyURLSuccess = Création réussie d'une short URL +SetTinyURLErrors = Erreur : création d'une short URL +GetTinyURLErrors = Erreur : short URL non trouvée diff --git a/lib/tinyurl_function.lib.php b/lib/tinyurl_function.lib.php index f1744d5..68dc3f6 100644 --- a/lib/tinyurl_function.lib.php +++ b/lib/tinyurl_function.lib.php @@ -24,20 +24,26 @@ /** * Set tiny url link * - * @param CommonObject $object Object + * @param CommonObject $object Object + * @param string $urlType Url type */ -function set_tiny_url_link(CommonObject $object) { +function set_tiny_url_link(CommonObject $object, string $urlType) +{ global $conf, $langs, $user; $useOnlinePayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); $checkConf = getDolGlobalString('TINYURL_URL_YOURLS_API') && getDolGlobalString('TINYURL_SIGNATURE_TOKEN_YOURLS_API'); - if ($useOnlinePayment && $checkConf) { + if ((($urlType == 'payment' && $useOnlinePayment) || $urlType == 'signature') && $checkConf) { // Load Dolibarr libraries require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php'; $object->fetch($object->id); switch ($object->element) { + case 'propal' : + $type = 'proposal'; + break; case 'commande' : $type = 'order'; break; @@ -48,9 +54,19 @@ function set_tiny_url_link(CommonObject $object) { $type = $object->element; break; } - $onlinePaymentURL = getOnlinePaymentUrl(0, $type, $object->ref); + switch ($urlType) { + case 'payment' : + $onlineUrl = getOnlinePaymentUrl(0, $type, $object->ref); + break; + case 'signature' : + $onlineUrl = getOnlineSignatureUrl(0, $type, $object->ref); + break; + default : + $onlineUrl = ''; + break; + } - $title = dol_sanitizeFileName(dol_strtolower($conf->global->MAIN_INFO_SOCIETE_NOM) . '-' . strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); + $title = dol_sanitizeFileName(dol_strtolower($conf->global->MAIN_INFO_SOCIETE_NOM) . '-' . dol_strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); // Init the CURL session $ch = curl_init(); @@ -65,7 +81,7 @@ function set_tiny_url_link(CommonObject $object) { 'format' => 'json', 'title' => $title, 'keyword' => $title, - 'url' => $onlinePaymentURL + 'url' => $onlineUrl ]); // Fetch and return content @@ -75,7 +91,7 @@ function set_tiny_url_link(CommonObject $object) { // Do something with the result $data = json_decode($data); if ($data->status == 'success') { - $object->array_options['options_tiny_url_link'] = $data->shorturl; + $object->array_options['options_tiny_url_' . $urlType . '_link'] = $data->shorturl; $object->update($user, false); setEventMessage($langs->trans('SetTinyURLSuccess')); } else { @@ -88,14 +104,16 @@ function set_tiny_url_link(CommonObject $object) { * get tiny url link * * @param CommonObject $object Object + * @param string $urlType Url type * @return int 0 < on error, 1 = statusCode 200, 0 = other statusCode (ex : 404) */ -function get_tiny_url_link(CommonObject $object) { +function get_tiny_url_link(CommonObject $object, string $urlType): int +{ global $conf; $useOnlinePayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); $checkConf = getDolGlobalString('TINYURL_URL_YOURLS_API') && getDolGlobalString('TINYURL_SIGNATURE_TOKEN_YOURLS_API'); - if ($useOnlinePayment && $checkConf) { + if ((($urlType == 'payment' && $useOnlinePayment) || $urlType == 'signature') && $checkConf) { $object->fetch($object->id); // Init the CURL session @@ -109,7 +127,7 @@ function get_tiny_url_link(CommonObject $object) { 'action' => 'url-stats', 'signature' => $conf->global->TINYURL_SIGNATURE_TOKEN_YOURLS_API, 'format' => 'json', - 'shorturl' => $object->array_options['options_tiny_url_link'] + 'shorturl' => $object->array_options['options_tiny_url_' . $urlType . '_link'] ]); // Fetch and return content From 16079914936159652f78843c25d11bd29c96d099 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 7 Aug 2023 16:42:16 +0200 Subject: [PATCH 14/24] #16 [Trad] add: improve trasd and change type input --- admin/setup.php | 2 +- langs/fr_FR/tinyurl.lang | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/admin/setup.php b/admin/setup.php index 8cbd529..e3cae6e 100644 --- a/admin/setup.php +++ b/admin/setup.php @@ -112,7 +112,7 @@ print ''; print '' . $langs->trans('SignatureTokenYourlsAPIDescription') . ''; -print ''; +print ''; print ''; print '' . $langs->trans('UseShaUrl') . ''; diff --git a/langs/fr_FR/tinyurl.lang b/langs/fr_FR/tinyurl.lang index 4d75ecb..3e87dbc 100644 --- a/langs/fr_FR/tinyurl.lang +++ b/langs/fr_FR/tinyurl.lang @@ -32,12 +32,12 @@ URLYourlsAPI = URL API YOURLS URLYourlsAPIDescription = Cette option permet de configurer l'url d'API YOURLS SignatureTokenYourlsAPI = Token de signature SignatureTokenYourlsAPIDescription = Cette option permet de configurer le token de signature d'API YOURLS -UseShaUrl = SHA dans la short URL -UseShaUrlDescription = Cette option permet de d'utiliser un SHA (8 caractères) dans la transformation d'une URL en short URL -AutomaticTinyUrlGeneration = Génération automatique des shorts URL -AutomaticTinyUrlGenerationDescription = Crée automatiquement la short URL lors de la validation d'un objet
(propositon commerciale, commande, facture) -ManualTinyUrlGeneration = Génération manuelle des shorts URL -ManualTinyUrlGenerationDescription = Ajout d'un bouton pour créer une short URL sur un objet
(propositon commerciale, commande, facture) +UseShaUrl = SHA dans l'URL raccourcie +UseShaUrlDescription = Cette option permet d'ajouter un SHA (8 caractères) dans le raccourcicement des URLs +AutomaticTinyUrlGeneration = Génération automatique des URLs raccourcies +AutomaticTinyUrlGenerationDescription = Crée automatiquement l'URL raccourcie lors de la validation d'un objet
(propositon commerciale, commande, facture) +ManualTinyUrlGeneration = Génération manuelle des URLs raccourcies +ManualTinyUrlGenerationDescription = Ajout d'un bouton pour créer une URL raccourcie sur un objet
(propositon commerciale, commande, facture) @@ -46,11 +46,11 @@ ManualTinyUrlGenerationDescription = Ajout d'un bouton pour créer une short # # Data - Donnée -TinyUrlPaymentLink = Short URL de paiement -TinyUrlSignatureLink = Short URL de signature -TinyUrlLinkHelp = Transformation d'une URL en short URL (lien de paiement, lien de signature) -SetTinyURLLink = Créer short URL -SetTinyURLSuccess = Création réussie d'une short URL -SetTinyURLErrors = Erreur : création d'une short URL -GetTinyURLErrors = Erreur : short URL non trouvée +TinyUrlPaymentLink = TinyURL-paiement +TinyUrlSignatureLink = TinyURL-signature +TinyUrlLinkHelp = Transformation d'une URL en URL raccourcie (lien de paiement, lien de signature) +SetTinyURLLink = Créer URL raccourcie +SetTinyURLSuccess = Création réussie de l'URL raccourcie +SetTinyURLErrors = Erreur : création de l'URL raccourcie +GetTinyURLErrors = Erreur : URL raccourcie non trouvée From 26c63776833110d77fe608011c844ed80e7c961c Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 7 Aug 2023 17:01:36 +0200 Subject: [PATCH 15/24] #17 [Mod] add: online sign for contract/fichinter --- class/actions_tinyurl.class.php | 4 +-- core/modules/modTinyURL.class.php | 32 ++++++++++++------- core/substitutions/functions_tinyurl.lib.php | 11 ++++--- ...ce_99_modTinyurl_TinyurlTriggers.class.php | 2 ++ lib/tinyurl_function.lib.php | 3 ++ 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/class/actions_tinyurl.class.php b/class/actions_tinyurl.class.php index 36b3514..f5ca1d6 100644 --- a/class/actions_tinyurl.class.php +++ b/class/actions_tinyurl.class.php @@ -75,7 +75,7 @@ public function printCommonFooter(array $parameters): int { global $object, $langs; - if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard'])) { + if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard', 'contractcard', 'interventioncard'])) { if ($object->status > $object::STATUS_DRAFT) { $urlTypes = ['payment', 'signature']; foreach ($urlTypes as $urlType) { @@ -111,7 +111,7 @@ public function printCommonFooter(array $parameters): int */ public function doActions(array $parameters, $object, string $action): int { - if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard'])) { + if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard', 'contractcard', 'interventioncard'])) { if ($action == 'set_tiny_url') { set_tiny_url_link($object, GETPOST('url_type')); diff --git a/core/modules/modTinyURL.class.php b/core/modules/modTinyURL.class.php index 4821f25..0f6fa55 100644 --- a/core/modules/modTinyURL.class.php +++ b/core/modules/modTinyURL.class.php @@ -120,7 +120,9 @@ public function __construct($db) 'hooks' => [ 'propalcard', 'ordercard', - 'invoicecard' + 'invoicecard', + 'contractcard', + 'interventioncard' ], // Set this to 1 if features of module are opened to external users 'moduleforexternal' => 1, @@ -163,13 +165,17 @@ public function __construct($db) $i = 0; $this->const = [ // CONST CONFIGURATION - $i++ => ['TINYURL_AUTOMATIC_GENERATION','integer', 1, '', 0, 'current'], + $i++ => ['TINYURL_AUTOMATIC_GENERATION', 'integer', 1, '', 0, 'current'], $i++ => ['TINYURL_MANUAL_GENERATION', 'integer', 1, '', 0, 'current'], // CONST MODULE - $i++ => ['TINYURL_VERSION','chaine', $this->version, '', 0, 'current'], + $i++ => ['TINYURL_VERSION', 'chaine', $this->version, '', 0, 'current'], $i++ => ['TINYURL_DB_VERSION', 'chaine', $this->version, '', 0, 'current'], - $i => ['TINYURL_SHOW_PATCH_NOTE', 'integer', 1, '', 0, 'current'] + $i++ => ['TINYURL_SHOW_PATCH_NOTE', 'integer', 1, '', 0, 'current'], + + // CONST DOLIBARR + $i++ => ['CONTRACT_ALLOW_ONLINESIGN', 'integer', 1, '', 0, 'current'], + $i => ['FICHINTER_ALLOW_ONLINE_SIGN', 'integer', 1, '', 0, 'current'] ]; // Some keys to add into the overwriting translation tables @@ -248,21 +254,25 @@ public function init($options = ''): int require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $extraFields = new ExtraFields($this->db); - // Propal extrafiels + // Propal extrafields $extraFields->update('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', '', 'propal', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); $extraFields->addExtraField('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', 2000, '', 'propal', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); - // Order extrafiels + // Order extrafields $extraFields->update('tiny_url_payment_link', 'TinyUrlPaymentLink', 'url', '', 'commande', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); $extraFields->addExtraField('tiny_url_payment_link', 'TinyUrlPaymentLink', 'url', 2000, '', 'commande', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); - //$extraFields->update('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', '', 'commande', 0, 0, 2010, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); - //$extraFields->addExtraField('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', 2010, '', 'commande', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); - // Invoice extrafiels + // Invoice extrafields $extraFields->update('tiny_url_payment_link', 'TinyUrlPaymentLink', 'url', '', 'facture', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); $extraFields->addExtraField('tiny_url_payment_link', 'TinyUrlPaymentLink', 'url', 2000, '', 'facture', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); - //$extraFields->update('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', '', 'facture', 0, 0, 2010, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); - //$extraFields->addExtraField('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', 2010, '', 'facture', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + + // Contract extrafields + $extraFields->update('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', '', 'contrat', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + $extraFields->addExtraField('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', 2000, '', 'contrat', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); + + // Fiche inter extrafields + $extraFields->update('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', '', 'fichinter', 0, 0, 2000, '', '', '', 5, 'TinyUrlLinkHelp', '', '', 0, 'tinyurl@tinyurl'); + $extraFields->addExtraField('tiny_url_signature_link', 'TinyUrlSignatureLink', 'url', 2000, '', 'fichinter', 0, 0, '', '', '', '', 5, 'TinyUrlLinkHelp', '', 0, 'tinyurl@tinyurl'); return $this->_init($sql, $options); } diff --git a/core/substitutions/functions_tinyurl.lib.php b/core/substitutions/functions_tinyurl.lib.php index e6bf994..264b023 100644 --- a/core/substitutions/functions_tinyurl.lib.php +++ b/core/substitutions/functions_tinyurl.lib.php @@ -34,11 +34,14 @@ function tinyurl_completesubstitutionarray(&$substitutionarray, $langs, $object) { switch ($object->element) { - case 'propal': - case 'commande': - case 'facture': - $substitutionarray['__TINY_URL_PAYMENT_LINK__'] = $object->array_options['options_tiny_url_payment_link']; + case 'propal' : + case 'contrat' : + case 'fichinter' : $substitutionarray['__TINY_URL_SIGNATURE_LINK__'] = $object->array_options['options_tiny_url_signature_link']; break; + case 'commande' : + case 'facture' : + $substitutionarray['__TINY_URL_PAYMENT_LINK__'] = $object->array_options['options_tiny_url_payment_link']; + break; } } diff --git a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php index a7e8f19..9924073 100644 --- a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php +++ b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php @@ -97,6 +97,8 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf switch ($action) { case 'PROPAL_VALIDATE': + case 'CONTRACT_VALIDATE': + case 'FICHINTER_VALIDATE': if (getDolGlobalInt('TINYURL_AUTOMATIC_GENERATION')) { set_tiny_url_link($object, 'signature'); } diff --git a/lib/tinyurl_function.lib.php b/lib/tinyurl_function.lib.php index 68dc3f6..b9e92c6 100644 --- a/lib/tinyurl_function.lib.php +++ b/lib/tinyurl_function.lib.php @@ -50,6 +50,9 @@ function set_tiny_url_link(CommonObject $object, string $urlType) case 'facture' : $type = 'invoice'; break; + case 'contrat' : + $type = 'contract'; + break; default : $type = $object->element; break; From 302dbcc46e7a25f4a22cd52289ba3c5a8f3206d1 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Wed, 9 Aug 2023 16:35:33 +0200 Subject: [PATCH 16/24] #19 [Mod] add: change trad and other things --- README.md | 2 +- core/modules/modTinyURL.class.php | 4 ++-- langs/fr_FR/tinyurl.lang | 6 +++--- lib/tinyurl_function.lib.php | 2 +- tinyurlindex.php | 35 ------------------------------- 5 files changed, 7 insertions(+), 42 deletions(-) delete mode 100644 tinyurlindex.php diff --git a/README.md b/README.md index 5a86ae4..936bbf9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ ## Fonctionnalités -- Création d'urls raccourcies pour YOURLS et Dolibarr +- Création d'URLs raccourcies pour YOURLS et Dolibarr ## Traductions diff --git a/core/modules/modTinyURL.class.php b/core/modules/modTinyURL.class.php index 0f6fa55..192db88 100644 --- a/core/modules/modTinyURL.class.php +++ b/core/modules/modTinyURL.class.php @@ -125,7 +125,7 @@ public function __construct($db) 'interventioncard' ], // Set this to 1 if features of module are opened to external users - 'moduleforexternal' => 1, + 'moduleforexternal' => 0 ]; // Data directories to create when module is enabled @@ -190,7 +190,7 @@ public function __construct($db) } // Array to add new pages in new tabs - $this->tabs = []; + $this->tabs = []; // Dictionaries. $this->dictionaries = []; diff --git a/langs/fr_FR/tinyurl.lang b/langs/fr_FR/tinyurl.lang index 3e87dbc..8ecfad6 100644 --- a/langs/fr_FR/tinyurl.lang +++ b/langs/fr_FR/tinyurl.lang @@ -19,9 +19,9 @@ # Data - Donnée ModuleTinyURLName = TinyURL -ModuleTinyURLDesc = Création d'urls raccourcies pour YOURLS et Dolibarr -TinyURLDescription = Création d'urls raccourcies pour YOURLS et Dolibarr -TinyURLDescriptionLong = Création d'urls raccourcies pour YOURLS et Dolibarr +ModuleTinyURLDesc = Création d'URLs raccourcies pour YOURLS et Dolibarr +TinyURLDescription = Création d'URLs raccourcies pour YOURLS et Dolibarr +TinyURLDescriptionLong = Création d'URLs raccourcies pour YOURLS et Dolibarr # # Config page - Page d'administration diff --git a/lib/tinyurl_function.lib.php b/lib/tinyurl_function.lib.php index b9e92c6..17dc5c4 100644 --- a/lib/tinyurl_function.lib.php +++ b/lib/tinyurl_function.lib.php @@ -69,7 +69,7 @@ function set_tiny_url_link(CommonObject $object, string $urlType) break; } - $title = dol_sanitizeFileName(dol_strtolower($conf->global->MAIN_INFO_SOCIETE_NOM) . '-' . dol_strtolower($object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); + $title = dol_sanitizeFileName(dol_strtolower($conf->global->MAIN_INFO_SOCIETE_NOM . '-' . $object->ref) . (getDolGlobalInt('TINYURL_USE_SHA_URL') ? '-' . generate_random_id(8) : '')); // Init the CURL session $ch = curl_init(); diff --git a/tinyurlindex.php b/tinyurlindex.php deleted file mode 100644 index 44610c8..0000000 --- a/tinyurlindex.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * 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 . - */ - -/** - * \file tinyurlindex.php - * \ingroup tinyurl - * \brief Home page of tinyurl top menu - */ - -// Load TinyURL environment -if (file_exists('tinyurl.main.inc.php')) { - require_once __DIR__ . '/tinyurl.main.inc.php'; -} elseif (file_exists('../tinyurl.main.inc.php')) { - require_once __DIR__ . '/../tinyurl.main.inc.php'; -} else { - die('Include of tinyurl main fails'); -} - -$showDashboard = false; - -require_once __DIR__ . '/../saturne/core/tpl/index/index_view.tpl.php'; From f01522e3a2ff6eda2e9f0c67ed22914f23b94f3d Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 14 Aug 2023 16:37:47 +0200 Subject: [PATCH 17/24] #19 [Mod] fix: trad/action --- .../interface_99_modTinyurl_TinyurlTriggers.class.php | 4 ++-- lib/tinyurl_function.lib.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php index 9924073..e5d80ae 100644 --- a/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php +++ b/core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php @@ -16,7 +16,7 @@ */ /** - * \file core/triggers/interface_99_modTinyURL_DolisirhTriggers.class.php + * \file core/triggers/interface_99_modTinyurl_TinyurlTriggers.class.php * \ingroup tinyurl * \brief TinyURL trigger */ @@ -48,7 +48,7 @@ public function __construct(DoliDB $db) $this->name = preg_replace('/^Interface/i', '', get_class($this)); $this->family = 'demo'; - $this->description = 'TinyURL triggers.'; + $this->description = 'TinyURL triggers'; $this->version = '1.0.0'; $this->picto = 'tinyurl@tinyurl'; } diff --git a/lib/tinyurl_function.lib.php b/lib/tinyurl_function.lib.php index 17dc5c4..771ed58 100644 --- a/lib/tinyurl_function.lib.php +++ b/lib/tinyurl_function.lib.php @@ -95,7 +95,7 @@ function set_tiny_url_link(CommonObject $object, string $urlType) $data = json_decode($data); if ($data->status == 'success') { $object->array_options['options_tiny_url_' . $urlType . '_link'] = $data->shorturl; - $object->update($user, false); + $object->updateExtraField('tiny_url_' . $urlType . '_link'); setEventMessage($langs->trans('SetTinyURLSuccess')); } else { setEventMessage($langs->trans('SetTinyURLErrors'), 'errors'); From 31f868b5747efe6a979b4a04379d24e32929bc49 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 14 Aug 2023 16:39:58 +0200 Subject: [PATCH 18/24] #19 [Lib] fix: remove unused variable --- lib/tinyurl_function.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyurl_function.lib.php b/lib/tinyurl_function.lib.php index 771ed58..548c552 100644 --- a/lib/tinyurl_function.lib.php +++ b/lib/tinyurl_function.lib.php @@ -29,7 +29,7 @@ */ function set_tiny_url_link(CommonObject $object, string $urlType) { - global $conf, $langs, $user; + global $conf, $langs; $useOnlinePayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); $checkConf = getDolGlobalString('TINYURL_URL_YOURLS_API') && getDolGlobalString('TINYURL_SIGNATURE_TOKEN_YOURLS_API'); From 4739ce5b44fda475fe49c1453f66f0457aa35d02 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 17 Aug 2023 12:42:00 +0200 Subject: [PATCH 19/24] #9 [Mod] add: picto module and display picto with hook --- class/actions_tinyurl.class.php | 28 ++++++++++++++++++++++++++-- core/modules/modTinyURL.class.php | 5 ++++- img/object_tinyurl_color.png | Bin 3788 -> 4986 bytes img/tinyurl.png | Bin 3558 -> 4649 bytes img/tinyurl_color.png | Bin 3788 -> 4986 bytes 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/class/actions_tinyurl.class.php b/class/actions_tinyurl.class.php index f5ca1d6..bdd9048 100644 --- a/class/actions_tinyurl.class.php +++ b/class/actions_tinyurl.class.php @@ -77,12 +77,17 @@ public function printCommonFooter(array $parameters): int if (in_array($parameters['currentcontext'], ['propalcard', 'ordercard', 'invoicecard', 'contractcard', 'interventioncard'])) { if ($object->status > $object::STATUS_DRAFT) { - $urlTypes = ['payment', 'signature']; + print ''; + + $pictoPath = dol_buildpath('/tinyurl/img/tinyurl_color.png', 1); + $picto = img_picto('', $pictoPath, '', 1, 0, 0, '', 'pictoModule'); + $urlTypes = ['payment', 'signature']; foreach ($urlTypes as $urlType) { $checkTinyUrlLink = get_tiny_url_link($object, $urlType); $jQueryElement = '.' . $object->element . '_extras_tiny_url_' . $urlType . '_link'; if ($checkTinyUrlLink == 0 && getDolGlobalInt('TINYURL_MANUAL_GENERATION')) { - $output = ''; + $output = $picto; + $output .= ''; $output .= img_picto($langs->trans('SetTinyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; $output .= '' . img_picto($langs->trans('GetTinyURLErrors'), 'fontawesome_fa-exclamation-triangle_fas_#bc9526') . ''; } @@ -98,6 +103,25 @@ public function printCommonFooter(array $parameters): int } } + if (in_array($parameters['currentcontext'], ['propallist', 'orderlist', 'invoicelist'])) { + print ''; + + $pictoPath = dol_buildpath('/tinyurl/img/tinyurl_color.png', 1); + $picto = img_picto('', $pictoPath, '', 1, 0, 0, '', 'pictoModule'); + $urlTypes = ['payment', 'signature']; + foreach ($urlTypes as $urlType) { + $jQueryElement = 'tiny_url_' . $urlType . '_link'; ?> + + + 0 diff --git a/img/object_tinyurl_color.png b/img/object_tinyurl_color.png index b3c18a363af541dc26cfe97b32355917e601f336..911948b3f4b57d7420480ac253d480e892214708 100644 GIT binary patch literal 4986 zcmZ`-c|4Te`#v+nAcIkaEF)WJWUReeGBTFP+NP|L$U4L;S!T#v)+ADvtl6@qNKL~~ zV~I$SB|<~lm$7^Y4SqBJ|2?12^SRD_uIt=qKhJsYcpEEIz5_=N008*Tn&IpKfUuGf zzzt`CV^G-*7VzNBuG|6umdJh~AzdPW0XTHO`N`DZ+*8w^KZntoOf8{?42c%go(#-5=qcF03-@%guaOcmoExMBTfW4D8QfLrE~Q#b_8JnkF}t4 zJ=jkw=J3-DSYu;@fzt@14AWKMia#gP)%Vi)(!1sC;p@RJKc-zZSC<`u(7zB@v$BKPYF?2!?e|*64e60s!a@AU}mjE6F~rJ75RNlaJmAU{AN?gCgZHj z_sJ9TiEIbA(@(HT+Jqr91_FjAjrW0eb{~FO?!$yF8-m*_*yU&LdD3~|pjT>{?IvF` z63K2r_iQ4Y^fJk#s)_<^sQ#07E1Puy6PISCMFSD4awJZ zo-N{SO>|*RP~pTGw&v-i$v)7`_u-e-K1|rLA-Jt-zag_MN!dI4*-8E<_X1h#A)$kzzZr+Z$&HTxX04R# z^cWm?_-xiq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q4G>Zw@PiC%L!40{7?P?2w>fAE!1+5@-``D{lx>g$`A1}c&Q_8~NZKS}Mb8+R+gA%Pee16(eo&&i zAgs7LZD@(u9${4WQ3wxw_w$83XiT216a}e=Be0r~a#qt#$FkR^XxPV+e`iB*J8|XR zm^u}gDGxZ;8q#;J=F(mnmIDPF1`jiR=ZCpnrh?cEim7%mTOP#>!60*5BP9{8>B(N* zWNc&6t)>WZ!|DJO)0m<4JlCcnf?QS|=^!lw6uX}u0L@%iJG6AZYSKPThCln;K9^@~ zDr6C*sP@li(<834v&pLAWd@1%LffML=d_Z@N>FF)kW{N<=VC~2r@JO=`8%qVfYmy!tnJqy?%ry z)lll5W0x*AiH9^B77X)wBHNT(gO4In zAkBVy#b@@J8t8|Wliu~OKmkP&8YJR!eE8iQ&ResraG8-T37%DE=P0ack8xE`3)w9 LmZx4CxZe05u2YD8 diff --git a/img/tinyurl.png b/img/tinyurl.png index 4f2c8030a15dc34e7e3dc7b6c72350c8b5fc3c1f..6c30ec689b5797d2a3106b7a7af9715fa37d7718 100644 GIT binary patch literal 4649 zcmZ8lc{J4D|9;O5V;jsUjC~>^$&gaAC9;&Hk812hXzW=NGb3W`%UH`kA}XO2k|kto zL0KZ(lzp9$!8G%o>7U;@zxO%!Jok0(>$%VCx#xZEx%b9hxophOE6xi50Kch;;Z*-fI3AA34)IvE(FB_`!%x z@A_8h71C+VDVs3BMdOIfqfL&lxck@i2sKMbJhmlFEUE`@rtl>OYF1OceU-t`a5WSe zZHY0EOW!^sd!l4%A1HBe!aB$!N=6dut-a$T!!T_faP5^KM3ITG| zkU(o<8vwY$pa9wh4G^00;<}TFO)J{chOQIa$rx^qRFX1ccd<2dDxv!UQCp_*EDS)& zjL7~jZof8F$+N-<0lJNDP~YSwbWb$n4|4&jvCWihmtBCB#&y19s#<$11qtYf$HX%g zS?Kj4p1IhshilIkJmI>1^em3Nz3G8Tq~AM0Fc1dZKA0`fuTRyl8k^@Bse$>ZdP_R% zoDf1o_29t9uhzdl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e=Be0r~a#qt#$FkR^XxPV+e`iB*J8|XR zm^u}gDGxZ;8q#;J=F(mnmIDPF1`jiR=ZCpnrh?cEim7%mTOP#>!60*5BP9{8>B(N* zWNc&6t)>WZ!|DJO)0m<4JlCcnf?QS|=^!lw6uX}u0L@%iJG6AZYSKPThCln;K9^@~ zDr6C*sP@li(<834v&pLAWd@1%LffML=d_Z@N>FF)kW{N<=VC~2r@JO=`8%qVfYmy!tnJqy?%ry z)lll5W0x*AiH9^B77X)wBHNT(gO4In zAkBVy#b@@J8t8|Wliu~OKmkP&8YJR!eE8iQ&ResraG8-T37%DE=P0ack8xE`3)w9 LmZx4CxZe05u2YD8 From 5f452387c941bb40e14e95053f2b63440d4ad239 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 28 Aug 2023 20:13:49 +0200 Subject: [PATCH 20/24] #20 [Substitutions] add: default value --- core/substitutions/functions_tinyurl.lib.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/substitutions/functions_tinyurl.lib.php b/core/substitutions/functions_tinyurl.lib.php index 264b023..06299b5 100644 --- a/core/substitutions/functions_tinyurl.lib.php +++ b/core/substitutions/functions_tinyurl.lib.php @@ -33,6 +33,8 @@ */ function tinyurl_completesubstitutionarray(&$substitutionarray, $langs, $object) { + $langs->load('tinyurl@tinyurl'); + switch ($object->element) { case 'propal' : case 'contrat' : @@ -41,7 +43,11 @@ function tinyurl_completesubstitutionarray(&$substitutionarray, $langs, $object) break; case 'commande' : case 'facture' : - $substitutionarray['__TINY_URL_PAYMENT_LINK__'] = $object->array_options['options_tiny_url_payment_link']; + $substitutionarray['__TINY_URL_PAYMENT_LINK__'] = $object->array_options['options_tiny_url_payment_link']; + break; + default : + $substitutionarray['__TINY_URL_SIGNATURE_LINK__'] = $langs->trans('TinyUrlSignatureLink'); + $substitutionarray['__TINY_URL_PAYMENT_LINK__'] = $langs->trans('TinyUrlPaymentLink'); break; } } From 2a4e5c0a4701ed99faa435ce3fa93f6aea6d8fbf Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Tue, 29 Aug 2023 12:44:38 +0200 Subject: [PATCH 21/24] #21 [IHM] add: use picto in tabmenu on phone --- lib/tinyurl.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tinyurl.lib.php b/lib/tinyurl.lib.php index 1d429bb..dea168f 100644 --- a/lib/tinyurl.lib.php +++ b/lib/tinyurl.lib.php @@ -29,7 +29,7 @@ function tinyurl_admin_prepare_head(): array { // Global variables definitions - global $langs, $conf; + global $conf, $langs; // Load translation files required by the page saturne_load_langs(); @@ -39,12 +39,12 @@ function tinyurl_admin_prepare_head(): array $head = []; $head[$h][0] = dol_buildpath('/tinyurl/admin/setup.php', 1); - $head[$h][1] = '' . $langs->trans('ModuleSettings'); + $head[$h][1] = $conf->browser->layout != 'phone' ? '' . $langs->trans('ModuleSettings') : ''; $head[$h][2] = 'settings'; $h++; $head[$h][0] = dol_buildpath('/saturne/admin/about.php', 1) . '?module_name=TinyURL'; - $head[$h][1] = '' . $langs->trans('About'); + $head[$h][1] = $conf->browser->layout != 'phone' ? '' . $langs->trans('About') : ''; $head[$h][2] = 'about'; $h++; From 3675b3db41db5b792c2714ea580c36206ea79c47 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 14 Sep 2023 12:56:12 +0200 Subject: [PATCH 22/24] #22 [Mod] add: change name for EasyURL --- admin/setup.php | 52 ++++----- ...rl.class.php => actions_easyurl.class.php} | 40 +++---- class/index.php | 2 + ...TinyURL.class.php => modEasyURL.class.php} | 100 +++++++++--------- ...yurl.lib.php => functions_easyurl.lib.php} | 16 +-- ...e_99_modEasyurl_EasyurlTriggers.class.php} | 28 ++--- tinyurl.main.inc.php => easyurl.main.inc.php | 6 +- img/{tinyurl.png => easyurl.png} | Bin ...ct_tinyurl_color.png => easyurl_color.png} | Bin ...url_color.png => object_easyurl_color.png} | Bin langs/fr_FR/{tinyurl.lang => easyurl.lang} | 32 +++--- lib/{tinyurl.lib.php => easyurl.lib.php} | 14 +-- ...ction.lib.php => easyurl_function.lib.php} | 38 +++---- 13 files changed, 165 insertions(+), 163 deletions(-) rename class/{actions_tinyurl.class.php => actions_easyurl.class.php} (80%) create mode 100644 class/index.php rename core/modules/{modTinyURL.class.php => modEasyURL.class.php} (73%) rename core/substitutions/{functions_tinyurl.lib.php => functions_easyurl.lib.php} (71%) rename core/triggers/{interface_99_modTinyurl_TinyurlTriggers.class.php => interface_99_modEasyurl_EasyurlTriggers.class.php} (80%) rename tinyurl.main.inc.php => easyurl.main.inc.php (93%) rename img/{tinyurl.png => easyurl.png} (100%) rename img/{object_tinyurl_color.png => easyurl_color.png} (100%) rename img/{tinyurl_color.png => object_easyurl_color.png} (100%) rename langs/fr_FR/{tinyurl.lang => easyurl.lang} (65%) rename lib/{tinyurl.lib.php => easyurl.lib.php} (87%) rename lib/{tinyurl_function.lib.php => easyurl_function.lib.php} (79%) diff --git a/admin/setup.php b/admin/setup.php index e3cae6e..04a0668 100644 --- a/admin/setup.php +++ b/admin/setup.php @@ -17,24 +17,24 @@ /** * \file admin/setup.php - * \ingroup tinyurl - * \brief TinyURL setup page + * \ingroup easyurl + * \brief EasyURL setup page */ -// Load TinyURL environment -if (file_exists('../tinyurl.main.inc.php')) { - require_once __DIR__ . '/../tinyurl.main.inc.php'; -} elseif (file_exists('../../tinyurl.main.inc.php')) { - require_once __DIR__ . '/../../tinyurl.main.inc.php'; +// Load EasyURL environment +if (file_exists('../easyurl.main.inc.php')) { + require_once __DIR__ . '/../easyurl.main.inc.php'; +} elseif (file_exists('../../easyurl.main.inc.php')) { + require_once __DIR__ . '/../../easyurl.main.inc.php'; } else { - die('Include of tinyurl main fails'); + die('Include of easyurl main fails'); } // Load Dolibarr libraries require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; -// Load TinyURL libraries -require_once __DIR__ . '/../lib/tinyurl.lib.php'; +// Load EasyURL libraries +require_once __DIR__ . '/../lib/easyurl.lib.php'; // Global variables definitions global $conf, $db, $langs, $user; @@ -50,7 +50,7 @@ $form = new Form($db); // Security check - Protection if external user -$permissionToRead = $user->rights->tinyurl->adminpage->read; +$permissionToRead = $user->rights->easyurl->adminpage->read; saturne_check_access($permissionToRead); /* @@ -62,10 +62,10 @@ $signatureTokenYourlsAPI = GETPOST('signature_token_yourls_api'); if (dol_strlen($URLYourlsAPI) > 0) { - dolibarr_set_const($db, 'TINYURL_URL_YOURLS_API', $URLYourlsAPI, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'EASYURL_URL_YOURLS_API', $URLYourlsAPI, 'chaine', 0, '', $conf->entity); } if (dol_strlen($signatureTokenYourlsAPI) > 0) { - dolibarr_set_const($db, 'TINYURL_SIGNATURE_TOKEN_YOURLS_API', $signatureTokenYourlsAPI, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'EASYURL_SIGNATURE_TOKEN_YOURLS_API', $signatureTokenYourlsAPI, 'chaine', 0, '', $conf->entity); } setEventMessage('SavedConfig'); @@ -79,8 +79,8 @@ * View */ -$title = $langs->trans('ModuleSetup', 'TinyURL'); -$help_url = 'FR:Module_TinyURL'; +$title = $langs->trans('ModuleSetup', 'EasyURL'); +$help_url = 'FR:Module_EasyURL'; saturne_header(0,'', $title, $help_url); @@ -89,8 +89,8 @@ print load_fiche_titre($title, $linkback, 'title_setup'); // Configuration header -$head = tinyurl_admin_prepare_head(); -print dol_get_fiche_head($head, 'settings', $title, -1, 'tinyurl_color@tinyurl'); +$head = easyurl_admin_prepare_head(); +print dol_get_fiche_head($head, 'settings', $title, -1, 'easyurl_color@easyurl'); print load_fiche_titre($langs->trans('Config'), '', ''); @@ -107,30 +107,30 @@ print ''; print '' . $langs->trans('URLYourlsAPIDescription') . ''; -print ''; +print ''; print ''; print ''; print '' . $langs->trans('SignatureTokenYourlsAPIDescription') . ''; -print ''; +print ''; print ''; print '' . $langs->trans('UseShaUrl') . ''; print '' . $langs->trans('UseShaUrlDescription') . ''; print ''; -print ajax_constantonoff('TINYURL_USE_SHA_URL'); +print ajax_constantonoff('EASYURL_USE_SHA_URL'); print ''; -print '' . $langs->trans('AutomaticTinyUrlGeneration') . ''; -print '' . $langs->trans('AutomaticTinyUrlGenerationDescription') . ''; +print '' . $langs->trans('AutomaticEasyUrlGeneration') . ''; +print '' . $langs->trans('AutomaticEasyUrlGenerationDescription') . ''; print ''; -print ajax_constantonoff('TINYURL_AUTOMATIC_GENERATION'); +print ajax_constantonoff('EASYURL_AUTOMATIC_GENERATION'); print ''; -print '' . $langs->trans('ManualTinyUrlGeneration') . ''; -print '' . $langs->trans('ManualTinyUrlGenerationDescription') . ''; +print '' . $langs->trans('ManualEasyUrlGeneration') . ''; +print '' . $langs->trans('ManualEasyUrlGenerationDescription') . ''; print ''; -print ajax_constantonoff('TINYURL_MANUAL_GENERATION'); +print ajax_constantonoff('EASYURL_MANUAL_GENERATION'); print ''; print ''; diff --git a/class/actions_tinyurl.class.php b/class/actions_easyurl.class.php similarity index 80% rename from class/actions_tinyurl.class.php rename to class/actions_easyurl.class.php index bdd9048..f4886d8 100644 --- a/class/actions_tinyurl.class.php +++ b/class/actions_easyurl.class.php @@ -16,18 +16,18 @@ */ /** - * \file class/actions_tinyurl.class.php - * \ingroup tinyurl - * \brief TinyURL hook overload + * \file class/actions_easyurl.class.php + * \ingroup easyurl + * \brief EasyURL hook overload */ -// Load TinyURL libraries -require_once __DIR__ . '/../lib/tinyurl_function.lib.php'; +// Load EasyURL libraries +require_once __DIR__ . '/../lib/easyurl_function.lib.php'; /** - * Class ActionsTinyurl + * Class ActionsEasyurl */ -class ActionsTinyurl +class ActionsEasyurl { /** * @var DoliDB Database handler @@ -79,20 +79,20 @@ public function printCommonFooter(array $parameters): int if ($object->status > $object::STATUS_DRAFT) { print ''; - $pictoPath = dol_buildpath('/tinyurl/img/tinyurl_color.png', 1); + $pictoPath = dol_buildpath('/easyurl/img/easyurl_color.png', 1); $picto = img_picto('', $pictoPath, '', 1, 0, 0, '', 'pictoModule'); $urlTypes = ['payment', 'signature']; foreach ($urlTypes as $urlType) { - $checkTinyUrlLink = get_tiny_url_link($object, $urlType); - $jQueryElement = '.' . $object->element . '_extras_tiny_url_' . $urlType . '_link'; - if ($checkTinyUrlLink == 0 && getDolGlobalInt('TINYURL_MANUAL_GENERATION')) { + $checkEasyUrlLink = get_easy_url_link($object, $urlType); + $jQueryElement = '.' . $object->element . '_extras_easy_url_' . $urlType . '_link'; + if ($checkEasyUrlLink == 0 && getDolGlobalInt('EASYURL_MANUAL_GENERATION')) { $output = $picto; - $output .= ''; - $output .= img_picto($langs->trans('SetTinyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; - $output .= '' . img_picto($langs->trans('GetTinyURLErrors'), 'fontawesome_fa-exclamation-triangle_fas_#bc9526') . ''; + $output .= ''; + $output .= img_picto($langs->trans('SetEasyURLLink'), 'fontawesome_fa-redo_fas_#444', 'class="paddingright pictofixedwidth valignmiddle"') . ''; + $output .= '' . img_picto($langs->trans('GetEasyURLErrors'), 'fontawesome_fa-exclamation-triangle_fas_#bc9526') . ''; } - if (!empty($object->array_options['options_tiny_url_' . $urlType . '_link']) && $checkTinyUrlLink > 0) { - $output = showValueWithClipboardCPButton($object->array_options['options_tiny_url_' . $urlType . '_link'], 0, 'none'); + if (!empty($object->array_options['options_easy_url_' . $urlType . '_link']) && $checkEasyUrlLink > 0) { + $output = showValueWithClipboardCPButton($object->array_options['options_easy_url_' . $urlType . '_link'], 0, 'none'); } ?>