diff --git a/.gitignore b/.gitignore index 020d46645..ae0a05c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -167,6 +167,8 @@ img/** !/override/classes/index.php !/override/classes/cache/ !/override/classes/cache/index.php +!/override/classes/checkoutProcess/ +!/override/classes/checkoutProcess/index.php !/override/classes/controller/ !/override/classes/controller/index.php !/override/classes/db/ diff --git a/Adapter/Adapter_ProductPriceCalculator.php b/Adapter/Adapter_ProductPriceCalculator.php index d26887f7e..91e9b370f 100644 --- a/Adapter/Adapter_ProductPriceCalculator.php +++ b/Adapter/Adapter_ProductPriceCalculator.php @@ -43,7 +43,8 @@ class Adapter_ProductPriceCalculator $with_ecotax = true, $use_group_reduction = true, Context $context = null, - $use_customer_price = true + $use_customer_price = true, + $id_roomtype = false ) { return Product::getPriceStatic( $id_product, @@ -62,7 +63,8 @@ class Adapter_ProductPriceCalculator $with_ecotax, $use_group_reduction, $context, - $use_customer_price + $use_customer_price, + $id_roomtype ); } } diff --git a/LICENSE b/LICENSE deleted file mode 100644 index acd3d50d1..000000000 --- a/LICENSE +++ /dev/null @@ -1,5279 +0,0 @@ -The MIT License (MIT) - -Copyright (C) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -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 - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - -Copyright (C) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) - -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 . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - -Copyright (C) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) - -This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -This is free software, and you are welcome to redistribute it -under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - -You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - -The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - - -Copyright (C) 2010-2012 Marcelo Gibson de Castro Gonçalves. All rights reserved. - -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without any warranty. - - -The MIT License (MIT) - -Copyright (c) 2011-2013 Felix Gnass - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -The MIT License (MIT) - -Copyright (C) 2013 Hakim El Hattab, http://hakim.se - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -The MIT License (MIT) - -Copyright (c) 2014 Danoosh Mir - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -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 this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser 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 Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "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 -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY 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 -LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - - - -The MIT License (MIT) - -Copyright (C) 2005 Sam Stephenson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -Copyright (c) 2005 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. -// -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. -// -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. -// -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -Copyright (c) 2006, David Spurr (http://www.defusion.org.uk/) -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. -// -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -File uploader component is licensed under GNU GPL 2 or later and GNU LGPL 2 or later. -© 2010 Andrew Valums - -This distribution also includes: - - server/OctetStreamReader.java - Dual Licensed under the MIT and GPL v.2 - - jQuery JavaScript Library - http://jquery.com/ - Copyright 2010, John Resig - Dual licensed under the MIT or GPL Version 2 licenses. - http://jquery.org/license - - Sizzle.js - CSS selector engine used by jQuery - http://sizzlejs.com/ - Copyright 2010, The Dojo Foundation - Released under the MIT, BSD, and GPL Licenses. - - QUnit - A JavaScript Unit Testing Framework - http://docs.jquery.com/QUnit - Copyright (c) 2009 John Resig, Jörn Zaefferer - Dual licensed under the MIT (MIT-LICENSE.txt) - and GPL (GPL-LICENSE.txt) licenses. - - -The MIT License (MIT) - -Copyright (C) 2005, 2014 jQuery Foundation, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -Open Software License v. 3.0 (OSL-3.0) - -This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: - -Licensed under the Open Software License version 3.0 - -1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: -a) to reproduce the Original Work in copies, either alone or as part of a collective work; -b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; -c) to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License; -d) to perform the Original Work publicly; and -e) to display the Original Work publicly. - -2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. - -3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. - -4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. - -5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). - -6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. - -7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. - -8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. - -9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). - -10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. - -11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. - -12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. - -13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. - -14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. - -16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. - -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - -Academic Free License ("AFL") v. 3.0 - -This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: - -Licensed under the Academic Free License version 3.0 - -1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: -a) to reproduce the Original Work in copies, either alone or as part of a collective work; -b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; -c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; -d) to perform the Original Work publicly; and -e) to display the Original Work publicly. - -2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. - -3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. - -4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. - -5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). - -6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. - -7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. - -8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. - -9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). - -10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. - -11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. - -12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. - -13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. - -14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. - -16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. - - -Copyright (c) 2002 Douglas Crockford (www.crockford.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -The Software shall be used for Good, not Evil. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -********************************************************************** -* TCPDF LICENSE -********************************************************************** - - TCPDF is free software: you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - -********************************************************************** -********************************************************************** - - GNU LESSER 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. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser 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 -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - -********************************************************************** -********************************************************************** - - 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 - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - -********************************************************************** -********************************************************************** - - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. -This library 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 -Lesser General Public License for more details. -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -For questions, help, comments, discussion, etc., please join the -Smarty mailing list. Send a blank e-mail to -smarty-discussion-subscribe@googlegroups.com - - -Copyright (c) 2005 Michal Migurski - -Redistribution and use in source and binary forms, with or -without modification, are permitted provided that the following -conditions are met: Redistributions of source code must retain the -above copyright notice, this list of conditions and the following -disclaimer. Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - - -Copyright (c) 2010-2014 André Rothe -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products -derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Copyright (c) 2010-2014 Justin Swanhart and André Rothe -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products -derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts -as the successor of the GNU Library Public License, version 2, hence -the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -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 this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser 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 Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "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 -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY 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 -LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - -geoip.inc - -Copyright (C) 2007 MaxMind LLC - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -geoipcity.inc - -Copyright (C) 2004 Maxmind LLC - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -HTML Purifier 4.6.0 - Standards Compliant HTML Filtering -Copyright (C) 2006-2008 Edward Z. Yang - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - -GNU LESSER 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. - - -This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - -0. Additional Definitions. - -As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - -"The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - -An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - -A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - -The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - -The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - -1. Exception to Section 3 of the GNU GPL. - -You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - -2. Conveying Modified Versions. - -If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - -a) under this License, provided that you make a good faith effort to -ensure that, in the event an Application does not supply the -function or data, the facility still operates, and performs -whatever part of its purpose remains meaningful, or - -b) under the GNU GPL, with none of the additional permissions of -this License applicable to that copy. - -3. Object Code Incorporating Material from Library Header Files. - -The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - -a) Give prominent notice with each copy of the object code that the -Library is used in it and that the Library and its use are -covered by this License. - -b) Accompany the object code with a copy of the GNU GPL and this license -document. - -4. Combined Works. - -You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - -a) Give prominent notice with each copy of the Combined Work that -the Library is used in it and that the Library and its use are -covered by this License. - -b) Accompany the Combined Work with a copy of the GNU GPL and this license -document. - -c) For a Combined Work that displays copyright notices during -execution, include the copyright notice for the Library among -these notices, as well as a reference directing the user to the -copies of the GNU GPL and this license document. - -d) Do one of the following: - -0) Convey the Minimal Corresponding Source under the terms of this -License, and the Corresponding Application Code in a form -suitable for, and under terms that permit, the user to -recombine or relink the Application with a modified version of -the Linked Version to produce a modified Combined Work, in the -manner specified by section 6 of the GNU GPL for conveying -Corresponding Source. - -1) Use a suitable shared library mechanism for linking with the -Library. A suitable mechanism is one that (a) uses at run time -a copy of the Library already present on the user's computer -system, and (b) will operate properly with a modified version -of the Library that is interface-compatible with the Linked -Version. - -e) Provide Installation Information, but only if you would otherwise -be required to provide such information under section 6 of the -GNU GPL, and only to the extent that such information is -necessary to install and execute a modified version of the -Combined Work produced by recombining or relinking the -Application with a modified version of the Linked Version. (If -you use option 4d0, the Installation Information must accompany -the Minimal Corresponding Source and Corresponding Application -Code. If you use option 4d1, you must provide the Installation -Information in the manner specified by section 6 of the GNU GPL -for conveying Corresponding Source.) - -5. Combined Libraries. - -You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - -a) Accompany the combined library with a copy of the same work based -on the Library, uncombined with any other library facilities, -conveyed under the terms of this License. - -b) Give prominent notice with the combined library that part of it -is a work based on the Library, and explaining where to find the -accompanying uncombined form of the same work. - -6. Revised Versions of the GNU Lesser General Public License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser 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 -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - -If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - - -GNU LESSER 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. - - -This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - -0. Additional Definitions. - -As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - -"The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - -An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - -A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - -The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - -The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - -1. Exception to Section 3 of the GNU GPL. - -You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - -2. Conveying Modified Versions. - -If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - -a) under this License, provided that you make a good faith effort to -ensure that, in the event an Application does not supply the -function or data, the facility still operates, and performs -whatever part of its purpose remains meaningful, or - -b) under the GNU GPL, with none of the additional permissions of -this License applicable to that copy. - -3. Object Code Incorporating Material from Library Header Files. - -The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - -a) Give prominent notice with each copy of the object code that the -Library is used in it and that the Library and its use are -covered by this License. - -b) Accompany the object code with a copy of the GNU GPL and this license -document. - -4. Combined Works. - -You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - -a) Give prominent notice with each copy of the Combined Work that -the Library is used in it and that the Library and its use are -covered by this License. - -b) Accompany the Combined Work with a copy of the GNU GPL and this license -document. - -c) For a Combined Work that displays copyright notices during -execution, include the copyright notice for the Library among -these notices, as well as a reference directing the user to the -copies of the GNU GPL and this license document. - -d) Do one of the following: - -0) Convey the Minimal Corresponding Source under the terms of this -License, and the Corresponding Application Code in a form -suitable for, and under terms that permit, the user to -recombine or relink the Application with a modified version of -the Linked Version to produce a modified Combined Work, in the -manner specified by section 6 of the GNU GPL for conveying -Corresponding Source. - -1) Use a suitable shared library mechanism for linking with the -Library. A suitable mechanism is one that (a) uses at run time -a copy of the Library already present on the user's computer -system, and (b) will operate properly with a modified version -of the Library that is interface-compatible with the Linked -Version. - -e) Provide Installation Information, but only if you would otherwise -be required to provide such information under section 6 of the -GNU GPL, and only to the extent that such information is -necessary to install and execute a modified version of the -Combined Work produced by recombining or relinking the -Application with a modified version of the Linked Version. (If -you use option 4d0, the Installation Information must accompany -the Minimal Corresponding Source and Corresponding Application -Code. If you use option 4d1, you must provide the Installation -Information in the manner specified by section 6 of the GNU GPL -for conveying Corresponding Source.) - -5. Combined Libraries. - -You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - -a) Accompany the combined library with a copy of the same work based -on the Library, uncombined with any other library facilities, -conveyed under the terms of this License. - -b) Give prominent notice with the combined library that part of it -is a work based on the Library, and explaining where to find the -accompanying uncombined form of the same work. - -6. Revised Versions of the GNU Lesser General Public License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser 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 -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - -If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - - -Copyright (c) 2013-2016 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -MIT License - -Copyright (c) <2011-2015> Serban Ghita, Nick Ilyin and contributors. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Developer’s Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - - -The MIT License (MIT) - -Copyright (c) 2015 Jake A. Smith - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - --------------------------------------------------------------------- - The PHP License, version 3.0 -Copyright (c) 1999 - 2006 The PHP Group. All rights reserved. --------------------------------------------------------------------- - -Redistribution and use in source and binary forms, with or without -modification, is permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - 3. The name "PHP" must not be used to endorse or promote products - derived from this software without prior written permission. For - written permission, please contact group@php.net. - - 4. Products derived from this software may not be called "PHP", nor - may "PHP" appear in their name, without prior written permission - from group@php.net. You may indicate that your software works in - conjunction with PHP by saying "Foo for PHP" instead of calling - it "PHP Foo" or "phpfoo" - - 5. The PHP Group may publish revised and/or new versions of the - license from time to time. Each version will be given a - distinguishing version number. - Once covered code has been published under a particular version - of the license, you may always continue to use it under the terms - of that version. You may also choose to use such covered code - under the terms of any subsequent version of the license - published by the PHP Group. No one other than the PHP Group has - the right to modify the terms applicable to covered code created - under this License. - - 6. Redistributions of any form whatsoever must retain the following - acknowledgment: - "This product includes PHP, freely available from - ". - -THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND -ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP -DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - --------------------------------------------------------------------- - -This software consists of voluntary contributions made by many -individuals on behalf of the PHP Group. - -The PHP Group can be contacted via Email at group@php.net. - -For more information on the PHP Group and the PHP project, -please see . - -This product includes the Zend Engine, freely available at -. - - -This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. - - -The MIT License (MIT) - -Copyright (c) 2011-2015 Twitter, Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - - Preamble - -The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) 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 -this service 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 make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. 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. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -GNU GENERAL PUBLIC LICENSE -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - -1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - -a) You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. - -b) You must cause any work that you distribute or publish, that in -whole or in part contains or is derived from the Program or any -part thereof, to be licensed as a whole at no charge to all third -parties under the terms of this License. - -c) If the modified program normally reads commands interactively -when run, you must cause it, when started running for such -interactive use in the most ordinary way, to print or display an -announcement including an appropriate copyright notice and a -notice that there is no warranty (or else, saying that you provide -a warranty) and that users may redistribute the program under -these conditions, and telling the user how to view a copy of this -License. (Exception: if the Program itself is interactive but -does not normally print such an announcement, your work based on -the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - -a) Accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of Sections -1 and 2 above on a medium customarily used for software interchange; or, - -b) Accompany it with a written offer, valid for at least three -years, to give any third party, for a charge no more than your -cost of physically performing source distribution, a complete -machine-readable copy of the corresponding source code, to be -distributed under the terms of Sections 1 and 2 above on a medium -customarily used for software interchange; or, - -c) Accompany it with the information you received as to the offer -to distribute corresponding source code. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form with such -an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new versions -of the 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 a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE 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. - - END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - -Copyright (C) - -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 2 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, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - -Gnomovision version 69, Copyright (C) year name of author -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -This is free software, and you are welcome to redistribute it -under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - -Yoyodyne, Inc., hereby disclaims all copyright interest in the program -`Gnomovision' (which makes passes at compilers) written by James Hacker. - -, 1 April 1989 -Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. - - -Copyright (c) 2011-2015 Tim Wood, Iskren Chernev, Moment.js contributors - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - - -Copyright (c) 2012 Scott Jehl - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -nvd3.js License - -Copyright (c) 2011-2014 Novus Partners, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - - -d3.js License - -Copyright (c) 2012, Michael Bostock -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* The name Michael Bostock may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - - Preamble - -The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) 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 -this service 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 make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. 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. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -GNU GENERAL PUBLIC LICENSE -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - -1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - -a) You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. - -b) You must cause any work that you distribute or publish, that in -whole or in part contains or is derived from the Program or any -part thereof, to be licensed as a whole at no charge to all third -parties under the terms of this License. - -c) If the modified program normally reads commands interactively -when run, you must cause it, when started running for such -interactive use in the most ordinary way, to print or display an -announcement including an appropriate copyright notice and a -notice that there is no warranty (or else, saying that you provide -a warranty) and that users may redistribute the program under -these conditions, and telling the user how to view a copy of this -License. (Exception: if the Program itself is interactive but -does not normally print such an announcement, your work based on -the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - -a) Accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of Sections -1 and 2 above on a medium customarily used for software interchange; or, - -b) Accompany it with a written offer, valid for at least three -years, to give any third party, for a charge no more than your -cost of physically performing source distribution, a complete -machine-readable copy of the corresponding source code, to be -distributed under the terms of Sections 1 and 2 above on a medium -customarily used for software interchange; or, - -c) Accompany it with the information you received as to the offer -to distribute corresponding source code. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form with such -an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new versions -of the 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 a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE 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. - - END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - -Copyright (C) - -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 2 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, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - -Gnomovision version 69, Copyright (C) year name of author -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -This is free software, and you are welcome to redistribute it -under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - -Yoyodyne, Inc., hereby disclaims all copyright interest in the program -`Gnomovision' (which makes passes at compilers) written by James Hacker. - -, 1 April 1989 -Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. - - -The MIT License (MIT) - -Copyright (c) 2009-2015 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -The MIT License (MIT) - -Copyright (c) 2011-2015 Twitter, Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -The MIT License (MIT) - -Copyright 2010, Sebastian Tschan - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -MIT LICENSE - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - - - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - - - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. - - -The MIT License (MIT) - -Copyright © 2009 Josh Pyles / Pixelmatrix Design LLC -http://pixelmatrixdesign.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -Copyright (c) 2012 Jared Novack & Upstatement (upstatement.com) -Dual licensed under the MIT and GPL licenses: -http://www.opensource.org/licenses/mit-license.php -http://www.gnu.org/licenses/gpl.html - - -The MIT License (MIT) - -Copyright © James Padolsey - - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -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 - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - -Copyright (C) James Padolsey - -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 . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - -Copyright (C) James Padolsey - -This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -This is free software, and you are welcome to redistribute it -under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - -You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - -The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - - diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..49dc8ec82 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,48 @@ + +Open Software License ("OSL") v. 3.0 + +This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Open Software License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/README.md b/README.md index 0e93ce7b5..ceb331a43 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,11 @@ docker pull webkul/qloapps_docker ### License -QloApps is a truly opensource Hotel-Commerce platform which is under the [Open Software License 3.0](https://github.com/webkul/hotelcommerce/blob/develop/LICENSE). +QloApps Core is licensed under OSL-3.0 and Modules authored by Webkul have their applicable license, LICENSE.md, kept inside their root directories, while other modules are licensed under AFL-3.0. + +The online copy of OSL-3.0 can be found at [https://opensource.org/licenses/OSL-3.0](https://opensource.org/licenses/OSL-3.0). + +The online copy of AFL-3.0 can be found at [https://opensource.org/licenses/AFL-3.0](https://opensource.org/licenses/AFL-3.0). ### Security Vulnerabilities diff --git a/admin/themes/default/js/tree.js b/admin/themes/default/js/tree.js index d3fd63ecb..5ff936395 100644 --- a/admin/themes/default/js/tree.js +++ b/admin/themes/default/js/tree.js @@ -168,58 +168,15 @@ Tree.prototype = expandAll : function($speed) { - var idTree = this.$element.parent().find('.cattree.tree').first().attr('id'); - if (typeof(idTree) != 'undefined' && !$('#'+idTree).hasClass('full_loaded')) - { - var selected = []; - that = this; - $('#'+idTree).find('.tree-selected input').each( - function() - { - selected.push($(this).val()); - } - ); - var name = $('#'+idTree).find('ul.tree input').first().attr('name'); - var inputType = $('#'+idTree).find('ul.tree input').first().attr('type'); - var useCheckBox = 0; - if (inputType == 'checkbox') + this.$element.find("label.tree-toggler").each( + function() { - useCheckBox = 1; + $(this).parent().children(".icon-folder-close") + .removeClass("icon-folder-close") + .addClass("icon-folder-open"); + $(this).parent().parent().children("ul.tree").show($speed); } - - $.get( - 'ajax-tab.php', - {controller:'AdminProducts',token:currentToken,action:'getCategoryTree',type:idTree,fullTree:1,selected:selected, inputName:name,useCheckBox:useCheckBox}, - function(content) - { - $('#' + idTree).html(content); - organizeTree(); - $('#' + idTree).tree('init'); - that.$element.find("label.tree-toggler").each( - function() - { - $(this).parent().children(".icon-folder-close") - .removeClass("icon-folder-close") - .addClass("icon-folder-open"); - $(this).parent().parent().children("ul.tree").show($speed); - $('#'+idTree).addClass('full_loaded'); - } - ); - } - ); - } - else - { - this.$element.find("label.tree-toggler").each( - function() - { - $(this).parent().children(".icon-folder-close") - .removeClass("icon-folder-close") - .addClass("icon-folder-open"); - $(this).parent().parent().children("ul.tree").show($speed); - } - ); - } + ); return $(this); } diff --git a/admin/themes/default/sass/controllers/_order.sass b/admin/themes/default/sass/controllers/_order.sass index a516c46c3..c5ccaa579 100644 --- a/admin/themes/default/sass/controllers/_order.sass +++ b/admin/themes/default/sass/controllers/_order.sass @@ -3,3 +3,16 @@ #customization_list border: 0px + +.booking_occupancy + .booking_occupancy_wrapper + max-height: 250px + overflow-x: auto + +#booking-documents-modal + .documents-list + table + tbody + img + max-height: 55px + max-width: 55px diff --git a/admin/themes/default/sass/partials/_commons.sass b/admin/themes/default/sass/partials/_commons.sass index d48b32d5d..588ef7d53 100644 --- a/admin/themes/default/sass/partials/_commons.sass +++ b/admin/themes/default/sass/partials/_commons.sass @@ -206,4 +206,13 @@ cursor: pointer #recommendation-wrapper - margin-bottom: 20px \ No newline at end of file + margin-bottom: 20px + +//list column selection +#optional-list-toggle + font-family: "Open Sans",Helvetica,Arial,sans-serif + font-size: 13px + padding: 8px 12px + text-transform: none + label + font-weight: 400 \ No newline at end of file diff --git a/admin/themes/default/sass/partials/_content.sass b/admin/themes/default/sass/partials/_content.sass index c1d359e26..2a765f62e 100644 --- a/admin/themes/default/sass/partials/_content.sass +++ b/admin/themes/default/sass/partials/_content.sass @@ -106,6 +106,8 @@ body text-align: center font-size: 18px line-height: 30px + .dropdown-menu + line-height: normal .panel-danger .panel-heading background-color: $badge-notif-color!important form .alert diff --git a/admin/themes/default/sass/partials/_tables.sass b/admin/themes/default/sass/partials/_tables.sass index 377e1eef5..7382ff13a 100644 --- a/admin/themes/default/sass/partials/_tables.sass +++ b/admin/themes/default/sass/partials/_tables.sass @@ -148,6 +148,8 @@ tr.highlighted td .date_range .input-group:first-child margin-bottom: 5px +.input_range > :first-child + margin-bottom: 5px @media (max-width: $screen-sm-max) .table-responsive-row diff --git a/admin/themes/default/template/alerts.tpl b/admin/themes/default/template/alerts.tpl new file mode 100644 index 000000000..2d4e3973e --- /dev/null +++ b/admin/themes/default/template/alerts.tpl @@ -0,0 +1,87 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{if isset($conf)} +
+
+ + {$conf} +
+
+{/if} +{if isset($errors) && count($errors) && current($errors) != '' && (!isset($disableDefaultErrorOutPut) || $disableDefaultErrorOutPut == false)} +
+
+ + {if count($errors) == 1} + {reset($errors)} + {else } + {l s='%d errors' sprintf=$errors|count} +
+
    + {foreach $errors as $error} +
  1. {$error}
  2. + {/foreach} +
+ {/if} +
+
+{/if} +{if isset($informations) && count($informations) && $informations} +
+
+ +
    + {foreach $informations as $info} +
  • {$info}
  • + {/foreach} +
+
+
+{/if} +{if isset($confirmations) && count($confirmations) && $confirmations} +
+
+ {foreach $confirmations as $conf} + {$conf} + {/foreach} +
+
+{/if} +{if isset($warnings) && count($warnings)} +
+
+ + {if count($warnings) > 1} +

{l s='There are %d warnings:' sprintf=count($warnings)}

+ {/if} +
    + {foreach $warnings as $warning} +
  • {$warning}
  • + {/foreach} +
+
+
+{/if} diff --git a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl index ea72d4782..6d25b0a09 100644 --- a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl @@ -26,6 +26,10 @@ {extends file="helpers/form/form.tpl"} {block name="label"} + {if $input.name == 'vat_number'} +
+ {/if} + {if $input.type == 'text_customer' && !isset($customer)} {else} @@ -90,4 +94,7 @@ {else} {$smarty.block.parent} {/if} + {if $input.name == 'vat_number'} +
+ {/if} {/block} diff --git a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl index 7f8a5e8d1..e802993eb 100644 --- a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl @@ -74,7 +74,7 @@ {else}

{l s='No order was created from this cart.'}

{if $customer->id} - {l s='Create an order from this cart.'} + {l s='Create an order from this cart.'} {/if} {/if} @@ -87,52 +87,179 @@ {l s='Image'} - {l s='Room Type'} - {l s='Unit Price'} + {l s='Room Type'} + {l s='Hotel'} + {l s='Duration'} + {l s='occupancy'} + {l s='Room price'} + {l s='Extra services'} {l s='Total'} - {foreach from=$products item='product'} + {foreach from=$cart_htl_data item='room'} - {$product.image} - - - {$product.name}{if isset($product.attributes)}
{$product.attributes}{/if}
- {if $product.reference}{l s='Ref:'} {$product.reference}{/if} - {if $product.reference && $product.supplier_reference} / {$product.supplier_reference}{/if} + + +
+ {$room['room_type']} - {displayWtPriceWithCurrency price=$product.product_price currency=$currency} - {displayWtPriceWithCurrency price=$product.product_total currency=$currency} + {$room['room_type_info'].hotel_name} + {dateFormat date=$room['date_from']} - {dateFormat date=$room['date_to']} + + + {if $room['adults']}{$room['adults']}{/if} {if $room['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$room['children']}}, {$room['children']} {if $room['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} + + + {displayWtPriceWithCurrency price=$room['feature_price_tax_excl'] currency=$currency} + + {if (isset($room['extra_demands']) && $room['extra_demands']) || (isset($room['additional_service']) && $room['additional_service'])} + + {displayWtPriceWithCurrency price=($room['demand_price'] + $room['additional_service_price'] + $room['additional_services_auto_add_price'])|escape:'html':'UTF-8' currency=$currency} + + {else} + {displayWtPriceWithCurrency price=0 currency=$currency} + {/if} + + + {if (isset($room['extra_demands']) && $room['extra_demands']) || (isset($room['additional_service']) && $room['additional_service'])} + {displayWtPriceWithCurrency price=($room['amt_with_qty'] + $room['additional_services_auto_add_price'] + $room['demand_price'] + $room['additional_service_price'])|escape:'html':'UTF-8' currency=$currency} + {else} + {displayWtPriceWithCurrency price=$room['amt_with_qty']|escape:'html':'UTF-8' currency=$currency} + {/if} + + {/foreach} - {l s='Total cost of room types:'} + {l s='Total cost of room types:'} {displayWtPriceWithCurrency price=$total_products currency=$currency} {if $total_discounts != 0} - {l s='Total value of vouchers:'} + {l s='Total value of vouchers:'} {displayWtPriceWithCurrency price=$total_discounts currency=$currency} {/if} {if $total_wrapping > 0} - {l s='Total cost of gift wrapping:'} + {l s='Total cost of gift wrapping:'} {displayWtPriceWithCurrency price=$total_wrapping currency=$currency} {/if} {if $cart->getOrderTotal(true, Cart::ONLY_SHIPPING) > 0} - {l s='Total cost of shipping:'} + {l s='Total cost of shipping:'} {displayWtPriceWithCurrency price=$total_shipping currency=$currency} {/if} - {l s='Total:'} + {l s='Total:'} {displayWtPriceWithCurrency price=$total_price currency=$currency} diff --git a/admin/themes/default/template/controllers/dashboard/helpers/view/view.tpl b/admin/themes/default/template/controllers/dashboard/helpers/view/view.tpl index 3b54c23d5..593acfed7 100644 --- a/admin/themes/default/template/controllers/dashboard/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/dashboard/helpers/view/view.tpl @@ -129,15 +129,15 @@

{l s="Help Center"}

{l s="Official Documentation"}
-
{l s="Qloapps User Guide"}
+
{l s="QloApps User Guide"}
-
{l s="Qloapps Forum"}
-
{l s="Connect with the Qloapps community"}
+
{l s="QloApps Forum"}
+
{l s="Connect with the QloApps community"}
-
{l s="Qloapps Addons"}
-
{l s="Enhance your store Qloapps modules"}
+
{l s="QloApps Addons"}
+
{l s="Enhance your store QloApps modules"}
{l s="Contact Us!"}
@@ -148,4 +148,4 @@ - + \ No newline at end of file diff --git a/admin/themes/default/template/controllers/normal_products/associations.tpl b/admin/themes/default/template/controllers/normal_products/associations.tpl new file mode 100644 index 000000000..9217cb7b9 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/associations.tpl @@ -0,0 +1,124 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{if isset($product)} +
+ +

{l s='Associations'}

+ {include file="controllers/products/multishop/check_fields.tpl" product_tab="Associations"} +
+ {l s='Please select a default category.'} +
+
+ {l s='To create new categories '} {l s='click here.'} +
+
+
{include file="controllers/products/multishop/checkbox.tpl" field="category_box" type="category_box"}
+ +
+
+ {$category_tree} +
+ {* + {l s='Create new category'} + *} +
+
+
+
+ {l s='Associations are used to display service product category wise on room type page when'} {l s='Category filter'} {l s='is enabled'} +
+
+
+
{include file="controllers/products/multishop/checkbox.tpl" field="id_category_default" type="default"}
+ +
+ +
+
+ + + + + +
+{/if} diff --git a/admin/themes/default/template/controllers/normal_products/features.tpl b/admin/themes/default/template/controllers/normal_products/features.tpl new file mode 100644 index 000000000..cd84b2933 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/features.tpl @@ -0,0 +1,188 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{if isset($product->id)} +
+ +

{l s='Assign features to this room type'}

+ +
+ {l s='You can specify a value for each relevant feature regarding this room type. Empty fields will not be displayed.'}
+ {l s='You can either create a specific value, or select among the existing pre-defined values you\'ve previously added.'} +
+ + + + + + + + + + + + + {foreach from=$available_features item=available_feature} + + {foreach from=$available_feature.featureValues item=value} + + + + {/foreach} + + + + + + {foreachelse} + + + + {/foreach} + +
{l s='Feature'}{l s='Feature Image'}
+ + {$available_feature.name} + + +
{l s='No features have been defined'}
+ + + {l s='Add a new feature'} + + +
+ +{/literal} + +{/if} diff --git a/admin/themes/default/template/controllers/normal_products/helpers/form/form.tpl b/admin/themes/default/template/controllers/normal_products/helpers/form/form.tpl new file mode 100644 index 000000000..7b70d1c05 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/form/form.tpl @@ -0,0 +1,337 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{extends file="helpers/form/form.tpl"} + +{block name="autoload_tinyMCE"} + // Execute when tab Informations has finished loading + tabs_manager.onLoad('Informations', function(){ + tinySetup({ + editor_selector :"autoload_rte", + setup : function(ed) { + ed.on('init', function(ed) + { + if (typeof ProductMultishop.load_tinymce[ed.target.id] != 'undefined') + { + if (typeof ProductMultishop.load_tinymce[ed.target.id]) + tinyMCE.get(ed.target.id).hide(); + else + tinyMCE.get(ed.target.id).show(); + } + }); + + ed.on('keydown', function(ed, e) { + tinyMCE.triggerSave(); + textarea = $('#'+tinymce.activeEditor.id); + var max = textarea.parent('div').find('span.counter').data('max'); + if (max != 'none') + { + count = tinyMCE.activeEditor.getBody().textContent.length; + rest = max - count; + if (rest < 0) + textarea.parent('div').find('span.counter').html('{l s='Maximum'} '+ max +' {l s='characters'} : '+rest+''); + else + textarea.parent('div').find('span.counter').html(' '); + } + }); + } + }); + }); +{/block} + +{block name="defaultForm"} +
+
+
+ {foreach $product_tabs key=numStep item=tab} + {if $tab.name != "Pack"} + {$tab.name} + {/if} + {/foreach} +
+
+ + + + + + +
+ + {* *} + + + + {if isset($smarty.request.page) && $smarty.request.page > 1} + + {/if} + {if !$product->active && $product->isAssociatedToShop()} +
+ {l s='Your product will be saved as a draft.'} +  {l s='Save'} + +
+ {/if} + {* all input are here *} + {foreach $product_tabs key=numStep item=tab} + {if $tab.id != "Pack" } +
+ {if $tab.selected} + {$custom_form} + {/if} +
+ {/if} + {/foreach} + + +
+
+ +{/block} + diff --git a/admin/themes/default/template/controllers/normal_products/helpers/form/index.php b/admin/themes/default/template/controllers/normal_products/helpers/form/index.php new file mode 100644 index 000000000..2cba03ab6 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/form/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../../../'); +exit; diff --git a/admin/themes/default/template/controllers/normal_products/helpers/index.php b/admin/themes/default/template/controllers/normal_products/helpers/index.php new file mode 100644 index 000000000..c4c862b0d --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../../'); +exit; diff --git a/admin/themes/default/template/controllers/normal_products/helpers/list/index.php b/admin/themes/default/template/controllers/normal_products/helpers/list/index.php new file mode 100644 index 000000000..2cba03ab6 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/list/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../../../'); +exit; diff --git a/admin/themes/default/template/controllers/normal_products/helpers/list/list_header.tpl b/admin/themes/default/template/controllers/normal_products/helpers/list/list_header.tpl new file mode 100644 index 000000000..27872f854 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/list/list_header.tpl @@ -0,0 +1,36 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{extends file="helpers/list/list_header.tpl"} + +{block name=leadin} + {if isset($category_tree)} +
+
+ {$category_tree} +
+
+ {/if} +{/block} diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/index.php b/admin/themes/default/template/controllers/normal_products/helpers/tree/index.php new file mode 100644 index 000000000..2cba03ab6 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/tree/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../../../'); +exit; diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/subtree_associated_categories.tpl b/admin/themes/default/template/controllers/normal_products/helpers/tree/subtree_associated_categories.tpl new file mode 100644 index 000000000..6933af4bb --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/tree/subtree_associated_categories.tpl @@ -0,0 +1,55 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{if isset($nodes)} + {$nodes} +{/if} + + \ No newline at end of file diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_categories.tpl b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_categories.tpl new file mode 100644 index 000000000..d6ae6db17 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_categories.tpl @@ -0,0 +1,161 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
+ {if isset($header)}{$header}{/if} + {if isset($nodes)} +
    + {$nodes} +
+ {/if} +
+ diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_header.tpl b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_header.tpl new file mode 100644 index 000000000..34b00d3b9 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_header.tpl @@ -0,0 +1,25 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
{if isset($toolbar)}{$toolbar}{/if}
diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_hotels.tpl b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_hotels.tpl new file mode 100644 index 000000000..079538e41 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_associated_hotels.tpl @@ -0,0 +1,210 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
+ {if isset($header)}{$header}{/if} + {if isset($nodes)} +
    + {$nodes} +
+ {/if} +
+ diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_categories.tpl b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_categories.tpl new file mode 100644 index 000000000..a1698ea57 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_categories.tpl @@ -0,0 +1,127 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
+ {if isset($header)}{$header}{/if} + +
+ diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_header.tpl b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_header.tpl new file mode 100644 index 000000000..322536595 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_header.tpl @@ -0,0 +1,50 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + +
+
+ {if isset($toolbar)}{$toolbar}{/if} +
+ +
diff --git a/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_toolbar.tpl b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_toolbar.tpl new file mode 100644 index 000000000..0a817f113 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/tree/tree_toolbar.tpl @@ -0,0 +1,31 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
+ {if isset($actions)} + {foreach from=$actions item=action} + {$action->render()} + {/foreach} + {/if} +
\ No newline at end of file diff --git a/admin/themes/default/template/controllers/normal_products/helpers/uploader/ajax.tpl b/admin/themes/default/template/controllers/normal_products/helpers/uploader/ajax.tpl new file mode 100644 index 000000000..240e46188 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/uploader/ajax.tpl @@ -0,0 +1,193 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
+
+ + +
+
+ + + + diff --git a/admin/themes/default/template/controllers/normal_products/helpers/uploader/attachment_ajax.tpl b/admin/themes/default/template/controllers/normal_products/helpers/uploader/attachment_ajax.tpl new file mode 100644 index 000000000..7bbdc7094 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/uploader/attachment_ajax.tpl @@ -0,0 +1,119 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
+ + + +
+ + diff --git a/admin/themes/default/template/controllers/normal_products/helpers/uploader/index.php b/admin/themes/default/template/controllers/normal_products/helpers/uploader/index.php new file mode 100644 index 000000000..2cba03ab6 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/uploader/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../../../'); +exit; diff --git a/admin/themes/default/template/controllers/normal_products/helpers/uploader/virtual_product.tpl b/admin/themes/default/template/controllers/normal_products/helpers/uploader/virtual_product.tpl new file mode 100644 index 000000000..a9f7fe601 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/helpers/uploader/virtual_product.tpl @@ -0,0 +1,142 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{if isset($files) && $files|count > 0} + {assign var='show_thumbnail' value=false} + {foreach $files as $file} + {if isset($file.image) && $file.type == 'image'} + {assign var='show_thumbnail' value=true} + {/if} + {/foreach} +{if $show_thumbnail} +
+
+ {foreach $files as $file} + {if isset($file.image) && $file.type == 'image'} +
+

{$file.image}

+ {if isset($file.size)}

{l s='File size'} {$file.size}kb

{/if} + {if isset($file.delete_url)} +

+ + {l s='Delete'} + +

+ {/if} +
+ {/if} + {/foreach} +
+
+{/if} +{/if} +{if isset($max_files) && $files|count >= $max_files} +
+
{l s='You have reached the limit (%s) of files to upload, please remove files to continue uploading' sprintf=$max_files}
+
+{else} +
+
+ +
+ + + + + {if (!isset($multiple) || !$multiple) && isset($files) && $files|count == 1 && isset($files[0].download_url)} + + + {if isset($size)}{l s='Download current file (%skb)' sprintf=$size}{else}{l s='Download current file'}{/if} + + {/if} + +
+
+
+ +{/if} \ No newline at end of file diff --git a/admin/themes/default/template/controllers/normal_products/images.tpl b/admin/themes/default/template/controllers/normal_products/images.tpl new file mode 100644 index 000000000..29e0f97e6 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/images.tpl @@ -0,0 +1,356 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{if isset($id_product) && isset($product)} +
+ +
+ {l s='Images'} + {$countImages} +
+
+
+ +
+ {$image_uploader} +
+
+
{l s='Please upload a square image (Recommended resolution 800 x 800px)'} +
+
+
+
+ +
+ {foreach from=$languages item=language} + {if $languages|count > 1} +
+
+ {/if} + id} disabled="disabled"{/if}/> + {if $languages|count > 1} +
+
+ + +
+
+ {/if} + {/foreach} +
+
+ +
+
+ +
+
+
+ + + + + + + {if $shops} + {foreach from=$shops item=shop} + + {/foreach} + {/if} + + + + + + +
{l s='Image'}{l s='Caption'}{l s='Position'}{$shop.name}{l s='Cover'}
+ + + + + + {if $shops} + {foreach from=$shops item=shop} + + {/foreach} + {/if} + + + + + + +
+{/if} diff --git a/admin/themes/default/template/controllers/normal_products/index.php b/admin/themes/default/template/controllers/normal_products/index.php new file mode 100644 index 000000000..6174dac6d --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../'); +exit; diff --git a/admin/themes/default/template/controllers/normal_products/informations.tpl b/admin/themes/default/template/controllers/normal_products/informations.tpl new file mode 100644 index 000000000..acc85a424 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/informations.tpl @@ -0,0 +1,601 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{if $check_product_association_ajax} + {assign var=class_input_ajax value='check_product_name '} +{else} + {assign var=class_input_ajax value=''} +{/if} + +
+ +

{l s='Information'}

+ + + {if isset($display_common_field) && $display_common_field} +
{l s='Warning, if you change the value of fields with an orange bullet %s, the value will be changed for all other shops for this product' sprintf=$bullet_common_field}
+ {/if} + + {include file="controllers/products/multishop/check_fields.tpl" product_tab="Informations"} + +
+ + {*
*} +
+
{include file="controllers/products/multishop/checkbox.tpl" field="name" type="default" multilang="true"}
+ +
+ {include file="controllers/products/input_text_lang.tpl" + languages=$languages + input_class="{$class_input_ajax}{if !$product->id || Configuration::get('PS_FORCE_FRIENDLY_PRODUCT')}copy2friendlyUrl{/if} updateCurrentText" + input_value=$product->name + input_name="name" + required=true + } +
+
+ + + + + + + + + + {* status informations *} +
+
{include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}
+ +
+ + active || !$product->isAssociatedToShop()}checked="checked" {/if} /> + + active && $product->isAssociatedToShop()}checked="checked"{/if} /> + + + +
+
+ + + + + +
service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE}style="display:none;"{/if}> +
{include file="controllers/products/multishop/checkbox.tpl" field="category_box" type="category_box"}
+ +
+
+ {$hotel_tree} +
+
+
+
+ +
+ + auto_add_to_cart}checked="checked"{/if}/> + + auto_add_to_cart || !$product->isAssociatedToShop()}checked="checked"{/if}/> + + + +
+
+ +
auto_add_to_cart || !$product->isAssociatedToShop()}style="display:none;"{/if}> +
+ +
+ +
+
+
+
+
+ {l s='Select how this service price will be added in booking.'} +
    +
  • + {l s='Add price in room price'} : {l s='Service price will be added in room base price.'}
    {l s='(e.g., Room price : 500, service price: 50, final room price : 550)'} +
  • +
  • {l s='Add price as convenience fee'} : {l s='Service price will be dispalyed in order summary as "Convenience Fees"'}
  • +
+
+
+
+
+ + {*
+ +
+ +
+
*} + {*
service_product_type != Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE}style="display:none"{/if}> +
+
+ {l s='Independent products can only be bought from backoffice.'} +
+
+
*} +
auto_add_to_cart}style="display:none;"{/if}> + +
+ + show_at_front || !$product->isAssociatedToShop()}checked="checked"{/if}/> + + show_at_front && $product->isAssociatedToShop()}checked="checked"{/if}/> + + + +
+
+
show_at_front && $product->isAssociatedToShop()) || $product->auto_add_to_cart}style="display:none;"{/if}> + +
+ + available_for_order || !$product->isAssociatedToShop()}checked="checked"{/if}/> + + available_for_order && $product->isAssociatedToShop()}checked="checked"{/if}/> + + + +
+
+
available_for_order || (!$product->show_at_front && $product->isAssociatedToShop()) || !$product->isAssociatedToShop() || $product->auto_add_to_cart}style="display:none;"{/if}> + +
+ + show_price || !$product->isAssociatedToShop()}checked="checked"{/if}/> + + show_price && $product->isAssociatedToShop()}checked="checked"{/if}/> + + + +
+
+ + + +
available_for_order && $product->isAssociatedToShop()) || $product->auto_add_to_cart}style="display:none;"{/if}> +
+ +
+ + allow_multiple_quantity}checked="checked"{/if} value="1"/> + + allow_multiple_quantity}checked="checked"{/if} value="0"/> + + + +
+
+
available_for_order && $product->isAssociatedToShop()) || $product->auto_add_to_cart || !$product->allow_multiple_quantity}style="display:none;"{/if}> + +
+ +
+
+
+
+
+ {l s='By default all products have infinte quantity, Using this setting you can restrict customer to purchase only one product per room.'} +
+
+
+
+ + +
+ +
+
{include file="controllers/products/multishop/checkbox.tpl" field="description_short" type="tinymce" multilang="true"}
+ +
+ {include + file="controllers/products/textarea_lang.tpl" + languages=$languages + input_name='description_short' + class="autoload_rte" + input_value=$product->description_short + max=$PS_PRODUCT_SHORT_DESC_LIMIT} +
+
+ {*
+
{include file="controllers/products/multishop/checkbox.tpl" field="description" type="tinymce" multilang="true"}
+ +
+ {include + file="controllers/products/textarea_lang.tpl" + languages=$languages input_name='description' + class="autoload_rte" + input_value=$product->description} +
+
+ {if $images} +
+
+
+ {capture}{l s='Click here'}{/capture} + {l s='Would you like to add an image in your description? %s and paste the given tag in the description.' sprintf=$smarty.capture.default} +
+
+
+ + {/if}*} + + {*
+ +
+ {if $languages|count > 1} +
+ {/if} + {foreach from=$languages item=language} + {literal} + + {/literal} + {if $languages|count > 1} +
+
+ {/if} + + {if $languages|count > 1} +
+
+ + +
+
+ {/if} + {/foreach} + {if $languages|count > 1} +
+ {/if} +
+
+
{l s='Each tag has to be followed by a comma. The following characters are forbidden: %s' sprintf='!<;>;?=+#"°{}_$%.'} +
+
+
*} + +
+ diff --git a/admin/themes/default/template/controllers/normal_products/input_text_lang.tpl b/admin/themes/default/template/controllers/normal_products/input_text_lang.tpl new file mode 100644 index 000000000..7c280d602 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/input_text_lang.tpl @@ -0,0 +1,77 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{foreach from=$languages item=language} + {if $languages|count > 1} +
+
+ {/if} + {if isset($maxchar)} +
+ + {$maxchar} + + {/if} + + {if isset($maxchar)} +
+ {/if} + {if $languages|count > 1} +
+
+ + +
+
+ {/if} +{/foreach} +{if isset($maxchar)} + +{/if} diff --git a/admin/themes/default/template/controllers/normal_products/multishop/check_fields.tpl b/admin/themes/default/template/controllers/normal_products/multishop/check_fields.tpl new file mode 100644 index 000000000..4419aa59a --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/multishop/check_fields.tpl @@ -0,0 +1,56 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes} +
+ +
+
+
+ + + + + + + +
+
+
+
+

+ {l s='Check / Uncheck all'} {l s='(If you are editing this page for several shops, some fields may be disabled. If you need to edit them, you will need to check the box for each field)'} +

+
+
+
+
+{/if} diff --git a/admin/themes/default/template/controllers/normal_products/multishop/checkbox.tpl b/admin/themes/default/template/controllers/normal_products/multishop/checkbox.tpl new file mode 100644 index 000000000..a2e47e580 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/multishop/checkbox.tpl @@ -0,0 +1,41 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{if isset($display_multishop_checkboxes) && $display_multishop_checkboxes} + {if isset($multilang) && $multilang} + {if isset($only_checkbox)} + {foreach from=$languages item=language} + + {/foreach} + {else} + {foreach from=$languages item=language} + + {/foreach} + {/if} + {else} + + {/if} +{/if} \ No newline at end of file diff --git a/admin/themes/default/template/controllers/normal_products/multishop/index.php b/admin/themes/default/template/controllers/normal_products/multishop/index.php new file mode 100644 index 000000000..c4c862b0d --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/multishop/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../../'); +exit; diff --git a/admin/themes/default/template/controllers/normal_products/prices.tpl b/admin/themes/default/template/controllers/normal_products/prices.tpl new file mode 100644 index 000000000..be8a69b43 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/prices.tpl @@ -0,0 +1,640 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + +{capture assign=priceDisplayPrecisionFormat}{'%.'|cat:$smarty.const._PS_PRICE_DISPLAY_PRECISION_|cat:'f'}{/capture} +
+ +

{l s='product price'}

+
+ {l s='You must enter either the pre-tax retail price, or the retail price with tax. The input field will be automatically calculated.'} +
+ {include file="controllers/products/multishop/check_fields.tpl" product_tab="Prices"} +
+
{include file="controllers/products/multishop/checkbox.tpl" field="wholesale_price" type="default"}
+ +
+
+ {$currency->prefix}{$currency->suffix} + +
+ {if isset($pack) && $pack->isPack($product->id)}

{l s='The sum of wholesale prices of the product in the pack is %s%s%s' sprintf=[$currency->prefix,{toolsConvertPrice price=$pack->noPackWholesalePrice($product->id)|string_format:$priceDisplayPrecisionFormat},$currency->suffix]}

{/if} +
+
+
+
{include file="controllers/products/multishop/checkbox.tpl" field="price" type="price"}
+ +
+
+ {$currency->prefix}{$currency->suffix} + + +
+
+
+
+
{include file="controllers/products/multishop/checkbox.tpl" field="id_tax_rules_group" type="default"}
+ +
+ +
+
+ +
+ +
+
+
+ {if $tax_exclude_taxe_option} +
+
+
+ {l s='Taxes are currently disabled:'} + {l s='Click here to open the Taxes configuration page.'} + +
+
+
+ {/if} + +
+ +
+ {$currency->prefix}{$currency->suffix} + + +
+ {if isset($pack) && $pack->isPack($product->id)}

{l s='The sum of prices of the products in the pack is %s%s%s' sprintf=[$currency->prefix,{toolsConvertPrice price=$pack->noPackPrice($product->id)|string_format:$priceDisplayPrecisionFormat},$currency->suffix]}

{/if} +
+
+ +
+ +
+
+ {* As no use in QloApps currently so commented *} + {*
+
{include file="controllers/products/multishop/checkbox.tpl" field="unit_price" type="unit_price"}
+ +
+
+ {$currency->prefix}{$currency->suffix} + + {l s='per'} + +
+
+
*} + {if isset($product->unity) && $product->unity} +
+
+
+ {l s='or'} + {$currency->prefix}0.00{$currency->suffix} + {l s='per'} {$product->unity}{if $ps_tax && $country_display_tax_label} {l s='(tax incl.)'}{/if} + +
+
+
+ {/if} + {*
+
{include file="controllers/products/multishop/checkbox.tpl" field="on_sale" type="default"}
+ +
+
+ +
+
+
*} +
+
+
+ {l s='Final retail price:'} + + {$currency->prefix} + 0.00 + {$currency->suffix} + ({l s='tax incl.'}) + + + {if $country_display_tax_label} + / + {/if} + {$currency->prefix} + + {$currency->suffix} + {if $country_display_tax_label}({l s='tax excl.'}){/if} + +
+
+
+ + +
+ +{*
+

{l s='Feature Price Plans'}

+
+ {l s='You can set feature price plans by visiting '} + {l s='create feature price plans'} +
+
+ + + + + + + + + + + + + + + {if isset($productFeaturePrices) && $productFeaturePrices} + {foreach $productFeaturePrices as $featurePlan} + + + + + + + + + + + {/foreach} + {else} + + + + {/if} + +
#{l s='Id'}{l s='Plan Name'}{l s='Impact way'}{l s='Impact Type'}{l s='Impact Value'}{l s='Date From'}{l s='Date To'}{l s='Status'}
+ {$featurePlan['id_feature_price']} + + {$featurePlan['feature_price_name']} + + {if $featurePlan['impact_type'] == 1} + {l s='Percentage'} + {else} + {l s='Fixed Amount'} + {/if} + + {if $featurePlan['impact_way'] == 1} + {l s='Decrease'} + {else} + {l s='Increase'} + {/if} + + {if $featurePlan['impact_type'] == 1} + {$featurePlan['impact_value']|round:2}% + {else} + {displayPrice price=$featurePlan['impact_value']} + {/if} + + {dateFormat date=$featurePlan['date_from'] full=0} + + {if $featurePlan['date_selection_type'] == 1} + {dateFormat date=$featurePlan['date_to'] full=0} + {else} + {l s='Specific date'} + {/if} + + {if $featurePlan['active'] == 1} + + {else} + + {/if} +
+ {l s='No feature price plans.'} +
+
+
*} + +{if isset($specificPriceModificationForm)} +
+

{l s='Specific prices'}

+
+ {l s='You can set specific prices for clients belonging to different groups, different countries, etc.'} +
+ + + + +
+ + + + + {* *} + {if $multi_shop}{/if} + + + + + {if $country_display_tax_label} + + {else} + + {/if} + + + + + + + {$specificPriceModificationForm} + + {/if} diff --git a/admin/themes/default/template/controllers/normal_products/seo.tpl b/admin/themes/default/template/controllers/normal_products/seo.tpl new file mode 100644 index 000000000..0a0d3d38e --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/seo.tpl @@ -0,0 +1,116 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
+ +

{l s='SEO'}

+ {include file="controllers/products/multishop/check_fields.tpl" product_tab="Seo"} +
+
{include file="controllers/products/multishop/checkbox.tpl" field="meta_title" type="default" multilang="true"}
+ +
+ {include file="controllers/products/input_text_lang.tpl" + languages=$languages + input_name='meta_title' + input_value=$product->meta_title + maxchar=70 + } +
+
+
+
{include file="controllers/products/multishop/checkbox.tpl" field="meta_description" type="default" multilang="true"}
+ +
+ {include file="controllers/products/textarea_lang.tpl" + languages=$languages + input_name='meta_description' + input_value=$product->meta_description + maxchar=160 + } +
+
+ {* Removed for simplicity *} +
+
{include file="controllers/products/multishop/checkbox.tpl" field="meta_keywords" type="default" multilang="true"}
+ +
+ {include file="controllers/products/input_text_lang.tpl" languages=$languages + input_value=$product->meta_keywords + input_name='meta_keywords'} +
+
+
+
{include file="controllers/products/multishop/checkbox.tpl" field="link_rewrite" type="seo_friendly_url" multilang="true"}
+ +
+ {include file="controllers/products/input_text_lang.tpl" + languages=$languages + input_value=$product->link_rewrite + input_name='link_rewrite'} +
+
+ +
+
+
+
+ {foreach from=$languages item=language} +
+ {l s='The product link will look like this:'}
+ {if isset($rewritten_links[$language.id_lang][0])}{$rewritten_links[$language.id_lang][0]|escape:'html':'UTF-8'}{/if}{$product->link_rewrite[$language.id_lang]|escape:'html':'UTF-8'}{if isset($rewritten_links[$language.id_lang][1])}{$rewritten_links[$language.id_lang][1]|escape:'html':'UTF-8'}{/if} +
+ {/foreach} +
+
+ +
+ diff --git a/admin/themes/default/template/controllers/normal_products/specific_prices_shop_update.tpl b/admin/themes/default/template/controllers/normal_products/specific_prices_shop_update.tpl new file mode 100644 index 000000000..52fc2eab2 --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/specific_prices_shop_update.tpl @@ -0,0 +1,27 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{foreach from=$option_list item='row'} + +{/foreach} \ No newline at end of file diff --git a/admin/themes/default/template/controllers/normal_products/textarea_lang.tpl b/admin/themes/default/template/controllers/normal_products/textarea_lang.tpl new file mode 100644 index 000000000..a48a61aed --- /dev/null +++ b/admin/themes/default/template/controllers/normal_products/textarea_lang.tpl @@ -0,0 +1,69 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{foreach from=$languages item=language} + {if $languages|count > 1} +
+
+ {/if} + {if isset($maxchar) && $maxchar} +
+ + {$maxchar|intval} + + {/if} + + + {if isset($maxchar) && $maxchar} +
+ {/if} + {if $languages|count > 1} +
+
+ + +
+
+ {/if} +{/foreach} + + + diff --git a/admin/themes/default/template/controllers/orders/_booking_document_line.tpl b/admin/themes/default/template/controllers/orders/_booking_document_line.tpl new file mode 100644 index 000000000..9411ae1b8 --- /dev/null +++ b/admin/themes/default/template/controllers/orders/_booking_document_line.tpl @@ -0,0 +1,53 @@ +{** + * 2010-2023 Webkul. + * + * NOTICE OF LICENSE + * + * All right is reserved, + * Please go through LICENSE.txt file inside our module + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this module to newer + * versions in the future. If you wish to customize this module for your + * needs please refer to CustomizationPolicy.txt file inside our module for more information. + * + * @author Webkul IN + * @copyright 2010-2023 Webkul IN + * @license LICENSE.txt + *} + +{if is_array($booking_documents) && count($booking_documents)} + {foreach from=$booking_documents item=booking_document} +
+ + + + + + {/foreach} +{else} + + + +{/if} diff --git a/admin/themes/default/template/controllers/orders/_booking_documents_modal.tpl b/admin/themes/default/template/controllers/orders/_booking_documents_modal.tpl new file mode 100644 index 000000000..d62524b3f --- /dev/null +++ b/admin/themes/default/template/controllers/orders/_booking_documents_modal.tpl @@ -0,0 +1,101 @@ +{** + * 2010-2023 Webkul. + * + * NOTICE OF LICENSE + * + * All right is reserved, + * Please go through LICENSE.txt file inside our module + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this module to newer + * versions in the future. If you wish to customize this module for your + * needs please refer to CustomizationPolicy.txt file inside our module for more information. + * + * @author Webkul IN + * @copyright 2010-2023 Webkul IN + * @license LICENSE.txt + *} + +
{l s='Rule'}{l s='Combination'}{l s='Shop'}{l s='Currency'}{l s='Country'}{l s='Group'}{l s='Customer'}{l s='Fixed price (tax excl.)'}{l s='Fixed price'}{l s='Impact'}{l s='Period'}{l s='Action'}
+ + {if $booking_document.file_type == HotelBookingDocument::FILE_TYPE_IMAGE} + + {elseif $booking_document.file_type == HotelBookingDocument::FILE_TYPE_PDF} + + {/if} + + {$booking_document.title}{dateFormat date=$booking_document.date_add full=1} + + + + + + +
+
+ + {l s='No documents uploaded yet.'} +
+
+ + + + + + + + + +
{l s='Preview'}{l s='Title'}{l s='Upload Date'}{l s='Actions'}
+
+
+ + +
+
+ + + +{addJsDefL name=txt_booking_document_upload_success}{l s='Document uploaded successfully.' js=1}{/addJsDefL} +{addJsDefL name=txt_booking_document_delete_confirm}{l s='Are you sure?' js=1}{/addJsDefL} +{addJsDefL name=txt_booking_document_delete_success}{l s='Document deleted successfully.' js=1}{/addJsDefL} diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index ca7df51e9..2c30b44e6 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -17,55 +17,155 @@ * @license https://store.webkul.com/license.html *} -{if isset($selectedRoomDemands) && $selectedRoomDemands} - {assign var=roomCount value=1} - {foreach $selectedRoomDemands as $key => $roomDemand} -
-
- - - {if isset($roomDemand['room_num']) && $roomDemand['room_num']} - {l s='Room'} {$roomDemand['room_num']|escape:'html':'UTF-8'} - {else} - {l s='Room'} {$roomCount|escape:'html':'UTF-8'} + +
diff --git a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl index 35a13e9ac..2f421b9a4 100644 --- a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl +++ b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl @@ -25,90 +25,82 @@
- - - - - - - {if $occupancy_required_for_booking} + {if isset($cart_detail_data) && $cart_detail_data} + + + + + + + {if $occupancy_required_for_booking} {/if} - - - - - - - - {if isset($cart_detail_data) && $cart_detail_data} - {assign var=curr_id value=$cart->id_currency|intval} - {foreach from=$cart_detail_data item=data} - - - - - - {if $occupancy_required_for_booking} + + {* *} + + + + + + {assign var=curr_id value=$cart->id_currency|intval} + {foreach from=$cart_detail_data item=data} + + + + + {if $occupancy_required_for_booking} + + {/if} + - {/if} - - - - - - - {/foreach} - {else} - - - + + {* *} + + + + {/foreach} + + {/if} + {if isset($cart_normal_data) && $cart_normal_data} + + + + + + + + + + + + + {foreach $cart_normal_data as $product} + + + + + + + + + + {/foreach} + {/if} -
{l s='Room No.'}{l s='Room Image'}{l s='Room Type'}{l s='Duration'}
{l s='Room No.'}{l s='Room Image'}{l s='Room Type'}{l s='Duration'}{l s='Occupancy'}{l s='Unit Price (tax excl)'}{l s='Additinal Facilities (tax excl)'}{l s='Total Rooms Price (tax excl)'}{l s='Total Price (tax excl)'}
{$data.room_num|escape:'html':'UTF-8'} -

{$data.room_type|escape:'html':'UTF-8'}

- {if isset($data.selected_demands) && $data.selected_demands} -
    - {foreach $data.selected_demands as $selDemand} -
  • - {$selDemand.name|escape:'html':'UTF-8'} -
  • - {/foreach} -
- {/if} -
{dateFormat date=$data.date_from} - {dateFormat date=$data.date_to}{l s='Extra Services / Fees (tax excl)'}{l s='Total Rooms Price (tax excl)'}{l s='Total Price (tax excl)'}
{$data.room_num|escape:'html':'UTF-8'} - {dateFormat date=$data.date_from} - {dateFormat date=$data.date_to} + + {if $data.feature_price_diff != 0} + {assign var=shown_room_type_price value=$data.feature_price_tax_excl} + {else} + {assign var=shown_room_type_price value=$data.product_price_tax_excl} + {/if} +
+ + {$currency->prefix}{$currency->suffix}
- {if $data.feature_price_diff != 0} - {assign var=shown_room_type_price value=$data.feature_price_tax_excl} - {else} - {assign var=shown_room_type_price value=$data.product_price_tax_excl} - {/if} - - - {if isset($data.extra_demands) && $data.extra_demands} - {displayPrice price=$data.demand_price|escape:'html':'UTF-8'} - {else} - {displayPrice price=0} - {/if} - {displayPrice price=$data.amt_with_qty} - {if isset($data.extra_demands) && $data.extra_demands} - {displayPrice price=$data.amt_with_qty|escape:'html':'UTF-8'+$data.demand_price|escape:'html':'UTF-8'} - {else} - {displayPrice price=$data.amt_with_qty|escape:'html':'UTF-8'} - {/if} - - - {if isset($data.extra_demands) && $data.extra_demands} -
- -  {l s='Facilities'} - - {/if} -
{l s='No Room Found in the cart.'}
+ {if (isset($data.extra_demands) && $data.extra_demands) || (isset($data.additional_service) && $data.additional_service)} + {displayPrice price=($data.demand_price + $data.additional_service_price + $data.additional_services_auto_add_price)|escape:'html':'UTF-8'} + {else} + {displayPrice price=0} + {/if} + + {displayPrice price=$data.amt_with_qty} + {if (isset($data.extra_demands) && $data.extra_demands) || (isset($data.additional_service) && $data.additional_service)} + {displayPrice price=($data.amt_with_qty + $data.additional_services_auto_add_price + $data.demand_price + $data.additional_service_price)|escape:'html':'UTF-8'} + {else} + {displayPrice price=$data.amt_with_qty|escape:'html':'UTF-8'} + {/if} + + + {if (isset($data.extra_demands) && $data.extra_demands) || isset($data.additional_service) && $data.additional_service} +
+ +  {l s='Services'} + + {/if} +
{l s='Image'}{l s='Name'}{l s='Hotel Name'}{l s='Unit Price (tax excl)'}{l s='Quantity'}{l s='Total Price (Tax incl.)'}

{$product['name']|escape:'html':'UTF-8'}

{$product['hotel_name']}{displayPrice price=$product['unit_price_tax_incl']}{$product['quantity']|escape:'htmlall':'UTF-8'}{displayPrice price=$product['total_price_tax_incl']} + +
{* Modal for extra demands *} - +{* *} {strip} {addJsDefL name=txtExtraDemandSucc}{l s='Updated Successfully' js=1}{/addJsDefL} @@ -205,6 +208,8 @@ color:#979797; font-size:12px;} /*Extra demands CSS*/ + #rooms_type_extra_demands .modal-header { + padding-bottom: 0px} #rooms_extra_demands { font-size: 16px;} #rooms_extra_demands .room_demands_container { @@ -212,7 +217,7 @@ #rooms_extra_demands .demand_header { padding: 10px; color: #333; - border-bottom: 1px solid #ddd;} + border-bottom: 1px solid #ddd;} #rooms_extra_demands .rooms_extra_demands_head { margin-bottom: 18px;} #rooms_extra_demands .room_demand_block { diff --git a/admin/themes/default/template/controllers/orders/_new_product.tpl b/admin/themes/default/template/controllers/orders/_new_product.tpl index 141e9e68b..2aed227d3 100644 --- a/admin/themes/default/template/controllers/orders/_new_product.tpl +++ b/admin/themes/default/template/controllers/orders/_new_product.tpl @@ -23,7 +23,7 @@ * International Registered Trademark & Property of PrestaShop SA *} - +
@@ -50,7 +50,7 @@
{l s='Check In'}
- +
@@ -58,33 +58,13 @@
{l s='Check Out'}
- +
- -
-
-
- {if $currency->format % 2}
{$currency->sign} {l s='tax excl.'}
{/if} - - {if !($currency->format % 2)}
{$currency->sign} {l s='tax excl.'}
{/if} -
-
-
-
-
- {if $currency->format % 2}
{$currency->sign} {l s='tax incl.'}
{/if} - - {if !($currency->format % 2)}
{$currency->sign} {l s='tax incl.'}
{/if} -
-
-
- - - + {if $order->with_occupancy}
+
-
{l s='Add Room'} @@ -137,6 +117,27 @@ {/if} + +
+
+
+ {if $currency->format % 2}
{$currency->sign} {l s='tax excl.'}
{/if} + + {if !($currency->format % 2)}
{$currency->sign} {l s='tax excl.'}
{/if} +
+
+
+
+
+ {if $currency->format % 2}
{$currency->sign} {l s='tax incl.'}
{/if} + + {if !($currency->format % 2)}
{$currency->sign} {l s='tax incl.'}
{/if} +
+
+
+ + + {*{if ($order->hasBeenPaid())}{/if} {if $display_warehouse}{/if} {if ($order->hasBeenDelivered())}{/if} diff --git a/admin/themes/default/template/controllers/orders/_new_service_product.tpl b/admin/themes/default/template/controllers/orders/_new_service_product.tpl new file mode 100644 index 000000000..d11b5f358 --- /dev/null +++ b/admin/themes/default/template/controllers/orders/_new_service_product.tpl @@ -0,0 +1,128 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + + +
+ +
+ +
+ +
+
+
+ + {* + + *} + + {if ($order->getTaxCalculationMethod() != $smarty.const.PS_TAX_EXC)} + + {/if} + +
+
+ {if $currency->format % 2}
{$currency->sign} {l s='tax excl.'}
{/if} + + {if !($currency->format % 2)}
{$currency->sign} {l s='tax excl.'}
{/if} +
+
+
+
+
+ {if $currency->format % 2}
{$currency->sign} {l s='tax incl.'}
{/if} + + {if !($currency->format % 2)}
{$currency->sign} {l s='tax incl.'}
{/if} +
+
+ + + + + + {if ($order->hasBeenPaid())}{/if} + {if $display_warehouse}{/if} + {if ($order->hasBeenDelivered())}{/if} + 0 + {displayPrice price=0 currency=$currency->id} + + {if sizeof($invoices_collection)} + + {/if} + + + + + + + +{* + +

{l s='New invoice information'}

+
+
+ +
+

{$carrier->name}

+
+
+
+ +
+
+ +

{l s='If you don\'t select "Free shipping," the normal shipping cost will be applied.'}

+
+
+
+
+ + *} \ No newline at end of file diff --git a/admin/themes/default/template/controllers/orders/_product_line.tpl b/admin/themes/default/template/controllers/orders/_product_line.tpl index e63882646..fe5039d2c 100644 --- a/admin/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin/themes/default/template/controllers/orders/_product_line.tpl @@ -23,7 +23,7 @@ * International Registered Trademark & Property of PrestaShop SA *} - + {if $refund_allowed} @@ -37,16 +37,16 @@

{$data.room_type}

-

- - {l s='Additional Features'} + {*

+ + {l s='Extra Services'} -

- {if isset($data['extra_demands']) && $data['extra_demands']} +

*} + {* {if (isset($data['extra_demands']) && $data['extra_demands']) || (isset($data['additional_services']) && $data['additional_services'])}

- {convertPriceWithCurrency price=$data['extra_demands_price_ti'] currency=$currency->id} + {convertPriceWithCurrency price=($data['extra_demands_price_ti'] + $data['additional_services_price_ti']) currency=$currency->id}

- {/if} + {/if} *} @@ -162,21 +162,43 @@ - {if $data.feature_price_diff != 0} + {* {if $data['feature_price_diff'] != 0} - {convertPriceWithCurrency price=$data.unit_price_without_reduction_tax_excl currency=$currency->id} + {convertPriceWithCurrency price=$data['unit_price_without_reduction_tax_excl'] currency=$currency->id}   - {/if} - - {convertPriceWithCurrency price=$data.paid_unit_price_tax_excl currency=$currency->id} - + {/if} *} +

+ + {convertPriceWithCurrency price=$data['total_price_tax_excl'] currency=$currency->id} + +

+

{l s='Per day price:'} {convertPriceWithCurrency price=$data['paid_unit_price_tax_excl'] currency=$currency->id}

- {convertPriceWithCurrency price=$data.amt_with_qty_tax_incl currency=$currency->id} + + {convertPriceWithCurrency price=($data['extra_demands_price_te'] + $data['additional_services_price_te'] + $data['convenience_fee_te'] + $data['additional_services_price_auto_add_te']) currency=$currency->id} + {if ($data['extra_demands_price_te'] + $data['additional_services_price_te'] + $data['convenience_fee_te'] + $data['additional_services_price_auto_add_te']) > 0} +
+ + + {/if} + + + + + {convertPriceWithCurrency price=($data['total_room_tax']) currency=$currency->id} + + + {convertPriceWithCurrency price=($data['total_room_price_ti']) currency=$currency->id} {if $can_edit} @@ -1131,53 +1161,14 @@
- {l s='Rooms In This Order'} {$order_detail_data|@count} + {l s='Order Detail'} {$order_detail_data|@count} {* by webkul products changes as rooms *}
{* by webkul this code is added for showing rooms information on the order detail page *} -
-
- - - - {if $refund_allowed} - - {/if} - - - - - - - - - {if isset($refundReqBookings) && $refundReqBookings} - - - {/if} - - {if ($can_edit && !$order->hasBeenDelivered())} - - {/if} - - - - {if $order_detail_data} - {foreach from=$order_detail_data item=data} - {* Include product line partial *} - {include file='controllers/orders/_product_line.tpl'} - {/foreach} - {else} - - - - {/if} - {* Include product line partial *} - {include file='controllers/orders/_new_product.tpl'} - -
{l s='Room No.'}{l s='Room Image'}{l s='Room Type'}{l s='Hotel Name'}{l s='Duration'}{l s='Occupancy'}{l s='Unit Price (Tax excl.)'}{l s='Total Price (Tax incl.)'}{l s='Refund State'}{l s='Refunded amount'}{l s='Reallocate Room'}{l s='Edit Order'}
{l s='No Data Found.'}
-
-
+ {include file='controllers/orders/_rooms_informaion_table.tpl'} +
+ {include file='controllers/orders/_service_products_table.tpl'} + {capture "TaxMethod"} {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} @@ -1192,12 +1183,16 @@ {/if} {if $can_edit} - - {/foreach} + {foreach $adv_option as $option} + {assign var="rowcount" value=$rowcount + 1} + + {if $rowcount <= 1} + + + + + + {$demand['name']|escape:'html':'UTF-8'} + + {/if} + + {$option['name']|escape:'html':'UTF-8'} + + +
+ {$defaultcurrencySign|escape:'html':'UTF-8'} + +
+
+ {displayPrice price={$option['price']|escape:'html':'UTF-8'} currency=$module->id_currency} +
+ + + {if $rowcount == 1} + + {$demand['default_tax_rules_group_name']} + + + {if $demand['price_calc_method'] == 1} + {l s='Yes'} + {else} + {l s='No'} + {/if} + + {/if} + + {foreachelse} + + + + + + {$demand['name']|escape:'html':'UTF-8'} + + + + +
+ {$defaultcurrencySign|escape:'html':'UTF-8'} + +
+
+ {displayPrice price={$demand['price']|escape:'html':'UTF-8'} currency=$module->id_currency} +
+ + + {$demand['default_tax_rules_group_name']} + + + {if $demand['price_calc_method'] == 1} + {l s='Yes'} + {else} + {l s='No'} + {/if} + + + {/foreach} + {/foreach} + +
{/if}
-{/if} +{/if} \ No newline at end of file diff --git a/admin/themes/default/template/controllers/products/attachments.tpl b/admin/themes/default/template/controllers/products/attachments.tpl deleted file mode 100644 index 5a3d12419..000000000 --- a/admin/themes/default/template/controllers/products/attachments.tpl +++ /dev/null @@ -1,126 +0,0 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -{if isset($obj->id)} - -{/if} diff --git a/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl b/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl new file mode 100644 index 000000000..fc157a5b3 --- /dev/null +++ b/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl @@ -0,0 +1,37 @@ +{** +* 2010-2023 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through LICENSE.txt file inside our module +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to newer +* versions in the future. If you wish to customize this module for your +* needs please refer to CustomizationPolicy.txt file inside our module for more information. +* +* @author Webkul IN +* @copyright 2010-2023 Webkul IN +* @license LICENSE.txt +*} + +{l s='This room already has bookings for highlighted date range(s):'} + + + + + + + + {foreach from=$booked_rows_list item=booked_row} + + + + + + {/foreach} +
{l s='Order ID'}{l s='Date From'}{l s='Date To'}
+ #{$booked_row->id_order|intval} + {dateFormat date=$booked_row->date_from}{dateFormat date=$booked_row->date_to}
diff --git a/admin/themes/default/template/controllers/products/combinations.tpl b/admin/themes/default/template/controllers/products/combinations.tpl deleted file mode 100644 index 8d7895bde..000000000 --- a/admin/themes/default/template/controllers/products/combinations.tpl +++ /dev/null @@ -1,367 +0,0 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} -{if isset($product->id) && !$product->is_virtual} -
- - -

{l s='Add or modify combinations for this product'}

-
- {l s='You can also use the [1]Product Combinations Generator[2/][/1] in order to automatically create a set of combinations.' tags=["", '']} -
- {if $combination_exists} -
- {l s='Some combinations already exist. If you want to generate a set of new combinations, the quantities for the existing combinations will be lost.'}
- {l s='You can add a single combination by clicking the "New combination" button.'} -
- {/if} - {if isset($display_multishop_checkboxes) && $display_multishop_checkboxes} -
- {include file="controllers/products/multishop/check_fields.tpl" product_tab="Combinations"} - {/if} - - {$list} -
-
-{/if} diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 386114df0..cbf758d67 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -95,7 +95,7 @@ - {if $room_info['id_status'] != $rm_status['STATUS_TEMPORARY_INACTIVE']['id'] }{l s='Add Dates'}{else}{l s='View Dates'}{/if} + {if $room_info['id_status'] != $rm_status['STATUS_TEMPORARY_INACTIVE']['id'] }{l s='Add Dates'}{else}{l s='View Dates'}{/if} @@ -184,6 +184,7 @@
diff --git a/admin/themes/default/template/controllers/products/occupancy.tpl b/admin/themes/default/template/controllers/products/occupancy.tpl index 1605e2818..db17ea06e 100644 --- a/admin/themes/default/template/controllers/products/occupancy.tpl +++ b/admin/themes/default/template/controllers/products/occupancy.tpl @@ -54,7 +54,9 @@
- {l s='Below, enter the maximum of adults or children which can be accommodated in a room of this room type. Also, enter maximum number of guests for this room type.'} + {l s='Below, enter the maximum number of adults and children which can be accommodated in a room of this room type.'} +
+ {l s='For maximum room occupancy, the total number of guests which can be accommodated in a room of this room type.'}
diff --git a/admin/themes/default/template/controllers/products/pack.tpl b/admin/themes/default/template/controllers/products/pack.tpl deleted file mode 100644 index 3295e05fc..000000000 --- a/admin/themes/default/template/controllers/products/pack.tpl +++ /dev/null @@ -1,74 +0,0 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - - -
-
- -
-

{l s='This pack is empty. You must add at least one product item.'}

-
    - {foreach $pack_items as $pack_item} -
  • - - {$pack_item.name} - REF: {$pack_item.reference} - x{$pack_item.pack_quantity} - -
  • - {/foreach} -
-
-
-
- -
-
-
- -
-
-
- × - -
-
-
- -
-
-
-
- - - \ No newline at end of file diff --git a/admin/themes/default/template/controllers/products/quantities.tpl b/admin/themes/default/template/controllers/products/quantities.tpl deleted file mode 100644 index 4de8202aa..000000000 --- a/admin/themes/default/template/controllers/products/quantities.tpl +++ /dev/null @@ -1,301 +0,0 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -{if isset($product->id)} -
- -

{l s='Available quantities for sale'}

- {if !$ps_stock_management} -
{l s='The stock management is disabled'}
- {else} - {include file="controllers/products/multishop/check_fields.tpl" product_tab="Quantities"} -
- {l s='This interface allows you to manage available quantities for sale for products. It also allows you to manage product combinations in the current shop.'}
- {l s='You can choose whether or not to use the advanced stock management system for this product.'}
- {l s='You can manually specify the quantities for the product/each product combination, or you can choose to automatically determine these quantities based on your stock (if advanced stock management is activated).'}
- {l s='In this case, quantities correspond to the real-stock quantities in the warehouses connected with the current shop, or current group of shops.'}
- {l s='For packs: If it has products that use advanced stock management, you have to specify a common warehouse for these products in the pack.'}
- {l s='Also, please note that when a product has combinations, its default combination will be used in stock movements.'} -
- - {if $show_quantities == true} -
is_virtual}style="display:none;"{/if} class="row stockForVirtualProduct"> -
-

- -

- {if $stock_management_active == 0 && !$product->cache_is_pack} -

 {l s='This requires you to enable advanced stock management.'}

- {elseif $product->cache_is_pack} -

{l s='When enabling advanced stock management for a pack, please make sure it is also enabled for its product(s) – if you choose to decrement product quantities.'}

- {/if} -
-
- -
is_virtual}style="display:none;"{/if} class="form-group stockForVirtualProduct"> - -
-

- -

- {if $product->cache_is_pack} -

- {l s='You cannot use advanced stock management for this pack if'}
- {l s='- advanced stock management is not enabled for these products'}
- {l s='- you have chosen to decrement products quantities.'} -

- {/if} -

- -

-
-
-
cache_is_pack}style="display:none"{/if}> - -
-

- -

-

- -

-

- -

-

- -

-
-
- {if isset($pack_quantity)} -
-

{l s='When a product has combinations, quantities will be based on the default combination.'}

-

{l s='Given the quantities of the products in this pack, the maximum quantity should be:'} {$pack_quantity}

-
- {/if} -
-
- - - - - - - - {foreach from=$attributes item=attribute} - - - - - {/foreach} -
{l s='Quantity'}{l s='Designation'}
- {$available_quantity[$attribute['id_product_attribute']]} - - {$product_designation[$attribute['id_product_attribute']]}
-
-
-
- -
-

- -

-

- -

-

- -

-
-
- - {else} -
-

{l s='It is not possible to manage quantities when:'}

-
    -
  • {l s='You are currently managing all of your shops.'}
  • -
  • {l s='You are currently managing a group of shops where quantities are not shared between every shop in this group.'}
  • -
  • {l s='You are currently managing a shop that is in a group where quantities are shared between every shop in this group.'}
  • -
-
- {/if} - {/if} -
-
-
-

{l s='Availability settings'}

- - {if !$has_attribute} -
-
{include file="controllers/products/multishop/checkbox.tpl" field="minimal_quantity" type="default"}
- -
- -

{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}

-
-
- {/if} - - {if $ps_stock_management} -
-
{include file="controllers/products/multishop/checkbox.tpl" field="available_now" type="default" multilang="true"}
- -
- {include file="controllers/products/input_text_lang.tpl" - languages=$languages - input_value=$product->available_now - input_name='available_now'} -
-
-
-
{include file="controllers/products/multishop/checkbox.tpl" field="available_later" type="default" multilang="true"}
- -
- {include file="controllers/products/input_text_lang.tpl" - languages=$languages - input_value=$product->available_later - input_name='available_later'} -
-
- - {if !$countAttributes} -
-
{include file="controllers/products/multishop/checkbox.tpl" field="available_date" type="default"}
- -
-
- -
- -
- -
-

{l s='The next date of availability for this product when it is out of stock.'}

-
-
- {/if} - {/if} - - -
- -{/if} diff --git a/admin/themes/default/template/controllers/products/serviceproduct.tpl b/admin/themes/default/template/controllers/products/serviceproduct.tpl new file mode 100644 index 000000000..5baab2136 --- /dev/null +++ b/admin/themes/default/template/controllers/products/serviceproduct.tpl @@ -0,0 +1,103 @@ +{if isset($product->id)} +
+ +

{l s='Service Products'}

+ + {if isset($service_products) && $service_products} +
+ + + + + + + + + + + + + + {foreach from=$service_products key=key item=service_product} + + + + + + + + + + {/foreach} + + +
+ + {else} +
+ {l s='No services are attached with this room type'} +
+ {/if} +
+{/if} \ No newline at end of file diff --git a/admin/themes/default/template/controllers/products/shipping.tpl b/admin/themes/default/template/controllers/products/shipping.tpl deleted file mode 100644 index b3553b5ff..000000000 --- a/admin/themes/default/template/controllers/products/shipping.tpl +++ /dev/null @@ -1,118 +0,0 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} -
- -

{l s='Shipping'}

- - {if isset($display_common_field) && $display_common_field} -
{l s='Warning, if you change the value of fields with an orange bullet %s, the value will be changed for all other shops for this product' sprintf=$bullet_common_field}
- {/if} - -
- -
- {$ps_dimension_unit} - -
-
- -
- -
- {$ps_dimension_unit} - -
-
- -
- -
- {$ps_dimension_unit} - -
-
- -
- -
- {$ps_weight_unit} - -
-
- -
- -
- {$currency->prefix}{$currency->suffix} {if $country_display_tax_label}({l s='tax excl.'}){/if} - -
-
- -
- -
-
-
-

{l s='Available carriers'}

- - {l s='Add'} -
-
-

{l s='Selected carriers'}

- - {l s='Remove'} -
-
-
-
-
-
-
{l s='If no carrier is selected then all the carriers will be available for customers orders.'}
-
-
- -
diff --git a/admin/themes/default/template/controllers/products/suppliers.tpl b/admin/themes/default/template/controllers/products/suppliers.tpl deleted file mode 100644 index c01949554..000000000 --- a/admin/themes/default/template/controllers/products/suppliers.tpl +++ /dev/null @@ -1,138 +0,0 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - - -{if isset($product->id)} -
- -

{l s='Suppliers of the current product'}

-
- {l s='This interface allows you to specify the suppliers of the current product and eventually its combinations.'}
- {l s='It is also possible to specify supplier references according to previously associated suppliers.'}
-
- {l s='When using the advanced stock management tool (see Preferences/Products), the values you define (prices, references) will be used in supply orders.'} -
- - - - - - - - - - - {foreach from=$suppliers item=supplier} - - - - - - {/foreach} - -
{l s='Selected'}{l s='Supplier Name'}{l s='Default'}
{$supplier['name']}
- - {l s='Create a new supplier'} - - -
-
-

{l s='Supplier reference(s)'}

-
- {if $associated_suppliers|@count == 0} - {l s='You must specify the suppliers associated with this product. You must also select the default product supplier before setting references.'} - {else} - {l s='You can specify product reference(s) for each associated supplier.'} - {/if} - {l s='Click "Save and Stay" after changing selected suppliers to display the associated product references.'} -
-
- {foreach from=$associated_suppliers item=supplier name=data} -
- -
-
- - - - - - - - - - - {foreach $attributes AS $index => $attribute} - {assign var=reference value=''} - {assign var=price_te value=''} - {assign var=id_currency value=$id_default_currency} - {foreach from=$associated_suppliers_collection item=asc} - {if $asc->id_product == $attribute['id_product'] && $asc->id_product_attribute == $attribute['id_product_attribute'] && $asc->id_supplier == $supplier->id_supplier} - {assign var=reference value=$asc->product_supplier_reference} - {assign var=price_te value=Tools::ps_round($asc->product_supplier_price_te, 2)} - {if $asc->id_currency} - {assign var=id_currency value=$asc->id_currency} - {/if} - {/if} - {/foreach} - - - - - - - {/foreach} - -
{l s='Product name'}{l s='Supplier reference'}{l s='Unit price tax excluded'}{l s='Unit price currency'}
{$product_designation[$attribute['id_product_attribute']]} - - - - - -
-
-
-
- {/foreach} -
- -
-{/if} diff --git a/admin/themes/default/template/controllers/products/virtualproduct.tpl b/admin/themes/default/template/controllers/products/virtualproduct.tpl deleted file mode 100644 index f48af53ff..000000000 --- a/admin/themes/default/template/controllers/products/virtualproduct.tpl +++ /dev/null @@ -1,155 +0,0 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - - -
- - -

{l s='Virtual Product (services, booking or downloadable products)'}

-
- is_virtual && $product->productDownload->active}checked="checked"{/if} /> - -
-
productDownload->id || $product->productDownload->active}style="display:none"{/if} class="form-group"> -
- -
- - - - - - - -
-
- -
- -
diff --git a/admin/themes/default/template/controllers/products/warehouses.tpl b/admin/themes/default/template/controllers/products/warehouses.tpl deleted file mode 100644 index 76f68c2d6..000000000 --- a/admin/themes/default/template/controllers/products/warehouses.tpl +++ /dev/null @@ -1,100 +0,0 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - - -{if isset($product->id)} -
- -

{l s='Product location in warehouses'}

-
-
-

{l s='This interface allows you to specify the warehouse in which the product is stocked.'}

-

{l s='You can also specify product/product combinations as it relates to warehouse location. '}

-
-

{l s='Please choose the warehouses associated with this product.'}

-
- -
-
- {foreach from=$warehouses item=warehouse name=data} -
- -
- - - - - - - - - - {foreach $attributes AS $index => $attribute} - {assign var=location value=''} - {assign var=selected value=''} - {foreach from=$associated_warehouses item=aw} - {if $aw->id_product == $attribute['id_product'] && $aw->id_product_attribute == $attribute['id_product_attribute'] && $aw->id_warehouse == $warehouse['id_warehouse']} - {assign var=location value=$aw->location} - {assign var=selected value=true} - {/if} - {/foreach} - - - - - - {/foreach} -
{l s='Stored'}{l s='Product'}{l s='Location (optional)'}
- {$product_designation[$attribute['id_product_attribute']]} -
- {if $attributes|@count gt 1} - - - {/if} -
-
- {/foreach} -
-
- -
-{/if} diff --git a/admin/themes/default/template/controllers/search/helpers/view/view.tpl b/admin/themes/default/template/controllers/search/helpers/view/view.tpl index ce4853502..f7577de04 100644 --- a/admin/themes/default/template/controllers/search/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/search/helpers/view/view.tpl @@ -108,39 +108,39 @@ $(function() {
{/if} - {if isset($products) && $products} + {if isset($num_products) && $num_products}

- {if $products|@count == 1} + {if $num_products == 1} {l s='1 product'} {else} - {l s='%d products' sprintf=$products|@count} + {l s='%d products' sprintf=$num_products} {/if}

{$products}
{/if} - {if isset($customers) && $customers} + {if isset($num_customers) && $num_customers}

- {if $customers|@count == 1} + {if $num_customers == 1} {l s='1 customer'} {else} - {l s='%d customers' sprintf=$customers|@count} + {l s='%d customers' sprintf=$num_customers} {/if}

{$customers}
{/if} - {if isset($orders) && $orders} + {if isset($num_orders) && $num_orders}

- {if $orders|@count == 1} + {if $num_orders == 1} {l s='1 order'} {else} - {l s='%d orders' sprintf=$orders|@count} + {l s='%d orders' sprintf=$num_orders} {/if}

{$orders} diff --git a/admin/themes/default/template/controllers/specific_price_rule/helpers/form/form.tpl b/admin/themes/default/template/controllers/specific_price_rule/helpers/form/form.tpl index 9ad52f538..6f7ee30f4 100644 --- a/admin/themes/default/template/controllers/specific_price_rule/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/specific_price_rule/helpers/form/form.tpl @@ -52,7 +52,7 @@
-
+ {*
@@ -68,8 +68,8 @@
-
-
+
*} + {*
@@ -85,8 +85,8 @@
-
-
+
*} + {*
@@ -111,7 +111,7 @@
-
+
*}
diff --git a/admin/themes/default/template/helpers/form/form.tpl b/admin/themes/default/template/helpers/form/form.tpl index 75e0dce6f..2cd9bfb6b 100644 --- a/admin/themes/default/template/helpers/form/form.tpl +++ b/admin/themes/default/template/helpers/form/form.tpl @@ -763,6 +763,7 @@ id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" type="text" data-hex="true" + {if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if} {if isset($input.class)} class="{$input.class}" {else}class="datepicker"{/if} name="{$input.name}" @@ -779,6 +780,7 @@ id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" type="text" data-hex="true" + {if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if} {if isset($input.class)} class="{$input.class}" {else} class="datetimepicker"{/if} name="{$input.name}" diff --git a/admin/themes/default/template/helpers/list/list_content.tpl b/admin/themes/default/template/helpers/list/list_content.tpl index 050072c95..169041dc6 100644 --- a/admin/themes/default/template/helpers/list/list_content.tpl +++ b/admin/themes/default/template/helpers/list/list_content.tpl @@ -39,6 +39,7 @@ {/if} {foreach $fields_display AS $key => $params} + {if isset($params.displayed) && $params.displayed === false}{continue}{/if} {block name="open_td"} + onclick="document.location = '{$current_index|escape:'html':'UTF-8'}&{$identifier|escape:'html':'UTF-8'}={$tr.$identifier|escape:'html':'UTF-8'}{if $view}&view{else}&update{/if}{$table|escape:'html':'UTF-8'}{if $page > 1}&page={$page|intval}{/if}&token={$token|escape:'html':'UTF-8'}'" {else} - > - {/if} + {/if} + data-key="{$key}" + > {/block} {block name="td_content"} {if isset($params.prefix)}{$params.prefix}{/if} diff --git a/admin/themes/default/template/helpers/list/list_header.tpl b/admin/themes/default/template/helpers/list/list_header.tpl index 82a11864c..fc2dcc571 100644 --- a/admin/themes/default/template/helpers/list/list_header.tpl +++ b/admin/themes/default/template/helpers/list/list_header.tpl @@ -121,45 +121,105 @@ {block name="override_form_extra"}{/block} -
-
- {if isset($icon)} {/if}{if is_array($title)}{$title|end}{else}{$title}{/if} - {if isset($toolbar_btn) && count($toolbar_btn) >0} - {$list_total} - - {foreach from=$toolbar_btn item=btn key=k} - {if $k != 'modules-list' && $k != 'back'} - - - - - - {/if} - {/foreach} - - - - - - {if isset($sql) && $sql} - {assign var=sql_manager value=Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminRequestSql'))} +
+ {block name="panel_heading"} +
+ {if isset($icon)} {/if}{if is_array($title)}{$title|end}{else}{$title}{/if} + {if isset($toolbar_btn) && count($toolbar_btn) >0} + {$list_total} + {block name="panel_heading_action"} + + {foreach from=$toolbar_btn item=btn key=k} + {if $k != 'modules-list' && $k != 'back'} + + + + + + {/if} + {/foreach} + {if $fields_optional|count} + + + + + + {/if} + + + + + + + {if isset($sql) && $sql} + {assign var=sql_manager value=Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminRequestSql'))} + + {if $sql_manager.view == 1} + + + + + + + + + + + {/if} + {/if} + + {/block} {/if} - - {/if} -
+
+ {/block} {if $show_toolbar} -
- {elseif $params.type == 'select'} - {if isset($params.filter_key)} - - {/if} + + {/if} + {* Filters (input, select, date or bool) *} + {foreach $fields_display AS $key => $params} + {if isset($params.displayed) && $params.displayed === false}{continue}{/if} + + {if isset($params.search) && !$params.search} + -- {else} - - {/if} - {/if} - - {/foreach} + {if $params.type == 'range'} +
+ + +
+ {else if $params.type == 'bool'} + + {elseif $params.type == 'date' || $params.type == 'datetime'} +
+
+ + + + + +
+
+ + + + + +
+ +
+ {elseif $params.type == 'select'} + {if isset($params.filter_key)} + + {/if} + {else} + + {/if} {/if} - - {/if} - - {/if} - - {/if} + + {/foreach} + + {if $shop_link_type} + -- + {/if} + {if $has_actions || $show_filters} + + {if $show_filters} + + {*Search must be before reset for default form submit*} + + {if $filters_has_value} + + {/if} + + {/if} + + {/if} + + {/if} + {/block} diff --git a/admin/themes/default/template/helpers/tree/tree_hotels.tpl b/admin/themes/default/template/helpers/tree/tree_hotels.tpl new file mode 100644 index 000000000..36b6f6602 --- /dev/null +++ b/admin/themes/default/template/helpers/tree/tree_hotels.tpl @@ -0,0 +1,102 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
+ {if isset($header)}{$header}{/if} + {if isset($nodes)} +
    + {$nodes} +
+ {/if} +
+ diff --git a/admin/themes/default/template/helpers/tree/tree_node_hotel_folder_checkbox.tpl b/admin/themes/default/template/helpers/tree/tree_node_hotel_folder_checkbox.tpl new file mode 100644 index 000000000..3e826b714 --- /dev/null +++ b/admin/themes/default/template/helpers/tree/tree_node_hotel_folder_checkbox.tpl @@ -0,0 +1,37 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
  • + + {if isset($node['id_hotel'])} + + {* {if isset($node['id_category']) && $node['id_category'] != $root_category} *} + {/if} + + + +
      + {$children|escape:'UTF-8'} +
    +
  • diff --git a/admin/themes/default/template/helpers/tree/tree_node_hotel_item_checkbox.tpl b/admin/themes/default/template/helpers/tree/tree_node_hotel_item_checkbox.tpl new file mode 100644 index 000000000..4353d6e88 --- /dev/null +++ b/admin/themes/default/template/helpers/tree/tree_node_hotel_item_checkbox.tpl @@ -0,0 +1,31 @@ +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +
  • + + + + + +
  • \ No newline at end of file diff --git a/admin/themes/default/template/layout.tpl b/admin/themes/default/template/layout.tpl index 7c7f49606..f408041a6 100644 --- a/admin/themes/default/template/layout.tpl +++ b/admin/themes/default/template/layout.tpl @@ -23,68 +23,6 @@ * International Registered Trademark & Property of PrestaShop SA *} {$header} -{if isset($conf)} -
    -
    - - {$conf} -
    -
    -{/if} -{if count($errors) && current($errors) != '' && (!isset($disableDefaultErrorOutPut) || $disableDefaultErrorOutPut == false)} - -
    -
    - - {if count($errors) == 1} - {reset($errors)} - {else } - {l s='%d errors' sprintf=$errors|count} -
    -
      - {foreach $errors as $error} -
    1. {$error}
    2. - {/foreach} -
    - {/if} -
    -
    -{/if} -{if isset($informations) && count($informations) && $informations} -
    -
    - -
      - {foreach $informations as $info} -
    • {$info}
    • - {/foreach} -
    -
    -
    -{/if} -{if isset($confirmations) && count($confirmations) && $confirmations} -
    -
    - {foreach $confirmations as $conf} - {$conf} - {/foreach} -
    -
    -{/if} -{if count($warnings)} -
    -
    - - {if count($warnings) > 1} -

    {l s='There are %d warnings:' sprintf=count($warnings)}

    - {/if} -
      - {foreach $warnings as $warning} -
    • {$warning}
    • - {/foreach} -
    -
    -
    -{/if} +{include file='./alerts.tpl'} {$page} {$footer} diff --git a/admin/themes/default/template/recomended-banner.tpl b/admin/themes/default/template/recomended-banner.tpl index 343cd5899..70519f354 100644 --- a/admin/themes/default/template/recomended-banner.tpl +++ b/admin/themes/default/template/recomended-banner.tpl @@ -17,7 +17,7 @@ * @license https://store.webkul.com/license.html *} -
    + + +
    '; + + $content .= ' + + '; + + // Not use id_customer + if ($specific_price_priorities[0] == 'id_customer') { + unset($specific_price_priorities[0]); + } + // Reindex array starting from 0 + $specific_price_priorities = array_values($specific_price_priorities); + + $content .= '
    +

    '.$this->l('Priority management').'

    +
    + '.$this->l('Sometimes one customer can fit into multiple price rules. Priorities allow you to define which rule applies to the customer.').' +
    '; + + $content .= ' +
    + +
    + + + + + + + +
    +
    +
    +
    +

    + +

    +
    +
    + +
    + '; + return $content; + } + + /** + * @param Product $product + * @throws Exception + * @throws SmartyException + */ + public function initFormInformations($product) + { + if (!$this->default_form_language) { + $this->getLanguages(); + } + + $data = $this->createTemplate($this->tpl_form); + + $currency = $this->context->currency; + + $data->assign(array( + 'languages' => $this->_languages, + 'default_form_language' => $this->default_form_language, + 'currency' => $currency + )); + $this->object = $product; + //$this->display = 'edit'; + $data->assign('product_name_redirected', Product::getProductName((int)$product->id_product_redirected, null, (int)$this->context->language->id)); + /* + * Form for adding a virtual product like software, mp3, etc... + */ + $product_download = new ProductDownload(); + if ($id_product_download = $product_download->getIdFromIdProduct($this->getFieldValue($product, 'id'))) { + $product_download = new ProductDownload($id_product_download); + } + + $product->{'productDownload'} = $product_download; + + $product_props = array(); + // global informations + array_push($product_props, 'reference', 'ean13', 'upc', + 'available_for_order', 'show_price', 'online_only', + 'id_manufacturer' + ); + + // specific / detailled information + array_push($product_props, + // physical product + 'width', 'height', 'weight', 'active', + // virtual product + 'is_virtual', 'cache_default_attribute', + // customization + 'uploadable_files', 'text_fields' + ); + // prices + array_push($product_props, + 'price', 'wholesale_price', 'id_tax_rules_group', 'unit_price_ratio', 'on_sale', + 'unity', 'minimum_quantity', 'additional_shipping_cost', + 'available_now', 'available_later', 'available_date' + ); + + if (Configuration::get('PS_USE_ECOTAX')) { + array_push($product_props, 'ecotax'); + } + + foreach ($product_props as $prop) { + $product->$prop = $this->getFieldValue($product, $prop); + } + + $product->name['class'] = 'updateCurrentText'; + if (!$product->id || Configuration::get('PS_FORCE_FRIENDLY_PRODUCT')) { + $product->name['class'] .= ' copy2friendlyUrl'; + } + + $images = Image::getImages($this->context->language->id, $product->id); + + if (is_array($images)) { + foreach ($images as $k => $image) { + $images[$k]['src'] = $this->context->link->getImageLink($product->link_rewrite[$this->context->language->id], $product->id.'-'.$image['id_image'], ImageType::getFormatedName('small')); + } + $data->assign('images', $images); + } + $data->assign('imagesTypes', ImageType::getImagesTypes('products')); + + $product->tags = Tag::getProductTags($product->id); + + $data->assign('product_type', (int)Tools::getValue('type_product', $product->getType())); + $data->assign('is_in_pack', (int)Pack::isPacked($product->id)); + + $check_product_association_ajax = false; + if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL) { + $check_product_association_ajax = true; + } + + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $selectedElements = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id); + $tree = new HelperTreeHotels('associated-hotels-tree', 'Associated hotels'); + $tree->setTemplate('tree_associated_hotels.tpl') + ->setHeaderTemplate('tree_associated_header.tpl') + ->setRootCategory((int)Configuration::get('PS_LOCATIONS_CATEGORY')) + ->setUseCheckBox(true) + ->setFullTree(true) + ->setRoomsOnly(false) + ->setSelectedHotels($selectedElements['hotels']) + ->setSelectedRoomTypes($selectedElements['room_types']) + ->setUseBulkActions(false) + ->setAccessedHotels(HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 0)); + + $data->assign('hotel_tree', $tree->render()); + + // TinyMCE + $iso_tiny_mce = $this->context->language->iso_code; + $iso_tiny_mce = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso_tiny_mce.'.js') ? $iso_tiny_mce : 'en'); + $data->assign(array( + 'ad' => dirname($_SERVER['PHP_SELF']), + 'iso_tiny_mce' => $iso_tiny_mce, + 'check_product_association_ajax' => $check_product_association_ajax, + 'id_lang' => $this->context->language->id, + 'product' => $product, + 'token' => $this->token, + 'currency' => $currency, + 'link' => $this->context->link, + 'PS_PRODUCT_SHORT_DESC_LIMIT' => Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') ? Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') : 400 + )); + $data->assign($this->tpl_form_vars); + + $objRoomType = new HotelRoomType(); + $objHotelInfo = new HotelBranchInformation(); + $data->assign('htl_info', $objHotelInfo->hotelsNameAndId()); + if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($product->id)) { + $data->assign('htl_room_type', $hotelRoomType); + $hotelFullInfo = $objHotelInfo->hotelBranchInfoById($hotelRoomType['id_hotel']); + $data->assign('htl_full_info', $hotelFullInfo); + } + + $this->tpl_form_vars['product'] = $product; + $this->tpl_form_vars['custom_form'] = $data->fetch(); + } + + protected function getCarrierList() + { + $carrier_list = Carrier::getCarriers($this->context->language->id, false, false, false, null, Carrier::ALL_CARRIERS); + + if ($product = $this->loadObject(true)) { + /** @var Product $product */ + $carrier_selected_list = $product->getCarriers(); + foreach ($carrier_list as &$carrier) { + foreach ($carrier_selected_list as $carrier_selected) { + if ($carrier_selected['id_reference'] == $carrier['id_reference']) { + $carrier['selected'] = true; + continue; + } + } + } + } + return $carrier_list; + } + + protected function addCarriers($product = null) + { + if (!isset($product)) { + $product = new Product((int)Tools::getValue('id_product')); + } + + if (Validate::isLoadedObject($product)) { + $carriers = array(); + + if (Tools::getValue('selectedCarriers')) { + $carriers = Tools::getValue('selectedCarriers'); + } + + $product->setCarriers($carriers); + } + } + + public function ajaxProcessaddProductImage() + { + self::$currentIndex = 'index.php?tab=AdminNormalProducts'; + $product = new Product((int)Tools::getValue('id_product')); + $legends = Tools::getValue('legend'); + + if (!is_array($legends)) { + $legends = (array)$legends; + } + + if (!Validate::isLoadedObject($product)) { + $files = array(); + $files[0]['error'] = Tools::displayError('Cannot add image because room type creation failed.'); + } + + $image_uploader = new HelperImageUploader('file'); + $image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size); + $files = $image_uploader->process(); + + foreach ($files as &$file) { + $image = new Image(); + $image->id_product = (int)($product->id); + $image->position = Image::getHighestPosition($product->id) + 1; + + foreach ($legends as $key => $legend) { + if (!empty($legend)) { + $image->legend[(int)$key] = $legend; + } + } + + if (!Image::getCover($image->id_product)) { + $image->cover = 1; + } else { + $image->cover = 0; + } + + if (($validate = $image->validateFieldsLang(false, true)) !== true) { + $file['error'] = Tools::displayError($validate); + } + + if (isset($file['error']) && (!is_numeric($file['error']) || $file['error'] != 0)) { + continue; + } + + if (!$image->add()) { + $file['error'] = Tools::displayError('Error while creating additional image'); + } else { + if (!$new_path = $image->getPathForCreation()) { + $file['error'] = Tools::displayError('An error occurred during new folder creation'); + continue; + } + + $error = 0; + + if (!ImageManager::resize($file['save_path'], $new_path.'.'.$image->image_format, null, null, 'jpg', false, $error)) { + switch ($error) { + case ImageManager::ERROR_FILE_NOT_EXIST : + $file['error'] = Tools::displayError('An error occurred while copying image, the file does not exist anymore.'); + break; + + case ImageManager::ERROR_FILE_WIDTH : + $file['error'] = Tools::displayError('An error occurred while copying image, the file width is 0px.'); + break; + + case ImageManager::ERROR_MEMORY_LIMIT : + $file['error'] = Tools::displayError('An error occurred while copying image, check your memory limit.'); + break; + + default: + $file['error'] = Tools::displayError('An error occurred while copying image.'); + break; + } + continue; + } else { + $imagesTypes = ImageType::getImagesTypes('products'); + $generate_hight_dpi_images = (bool)Configuration::get('PS_HIGHT_DPI'); + + foreach ($imagesTypes as $imageType) { + if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format)) { + $file['error'] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']); + continue; + } + + if ($generate_hight_dpi_images) { + if (!ImageManager::resize($file['save_path'], $new_path.'-'.stripslashes($imageType['name']).'2x.'.$image->image_format, (int)$imageType['width']*2, (int)$imageType['height']*2, $image->image_format)) { + $file['error'] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']); + continue; + } + } + } + } + + unlink($file['save_path']); + //Necesary to prevent hacking + unset($file['save_path']); + Hook::exec('actionWatermark', array('id_image' => $image->id, 'id_product' => $product->id)); + + if (!$image->update()) { + $file['error'] = Tools::displayError('Error while updating status'); + continue; + } + + // Associate image to shop from context + $shops = Shop::getContextListShopID(); + $image->associateTo($shops); + $json_shops = array(); + + foreach ($shops as $id_shop) { + $json_shops[$id_shop] = true; + } + + $file['status'] = 'ok'; + $file['id'] = $image->id; + $file['position'] = $image->position; + $file['cover'] = $image->cover; + $file['legend'] = $image->legend; + $file['path'] = $image->getExistingImgPath(); + $file['shops'] = $json_shops; + + @unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$product->id.'.jpg'); + @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$product->id.'_'.$this->context->shop->id.'.jpg'); + } + } + + die(json_encode(array($image_uploader->getName() => $files))); + } + + /** + * @param Product $obj + * @throws Exception + * @throws SmartyException + */ + public function initFormImages($obj) + { + $data = $this->createTemplate($this->tpl_form); + + if ((bool)$obj->id) { + if ($this->product_exists_in_shop) { + $data->assign('product', $this->loadObject()); + + $shops = false; + if (Shop::isFeatureActive()) { + $shops = Shop::getShops(); + } + + if ($shops) { + foreach ($shops as $key => $shop) { + if (!$obj->isAssociatedToShop($shop['id_shop'])) { + unset($shops[$key]); + } + } + } + + $data->assign('shops', $shops); + + $count_images = Db::getInstance()->getValue(' + SELECT COUNT(id_product) + FROM '._DB_PREFIX_.'image + WHERE id_product = '.(int)$obj->id + ); + + $images = Image::getImages($this->context->language->id, $obj->id); + foreach ($images as $k => $image) { + $images[$k] = new Image($image['id_image']); + } + + if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP) { + $current_shop_id = (int)$this->context->shop->id; + } else { + $current_shop_id = 0; + } + + $languages = Language::getLanguages(true); + $image_uploader = new HelperImageUploader('file'); + $image_uploader->setMultiple(!(Tools::getUserBrowser() == 'Apple Safari' && Tools::getUserPlatform() == 'Windows')) + ->setUseAjax(true)->setUrl( + Context::getContext()->link->getAdminLink('AdminNormalProducts').'&ajax=1&id_product='.(int)$obj->id + .'&action=addProductImage'); + + $data->assign(array( + 'countImages' => $count_images, + 'id_product' => (int)Tools::getValue('id_product'), + 'id_category_default' => (int)$this->_category->id, + 'images' => $images, + 'iso_lang' => $languages[0]['iso_code'], + 'token' => $this->token, + 'table' => $this->table, + 'max_image_size' => $this->max_image_size / 1024 / 1024, + 'up_filename' => (string)Tools::getValue('virtual_product_filename_attribute'), + 'currency' => $this->context->currency, + 'current_shop_id' => $current_shop_id, + 'languages' => $this->_languages, + 'default_language' => (int)Configuration::get('PS_LANG_DEFAULT'), + 'image_uploader' => $image_uploader->render() + )); + + $type = ImageType::getByNameNType('%', 'products', 'height'); + if (isset($type['name'])) { + $data->assign('imageType', $type['name']); + } else { + $data->assign('imageType', ImageType::getFormatedName('small')); + } + } else { + $this->displayWarning($this->l('You must save the room type in this shop before adding images.')); + } + } else { + $this->displayWarning($this->l('You must save this room type before adding images.')); + } + + $this->tpl_form_vars['custom_form'] = $data->fetch(); + } + + /** + * @param Product $obj + * @throws Exception + * @throws SmartyException + */ + // public function initFormFeatures($obj) + // { + // if (!$this->default_form_language) { + // $this->getLanguages(); + // } + + // $data = $this->createTemplate($this->tpl_form); + // $data->assign('default_form_language', $this->default_form_language); + // $data->assign('languages', $this->_languages); + + // if (!Feature::isFeatureActive()) { + // $this->displayWarning($this->l('This feature has been disabled. ').' '.$this->l('Performances').''); + // } else { + // if ($obj->id) { + // if ($this->product_exists_in_shop) { + // $features = Feature::getFeatures($this->context->language->id, (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)); + + // foreach ($features as $k => $tab_features) { + // $features[$k]['current_item'] = false; + // $features[$k]['val'] = array(); + + // $custom = true; + // foreach ($obj->getFeatures() as $tab_products) { + // if ($tab_products['id_feature'] == $tab_features['id_feature']) { + // $features[$k]['current_item'] = $tab_products['id_feature_value']; + // } + // } + + // $features[$k]['featureValues'] = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int)$tab_features['id_feature']); + // if (count($features[$k]['featureValues'])) { + // foreach ($features[$k]['featureValues'] as $value) { + // if ($features[$k]['current_item'] == $value['id_feature_value']) { + // $custom = false; + // } + // } + // } + + // if ($custom) { + // $feature_values_lang = FeatureValue::getFeatureValueLang($features[$k]['current_item']); + // foreach ($feature_values_lang as $feature_value) { + // $features[$k]['val'][$feature_value['id_lang']] = $feature_value; + // } + // } + // } + + // $data->assign('available_features', $features); + // $data->assign('product', $obj); + // $data->assign('link', $this->context->link); + // $data->assign('default_form_language', $this->default_form_language); + // } else { + // $this->displayWarning($this->l('You must save the room type in this shop before adding features.')); + // } + // } else { + // $this->displayWarning($this->l('You must save this room type before adding features.')); + // } + // } + // $this->tpl_form_vars['custom_form'] = $data->fetch(); + // } + + public function ajaxProcessProductQuantity() + { + if ($this->tabAccess['edit'] === '0') { + return die(json_encode(array('error' => $this->l('You do not have the right permission')))); + } + if (!Tools::getValue('actionQty')) { + return json_encode(array('error' => $this->l('Undefined action'))); + } + + $product = new Product((int)Tools::getValue('id_product'), true); + switch (Tools::getValue('actionQty')) { + case 'depends_on_stock': + if (Tools::getValue('value') === false) { + die(json_encode(array('error' => $this->l('Undefined value')))); + } + if ((int)Tools::getValue('value') != 0 && (int)Tools::getValue('value') != 1) { + die(json_encode(array('error' => $this->l('Incorrect value')))); + } + if (!$product->advanced_stock_management && (int)Tools::getValue('value') == 1) { + die(json_encode(array('error' => $this->l('Not possible if advanced stock management is disabled. ')))); + } + if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)Tools::getValue('value') == 1 && (Pack::isPack($product->id) && !Pack::allUsesAdvancedStockManagement($product->id) + && ($product->pack_stock_type == 2 || $product->pack_stock_type == 1 || + ($product->pack_stock_type == 3 && (Configuration::get('PS_PACK_STOCK_TYPE') == 1 || Configuration::get('PS_PACK_STOCK_TYPE') == 2))))) { + die(json_encode(array('error' => $this->l('You cannot use advanced stock management for this pack because').'
    '. + $this->l('- advanced stock management is not enabled for these room types').'
    '. + $this->l('- you have chosen to decrement room types quantities.')))); + } + + StockAvailable::setProductDependsOnStock($product->id, (int)Tools::getValue('value')); + break; + + case 'pack_stock_type': + $value = Tools::getValue('value'); + if ($value === false) { + die(json_encode(array('error' => $this->l('Undefined value')))); + } + if ((int)$value != 0 && (int)$value != 1 + && (int)$value != 2 && (int)$value != 3) { + die(json_encode(array('error' => $this->l('Incorrect value')))); + } + if ($product->depends_on_stock && !Pack::allUsesAdvancedStockManagement($product->id) && ((int)$value == 1 + || (int)$value == 2 || ((int)$value == 3 && (Configuration::get('PS_PACK_STOCK_TYPE') == 1 || Configuration::get('PS_PACK_STOCK_TYPE') == 2)))) { + die(json_encode(array('error' => $this->l('You cannot use this stock management option because:').'
    '. + $this->l('- advanced stock management is not enabled for these room types').'
    '. + $this->l('- advanced stock management is enabled for the pack')))); + } + + Product::setPackStockType($product->id, $value); + break; + + case 'out_of_stock': + if (Tools::getValue('value') === false) { + die(json_encode(array('error' => $this->l('Undefined value')))); + } + if (!in_array((int)Tools::getValue('value'), array(0, 1, 2))) { + die(json_encode(array('error' => $this->l('Incorrect value')))); + } + + StockAvailable::setProductOutOfStock($product->id, (int)Tools::getValue('value')); + break; + + case 'set_qty': + if (Tools::getValue('value') === false || (!is_numeric(trim(Tools::getValue('value'))))) { + die(json_encode(array('error' => $this->l('Undefined value')))); + } + if (Tools::getValue('id_product_attribute') === false) { + die(json_encode(array('error' => $this->l('Undefined id room type attribute')))); + } + + StockAvailable::setQuantity($product->id, (int)Tools::getValue('id_product_attribute'), (int)Tools::getValue('value')); + Hook::exec('actionProductUpdate', array('id_product' => (int)$product->id, 'product' => $product)); + + // Catch potential echo from modules + $error = ob_get_contents(); + if (!empty($error)) { + ob_end_clean(); + die(json_encode(array('error' => $error))); + } + break; + case 'advanced_stock_management' : + if (Tools::getValue('value') === false) { + die(json_encode(array('error' => $this->l('Undefined value')))); + } + if ((int)Tools::getValue('value') != 1 && (int)Tools::getValue('value') != 0) { + die(json_encode(array('error' => $this->l('Incorrect value')))); + } + if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)Tools::getValue('value') == 1) { + die(json_encode(array('error' => $this->l('Not possible if advanced stock management is disabled. ')))); + } + + $product->setAdvancedStockManagement((int)Tools::getValue('value')); + if (StockAvailable::dependsOnStock($product->id) == 1 && (int)Tools::getValue('value') == 0) { + StockAvailable::setProductDependsOnStock($product->id, 0); + } + break; + + } + die(json_encode(array('error' => false))); + } + + public function getCombinationImagesJS() + { + /** @var Product $obj */ + if (!($obj = $this->loadObject(true))) { + return; + } + + $content = 'var combination_images = new Array();'; + if (!$allCombinationImages = $obj->getCombinationImages($this->context->language->id)) { + return $content; + } + foreach ($allCombinationImages as $id_product_attribute => $combination_images) { + $i = 0; + $content .= 'combination_images['.(int)$id_product_attribute.'] = new Array();'; + foreach ($combination_images as $combination_image) { + $content .= 'combination_images['.(int)$id_product_attribute.']['.$i++.'] = '.(int)$combination_image['id_image'].';'; + } + } + return $content; + } + + public function haveThisAccessory($accessory_id, $accessories) + { + foreach ($accessories as $accessory) { + if ((int)$accessory['id_product'] == (int)$accessory_id) { + return true; + } + } + return false; + } + + /** + * AdminProducts display hook + * + * @param $obj + * + * @throws PrestaShopException + */ + public function initFormModules($obj) + { + $id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($this->tab_display_module).'\''); + $this->tpl_form_vars['custom_form'] = Hook::exec('displayAdminNormalProductsExtra', array(), (int)$id_module); + } + + public function getL($key) + { + $trad = array( + 'Default category:' => $this->l('Default category'), + 'Catalog:' => $this->l('Catalog'), + 'Consider changing the default category.' => $this->l('Consider changing the default category.'), + 'ID' => $this->l('ID'), + 'Name' => $this->l('Name'), + 'Mark all checkbox(es) of categories in which product is to appear' => $this->l('Mark the checkbox of each categories in which this product will appear.') + ); + return $trad[$key]; + } + + protected function _displayUnavailableProductWarning() + { + $content = '
    + '.$this->l('Your product will be saved as a draft.').' + '.$this->l('Save').' + +
    '; + $this->tpl_form_vars['warning_unavailable_product'] = $content; + } + + public function ajaxProcessCheckProductName() + { + if ($this->tabAccess['view'] === '1') { + $search = Tools::getValue('q'); + $id_lang = Tools::getValue('id_lang'); + $limit = Tools::getValue('limit'); + if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP) { + $result = false; + } else { + $result = Db::getInstance()->executeS(' + SELECT DISTINCT pl.`name`, p.`id_product`, pl.`id_shop` + FROM `'._DB_PREFIX_.'product` p + LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop ='.(int)Context::getContext()->shop->id.') + LEFT JOIN `'._DB_PREFIX_.'product_lang` pl + ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$id_lang.') + WHERE pl.`name` LIKE "%'.pSQL($search).'%" AND ps.id_product IS NULL + GROUP BY pl.`id_product` + LIMIT '.(int)$limit); + } + die(json_encode($result)); + } + } + + public function ajaxProcessUpdatePositions() + { + if ($this->tabAccess['edit'] === '1') { + $way = (int)(Tools::getValue('way')); + $id_product = (int)Tools::getValue('id_product'); + $id_category = (int)Tools::getValue('id_category'); + $positions = Tools::getValue('product'); + $page = (int)Tools::getValue('page'); + $selected_pagination = (int)Tools::getValue('selected_pagination'); + + if (is_array($positions)) { + foreach ($positions as $position => $value) { + $pos = explode('_', $value); + + if ((isset($pos[1]) && isset($pos[2])) && ($pos[1] == $id_category && (int)$pos[2] === $id_product)) { + if ($page > 1) { + $position = $position + (($page - 1) * $selected_pagination); + } + + if ($product = new Product((int)$pos[2])) { + if (isset($position) && $product->updatePosition($way, $position)) { + $category = new Category((int)$id_category); + if (Validate::isLoadedObject($category)) { + hook::Exec('categoryUpdate', array('category' => $category)); + } + echo 'ok position '.(int)$position.' for product '.(int)$pos[2]."\r\n"; + } else { + echo '{"hasError" : true, "errors" : "Can not update product '.(int)$id_product.' to position '.(int)$position.' "}'; + } + } else { + echo '{"hasError" : true, "errors" : "This room type ('.(int)$id_product.') can t be loaded"}'; + } + + break; + } + } + } + } + } + + public function ajaxProcessPublishProduct() + { + if ($this->tabAccess['edit'] === '1') { + if ($id_product = (int)Tools::getValue('id_product')) { + $bo_product_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminNormalProducts&id_product='.$id_product.'&updateproduct&token='.$this->token; + + if (Tools::getValue('redirect')) { + die($bo_product_url); + } + + $product = new Product((int)$id_product); + if (!Validate::isLoadedObject($product)) { + die('error: invalid id'); + } + + $product->active = 1; + + if ($product->save()) { + die($bo_product_url); + } else { + die('error: saving'); + } + } + } + } + + public function ajaxProcessGetIdHotelByIdProduct() + { + $response = array('status' => 'failed'); + $idProduct = Tools::getValue('id_product'); + $objHotelRoomType = new HotelRoomType(); + $roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($idProduct); + if ($roomTypeInfo) { + $response['status'] = 'success'; + $response['id_hotel'] = (int)$roomTypeInfo['id_hotel']; + } + die(json_encode($response)); + } + + public function processImageLegends() + { + if (Tools::getValue('key_tab') == 'Images' && Tools::getValue('submitAddproductAndStay') == 'update_legends' && Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { + $id_image = (int)Tools::getValue('id_caption'); + $language_ids = Language::getIDs(false); + foreach ($_POST as $key => $val) { + if (preg_match('/^legend_([0-9]+)/i', $key, $match)) { + foreach ($language_ids as $id_lang) { + if ($val && $id_lang == $match[1]) { + Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image_lang SET legend = "'.pSQL($val).'" WHERE '.($id_image ? 'id_image = '.(int)$id_image : 'EXISTS (SELECT 1 FROM '._DB_PREFIX_.'image WHERE '._DB_PREFIX_.'image.id_image = '._DB_PREFIX_.'image_lang.id_image AND id_product = '.(int)$product->id.')').' AND id_lang = '.(int)$id_lang); + } + } + } + } + } + } + + public function displayPreviewLink($token = null, $id, $name = null) + { + $tpl = $this->createTemplate('helpers/list/list_action_preview.tpl'); + if (!array_key_exists('Bad SQL query', self::$cache_lang)) { + self::$cache_lang['Preview'] = $this->l('Preview', 'Helper'); + } + + $tpl->assign(array( + 'href' => $this->getPreviewUrl(new Product((int)$id)), + 'action' => self::$cache_lang['Preview'], + )); + + return $tpl->fetch(); + } +} diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index 5d75b728f..21b31f6a7 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -72,7 +72,7 @@ class AdminOrderPreferencesControllerCore extends AdminController ), 'GLOBAL_PREPARATION_TIME' => array( 'title' => $this->l('Preparation time'), - 'hint' => $this->l('Number of days required to prepare a room for stay.'), + 'hint' => $this->l('Number of days required to prepare a room for a guest\'s stay. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'), 'desc' => $this->l('Set to 0 to disable this feature.'), 'type' => 'text', 'class' => 'fixed-width-xl', @@ -151,7 +151,14 @@ class AdminOrderPreferencesControllerCore extends AdminController 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval' - ) + ), + 'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => array( + 'title' => $this->l('Show room price breakdown'), + 'hint' => $this->l('Show a summary for prices of the auto added service add with room on shopping cart list.'), + 'desc' => $this->l('This breakdown is always visible on room that have cart rule applied for that specific room.'), + 'cast' => 'intval', + 'type' => 'bool' + ), ), 'submit' => array('title' => $this->l('Save')) ), diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index e261e9ae3..5f2f2f568 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -43,6 +43,7 @@ class AdminOrdersControllerCore extends AdminController public $toolbar_title; protected $statuses_array = array(); + protected $all_order_sources = array(); public function __construct() { @@ -63,46 +64,108 @@ class AdminOrdersControllerCore extends AdminController CONCAT(c.`firstname`, \' \', c.`lastname`) AS `customer`, osl.`name` AS `osname`, os.`color`, IF((SELECT so.id_order FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new, - IF(a.valid, 1, 0) badge_success'; + IF(a.valid, 1, 0) badge_success, + hbil.`hotel_name`, + (SELECT COUNT(hbd.`id`) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as num_rooms, + (SELECT SUM(hbd.`adults`) + SUM(hbd.`children`) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as total_guests_count, + (SELECT CONCAT( + SUM(hbd.`adults`), + \' '.$this->l('Adult(s)').' \', + IF(SUM(hbd.`children`), CONCAT(SUM(hbd.`children`), \' '.$this->l('Children').'\'), \'\') + ) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as total_guests, + (SELECT SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as los'; $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`) - LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int) $this->context->language->id.')'; + LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int) $this->context->language->id.') + LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = a.`id_order`) + LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil ON (hbil.`id` = hbd.`id_hotel`)'; + $this->_orderBy = 'id_order'; $this->_orderWay = 'DESC'; $this->_use_found_rows = true; + $this->_group = ' GROUP BY hbd.`id_order`'; + $statuses = OrderState::getOrderStates((int)$this->context->language->id); foreach ($statuses as $status) { $this->statuses_array[$status['id_order_state']] = $status['name']; } + $all_order_sources = Db::getInstance()->executeS('SELECT DISTINCT(`source`) FROM `'._DB_PREFIX_.'orders`'); + foreach ($all_order_sources as $source) { + $this->all_order_sources[$source['source']] = $source['source']; + } $this->fields_list = array( 'id_order' => array( 'title' => $this->l('ID'), 'align' => 'text-center', - 'class' => 'fixed-width-xs' + 'class' => 'fixed-width-xs', ), 'reference' => array( 'title' => $this->l('Reference') ), - 'new' => array( - 'title' => $this->l('New client'), - 'align' => 'text-center', - 'type' => 'bool', - 'tmpTableFilter' => true, - 'orderby' => false, - 'callback' => 'printNewCustomer' - ), 'customer' => array( 'title' => $this->l('Customer'), 'havingFilter' => true, + 'optional' => true, + 'visible_default' => true ), 'order_source' => array( 'title' => $this->l('Order Source'), + 'type' => 'select', + 'filter_key' => 'a!source', + 'list' => $this->all_order_sources, + 'optional' => true, + 'visible_default' => true + ), + 'hotel_name' => array( + 'title' => $this->l('Hotel'), + 'filter_key' => 'hbil!hotel_name', + 'optional' => true, + 'visible_default' => true + ), + 'date_from' => array( + 'title' => $this->l('Check-in'), + 'filter_key' => 'hbd!date_from', + 'type'=>'date', + 'displayed' => false, + ), + 'date_to' => array( + 'title' => $this->l('Check-out'), + 'filter_key' => 'hbd!date_to', + 'type'=>'date', + 'displayed' => false, + ), + 'room_type_name' => array( + 'title' => $this->l('Room type'), + 'filter_key' => 'hbd!room_type_name', + 'type'=>'text', + 'displayed' => false, + ), + 'total_guests' => array( + 'title' => $this->l('Guests'), + 'type' => 'range', + 'filter_key' => 'total_guests_count', + 'optional' => true, 'havingFilter' => true, ), + 'num_rooms' => array( + 'title' => $this->l('No. of rooms'), + 'align' => 'text-center', + 'type' => 'range', + 'optional' => true, + 'havingFilter' => true, + 'visible_default' => true + ), + 'los' => array( + 'title' => $this->l('Stay period'), + 'align' => 'text-center', + 'type' => 'range', + 'havingFilter' => true, + 'optional' => true, + ), ); if (Configuration::get('PS_B2B_ENABLE')) { @@ -116,9 +179,9 @@ class AdminOrdersControllerCore extends AdminController $this->fields_list = array_merge($this->fields_list, array( 'total_paid_tax_incl' => array( - 'title' => $this->l('Total'), + 'title' => $this->l('Order Total'), 'align' => 'text-right', - 'type' => 'price', + 'type' => 'range', 'currency' => true, 'callback' => 'setOrderCurrency', 'badge_success' => true, @@ -126,11 +189,13 @@ class AdminOrdersControllerCore extends AdminController 'amount_due' => array( 'title' => $this->l('Due Amount'), 'align' => 'text-right', - 'type' => 'price', + 'type' => 'range', 'currency' => true, 'havingFilter' => true, 'callback' => 'setOrderCurrency', 'badge_success' => true, + 'optional' => true, + 'visible_default' => true ), 'payment' => array( 'title' => $this->l('Payment') @@ -142,13 +207,17 @@ class AdminOrdersControllerCore extends AdminController 'list' => $this->statuses_array, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', - 'order_key' => 'osname' + 'order_key' => 'osname', + 'optional' => true, + 'visible_default' => true ), 'date_add' => array( - 'title' => $this->l('Date'), + 'title' => $this->l('Order date'), 'align' => 'text-right', 'type' => 'datetime', - 'filter_key' => 'a!date_add' + 'filter_key' => 'a!date_add', + 'optional' => true, + 'visible_default' => true ), 'id_pdf' => array( 'title' => $this->l('PDF'), @@ -156,7 +225,8 @@ class AdminOrdersControllerCore extends AdminController 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false, - 'remove_onclick' => true + 'remove_onclick' => true, + 'optional' => true, ) )); @@ -218,6 +288,7 @@ class AdminOrdersControllerCore extends AdminController $this->context->currency = new Currency((int)$cart->id_currency); $cart_detail_data = array(); $cart_detail_data_obj = new HotelCartBookingData(); + $objHotelServiceProductCartDetail = new HotelServiceProductCartDetail(); if ($cart_detail_data = $cart_detail_data_obj->getCartFormatedBookinInfoByIdCart((int) $id_cart)) { $objRoomType = new HotelRoomType(); foreach ($cart_detail_data as $key => $cart_data) { @@ -225,7 +296,12 @@ class AdminOrdersControllerCore extends AdminController $cart_detail_data[$key]['room_type_info'] = $objRoomType->getRoomTypeInfoByIdProduct($cart_data['id_product']); } $this->context->smarty->assign('cart_detail_data', $cart_detail_data); - } else { + } + if ($normalCartProduct = $objHotelServiceProductCartDetail->getHotelProducts($this->context->cart->id)) { + $this->context->smarty->assign('cart_normal_data', $normalCartProduct); + } + + if (empty($cart_detail_data) && empty($normalCartProduct)) { // if no rooms added in the cart and user visits add order page then redirect to BOOK NOW page Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking')); } @@ -246,7 +322,7 @@ class AdminOrdersControllerCore extends AdminController } $occupancyRequiredForBooking = false; - if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) { + if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) { $occupancyRequiredForBooking = true; } @@ -264,6 +340,7 @@ class AdminOrdersControllerCore extends AdminController 'toolbar_scroll' => $this->toolbar_scroll, 'PS_CATALOG_MODE' => Configuration::get('PS_CATALOG_MODE'), 'title' => array($this->l('Orders'), $this->l('Create order')), + 'currency' => new Currency((int)$cart->id_currency), 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), 'occupancy_required_for_booking' => $occupancyRequiredForBooking, @@ -282,7 +359,12 @@ class AdminOrdersControllerCore extends AdminController Tools::redirectAdmin($this->context->link->getAdminLink('AdminOrders')); } - $this->toolbar_title[] = sprintf($this->l('Order %1$s from %2$s %3$s'), $order->reference, $customer->firstname, $customer->lastname); + if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { + $objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id); + $this->toolbar_title[] = sprintf($this->l('Order %1$s - %2$s'), $order->reference, $objHotelBranchInformation->hotel_name); + } else { + $this->toolbar_title[] = sprintf($this->l('Order %1$s'), $order->reference); + } $this->addMetaTitle($this->toolbar_title[count($this->toolbar_title) - 1]); if ($order->hasBeenShipped()) { @@ -327,6 +409,12 @@ class AdminOrdersControllerCore extends AdminController return $res; } + public function initModal() + { + parent::initModal(); + $this->modals[] = $this->getBookingDocumentsModal(); + } + public function setMedia() { parent::setMedia(); @@ -336,6 +424,8 @@ class AdminOrdersControllerCore extends AdminController if ($this->tabAccess['edit'] == 1 && $this->display == 'view') { $this->addJS(_PS_JS_DIR_.'admin/orders.js'); + // $this->addJS(_PS_JS_DIR_.'admin/orders-product-event.js'); + // $this->addJS(_PS_JS_DIR_.'admin/orders-room-event.js'); $this->addJS(_PS_JS_DIR_.'tools.js'); $this->addJqueryPlugin('autocomplete'); } @@ -1267,56 +1357,56 @@ class AdminOrdersControllerCore extends AdminController parent::postProcess(); } - public function renderKpis() - { - $time = time(); - $kpis = array(); + // public function renderKpis() + // { + // $time = time(); + // $kpis = array(); - $helper = new HelperKpi(); - $helper->id = 'box-conversion-rate'; - $helper->icon = 'icon-sort-by-attributes-alt'; - //$helper->chart = true; - $helper->color = 'color1'; - $helper->title = $this->l('Conversion Rate', null, null, false); - $helper->subtitle = $this->l('30 days', null, null, false); - if (ConfigurationKPI::get('CONVERSION_RATE_CHART') !== false) { - $helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART'); - } - $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=conversion_rate'; - $kpis[] = $helper->generate(); + // $helper = new HelperKpi(); + // $helper->id = 'box-conversion-rate'; + // $helper->icon = 'icon-sort-by-attributes-alt'; + // //$helper->chart = true; + // $helper->color = 'color1'; + // $helper->title = $this->l('Conversion Rate', null, null, false); + // $helper->subtitle = $this->l('30 days', null, null, false); + // if (ConfigurationKPI::get('CONVERSION_RATE_CHART') !== false) { + // $helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART'); + // } + // $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=conversion_rate'; + // $kpis[] = $helper->generate(); - $helper = new HelperKpi(); - $helper->id = 'box-carts'; - $helper->icon = 'icon-shopping-cart'; - $helper->color = 'color2'; - $helper->title = $this->l('Abandoned Carts', null, null, false); - $helper->subtitle = $this->l('Today', null, null, false); - $helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts'; - $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart'; - $kpis[] = $helper->generate(); + // $helper = new HelperKpi(); + // $helper->id = 'box-carts'; + // $helper->icon = 'icon-shopping-cart'; + // $helper->color = 'color2'; + // $helper->title = $this->l('Abandoned Carts', null, null, false); + // $helper->subtitle = $this->l('Today', null, null, false); + // $helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts'; + // $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart'; + // $kpis[] = $helper->generate(); - $helper = new HelperKpi(); - $helper->id = 'box-average-order'; - $helper->icon = 'icon-money'; - $helper->color = 'color3'; - $helper->title = $this->l('Average Order Value', null, null, false); - $helper->subtitle = $this->l('30 days', null, null, false); - $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=average_order_value'; - $kpis[] = $helper->generate(); + // $helper = new HelperKpi(); + // $helper->id = 'box-average-order'; + // $helper->icon = 'icon-money'; + // $helper->color = 'color3'; + // $helper->title = $this->l('Average Order Value', null, null, false); + // $helper->subtitle = $this->l('30 days', null, null, false); + // $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=average_order_value'; + // $kpis[] = $helper->generate(); - $helper = new HelperKpi(); - $helper->id = 'box-net-profit-visit'; - $helper->icon = 'icon-user'; - $helper->color = 'color4'; - $helper->title = $this->l('Net Profit per Visit', null, null, false); - $helper->subtitle = $this->l('30 days', null, null, false); - $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=netprofit_visit'; - $kpis[] = $helper->generate(); + // $helper = new HelperKpi(); + // $helper->id = 'box-net-profit-visit'; + // $helper->icon = 'icon-user'; + // $helper->color = 'color4'; + // $helper->title = $this->l('Net Profit per Visit', null, null, false); + // $helper->subtitle = $this->l('30 days', null, null, false); + // $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=netprofit_visit'; + // $kpis[] = $helper->generate(); - $helper = new HelperKpiRow(); - $helper->kpis = $kpis; - return $helper->generate(); - } + // $helper = new HelperKpiRow(); + // $helper->kpis = $kpis; + // return $helper->generate(); + // } public function renderView() { @@ -1402,6 +1492,7 @@ class AdminOrdersControllerCore extends AdminController $display_out_of_stock_warning = true; } + $orderServiceProducts = array(); // products current stock (from stock_available) foreach ($products as &$product) { // Get total customized quantity for current product @@ -1440,6 +1531,11 @@ class AdminOrdersControllerCore extends AdminController $product['warehouse_name'] = '--'; $product['warehouse_location'] = false; } + + // add service products in order detail + if ($product['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) { + $orderServiceProducts[] = $product; + } } $gender = new Gender((int)$customer->id_gender, $this->context->language->id); @@ -1465,15 +1561,21 @@ class AdminOrdersControllerCore extends AdminController $order_detail_data = array(); $cart_detail_data_obj = new HotelCartBookingData(); $objBookingDetail = new HotelBookingDetail(); + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); $total_room_tax = 0; $totalRoomsCostTE = 0; + $totalConvenienceFeeTE = 0; + $totalConvenienceFeeTI = 0; $totalDemandsPriceTE = 0; $totalDemandsPriceTI = 0; if ($order_detail_data = $objBookingDetail->getOrderFormatedBookinInfoByIdOrder($order->id)) { $objBookingDemand = new HotelBookingDemands(); $objHotelRoomType = new HotelRoomType(); foreach ($order_detail_data as $key => $value) { + $order_detail_data[$key]['total_room_price_te'] = $value['total_price_tax_excl']; + $order_detail_data[$key]['total_room_price_ti'] = $value['total_price_tax_incl']; + $order_detail_data[$key]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( $order->id, $value['id_product'], @@ -1481,7 +1583,7 @@ class AdminOrdersControllerCore extends AdminController $value['date_from'], $value['date_to'] ); - $order_detail_data[$key]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands( + $order_detail_data[$key]['total_room_price_ti'] += $order_detail_data[$key]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands( $order->id, $value['id_product'], $value['id_room'], @@ -1492,7 +1594,7 @@ class AdminOrdersControllerCore extends AdminController 1 ); $totalDemandsPriceTI += $order_detail_data[$key]['extra_demands_price_ti']; - $order_detail_data[$key]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands( + $order_detail_data[$key]['total_room_price_te'] += $order_detail_data[$key]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands( $order->id, $value['id_product'], $value['id_room'], @@ -1503,6 +1605,90 @@ class AdminOrdersControllerCore extends AdminController 0 ); $totalDemandsPriceTE += $order_detail_data[$key]['extra_demands_price_te']; + + $order_detail_data[$key]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $order->id, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id_room'] + ); + $order_detail_data[$key]['total_room_price_ti'] += $order_detail_data[$key]['additional_services_price_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $order->id, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id_room'], + 1, + 1 + ); + $order_detail_data[$key]['total_room_price_te'] += $order_detail_data[$key]['additional_services_price_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $order->id, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id_room'], + 1, + 0 + ); + $order_detail_data[$key]['total_room_price_ti'] += $totalConvenienceFeeTI += $order_detail_data[$key]['convenience_fee_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $order->id, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id_room'], + 1, + 1, + 1, + Product::PRICE_ADDITION_TYPE_INDEPENDENT + ); + $order_detail_data[$key]['total_room_price_te'] += $totalConvenienceFeeTE += $order_detail_data[$key]['convenience_fee_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $order->id, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id_room'], + 1, + 0, + 1, + Product::PRICE_ADDITION_TYPE_INDEPENDENT + ); + $order_detail_data[$key]['total_room_price_ti'] += $order_detail_data[$key]['additional_services_price_auto_add_ti'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $order->id, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id_room'], + 1, + 1, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); + $order_detail_data[$key]['total_room_price_te'] += $order_detail_data[$key]['additional_services_price_auto_add_te'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $order->id, + 0, + 0, + $value['id_product'], + $value['date_from'], + $value['date_to'], + $value['id_room'], + 1, + 0, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); $cust_obj = new Customer($value['id_customer']); if ($cust_obj->firstname) { $order_detail_data[$key]['alloted_cust_name'] = $cust_obj->firstname.' '.$cust_obj->lastname; @@ -1527,7 +1713,7 @@ class AdminOrdersControllerCore extends AdminController $order_detail_data[$key]['amt_with_qty_tax_excl'] = $value['total_price_tax_excl']; $order_detail_data[$key]['amt_with_qty_tax_incl'] = $value['total_price_tax_incl']; $order_detail_data[$key]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value['id_product']); - + $order_detail_data[$key]['total_room_tax'] = $order_detail_data[$key]['total_room_price_ti'] - $order_detail_data[$key]['total_room_price_te']; } } @@ -1537,22 +1723,29 @@ class AdminOrdersControllerCore extends AdminController $refundedAmount = $objOrderReturn->getRefundedAmount($order->id); } - // get booking information by order $bookingOrderInfo = $objBookingDetail->getBookingDataByOrderId($order->id); + foreach ($bookingOrderInfo as &$bookingOrderRoomInfo) { + $bookingOrderRoomInfo['num_checkin_documents'] = HotelBookingDocument::getCountByIdHtlBooking($bookingOrderRoomInfo['id']); + } // hotel booking statuses $htlOrderStatus = HotelBookingDetail::getAllHotelOrderStatus(); + + // applicable refund policies + $applicableRefundPolicies = HotelOrderRefundRules::getApplicableRefundRules($order->id); $this->tpl_view_vars = array( // refund info 'refund_allowed' => (int) $order->isReturnable(), + 'applicable_refund_policies' => $applicableRefundPolicies, 'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id), 'refundReqBookings' => $refundReqBookings, 'hasCompletelyRefunded' => $order->hasCompletelyRefunded(), 'refundedAmount' => $refundedAmount, - 'totalDemandsPriceTI' => $totalDemandsPriceTI, 'totalDemandsPriceTE' => $totalDemandsPriceTE, + 'totalConvenienceFeeTI' => $totalConvenienceFeeTI, + 'totalConvenienceFeeTE' => $totalConvenienceFeeTE, 'totalRoomsCostTE' => $totalRoomsCostTE, 'total_room_tax' => $total_room_tax, 'htl_booking_order_data' => $bookingOrderInfo, @@ -1560,6 +1753,7 @@ class AdminOrdersControllerCore extends AdminController 'order_detail_data' => $order_detail_data, 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), + 'order_service_products' => $orderServiceProducts, /*END*/ 'order' => $order, 'cart' => new Cart($order->id_cart), @@ -1637,6 +1831,115 @@ class AdminOrdersControllerCore extends AdminController return parent::renderView(); } + public function getBookingDocumentsModal() + { + $modalContent = $this->context->smarty->fetch('controllers/orders/_booking_documents_modal.tpl'); + + // set modal details + $modal = array( + 'modal_id' => 'booking-documents-modal', + 'modal_class' => 'modal-md', + 'modal_title' => $this->l('Documents'), + 'modal_content' => $modalContent, + 'modal_actions' => array(), // required to show Close button + ); + + return $modal; + } + + public function ajaxProcessGetBookingDocuments() + { + $response = array('status' => false); + + $idHtlBooking = (int) Tools::getValue('id_htl_booking'); + $objHotelBookingDetail = new HotelBookingDetail($idHtlBooking); + if (Validate::isLoadedObject($objHotelBookingDetail)) { + $response['html'] = $this->getRenderedBookingDocuments($idHtlBooking); + $response['status'] = true; + } + + $this->ajaxDie(json_encode($response)); + } + + public function ajaxProcessUploadBookingDocument() + { + $response = array('status' => false); + + $idHtlBooking = (int) Tools::getValue('id_htl_booking'); + $title = Tools::getValue('title'); + + // validations + $objHotelBookingDetail = new HotelBookingDetail($idHtlBooking); + if (!Validate::isLoadedObject($objHotelBookingDetail)) { + $this->errors[] = $this->l('Booking detail not found.'); + } + + if (!$title) { + $title = '--'; + } else { + if (!Validate::isCatalogName($title)) { + $this->errors[] = $this->l('Please enter a valid Title.'); + } + } + + $objHotelBookingDocument = new HotelBookingDocument(); + $objHotelBookingDocument->setFileInfoForUploadedDocument('booking_document'); + if (!count($objHotelBookingDocument->fileInfo)) { + $this->errors[] = $this->l('Please select a file to upload.'); + } elseif ($objHotelBookingDocument->fileInfo['size'] > Tools::getMaxUploadSize()) { + $this->errors[] = $this->l('Uploaded file size is too large.'); + } elseif(!(ImageManager::isRealImage($objHotelBookingDocument->fileInfo['tmp_name']) + || $objHotelBookingDocument->fileInfo['mime'] == 'application/pdf') + ) { + $this->errors[] = $this->l('Please upload an image or a PDF file only. Allowed image formats: .gif, .jpg, .jpeg and .png'); + } + + if (!count($this->errors)) { + $objHotelBookingDocument = new HotelBookingDocument(); + $objHotelBookingDocument->setFileInfoForUploadedDocument('booking_document'); + $objHotelBookingDocument->id_htl_booking = $idHtlBooking; + $objHotelBookingDocument->title = $title; + $objHotelBookingDocument->setFileType(); + if ($objHotelBookingDocument->save()) { + $objHotelBookingDocument->saveDocumentFile(); + + $response['html'] = $this->getRenderedBookingDocuments($idHtlBooking); + $response['num_checkin_documents'] = HotelBookingDocument::getCountByIdHtlBooking($idHtlBooking); + $response['status'] = true; + } else { + $this->errors[] = $this->l('Document upload failed.'); + } + } else { + $this->context->smarty->assign(array( + 'errors' => $this->errors, + )); + + $response['errors'] = $this->context->smarty->fetch('alerts.tpl'); + $response['status'] = false; + } + + $this->ajaxDie(json_encode($response)); + } + + public function ajaxProcessDeleteBookingDocument() + { + $response = array('status' => false); + + $idHtlBookingDocument = (int) Tools::getValue('id_htl_booking_document'); + + $objHotelBookingDocument = new HotelBookingDocument($idHtlBookingDocument); + if (Validate::isLoadedObject($objHotelBookingDocument)) { + $idHtlBooking = $objHotelBookingDocument->id_htl_booking; + if ($objHotelBookingDocument->delete()) { + $response['html'] = $this->getRenderedBookingDocuments($idHtlBooking); + $response['num_checkin_documents'] = HotelBookingDocument::getCountByIdHtlBooking($idHtlBooking); + $response['status'] = true; + } + } + + $this->ajaxDie(json_encode($response)); + } + public function ajaxProcessUpdateGuestDetails() { $response = array( @@ -1680,10 +1983,24 @@ class AdminOrdersControllerCore extends AdminController $this->ajaxDie(json_encode($response)); } + private function getRenderedBookingDocuments($idHtlBooking) + { + $bookingDocuments = HotelBookingDocument::getDocumentsByIdHtlBooking($idHtlBooking); + + $this->context->smarty->assign(array( + 'link' => $this->context->link, + 'booking_documents' => $bookingDocuments, + 'pdf_icon_link' => $this->context->link->getBaseLink().'modules/hotelreservationsystem/views/img/pdf-icon.jpg', + )); + + return $this->context->smarty->fetch('controllers/orders/_booking_document_line.tpl'); + } + public function ajaxProcessSearchProducts() { Context::getContext()->customer = new Customer((int)Tools::getValue('id_customer')); $currency = new Currency((int)Tools::getValue('id_currency')); + $bookingProduct = (bool)Tools::getValue('booking_product', true); $to_return = array('found' => false); if (Validate::isLoadedObject($order = new Order(Tools::getValue('id_order')))) { $objBookingDetail = new HotelBookingDetail(); @@ -1696,8 +2013,14 @@ class AdminOrdersControllerCore extends AdminController if ($products = Product::searchByName((int)$this->context->language->id, pSQL(Tools::getValue('product_search')), null, $idHotel)) { $objRoomType = new HotelRoomType(); - foreach ($products as &$product) { - // get product room type informatin + foreach ($products as $key => &$product) { + + if (((bool)$product['booking_product']) != $bookingProduct) { + unset($products[$key]); + continue; + } + + // get product room type informatin if ($roomTypeDetail = $objRoomType->getRoomTypeInfoByIdProduct($product['id_product'])) { $product['room_type_info'] = $roomTypeDetail; } @@ -1763,15 +2086,97 @@ class AdminOrdersControllerCore extends AdminController $product['customization_fields'] = $product_instance->getCustomizationFields($this->context->language->id); } } - $to_return = array( - 'products' => $products, - 'found' => true - ); + + if (!empty($products)) { + $to_return = array( + 'products' => $products, + 'found' => true + ); + } } } $this->content = json_encode($to_return); } + // public function ajaxProcessSearchProducts() + // { + // Context::getContext()->customer = new Customer((int)Tools::getValue('id_customer')); + // $currency = new Currency((int)Tools::getValue('id_currency')); + // if ($products = Product::searchByName((int)$this->context->language->id, pSQL(Tools::getValue('product_search')))) { + // foreach ($products as &$product) { + // // Formatted price + // $product['formatted_price'] = Tools::displayPrice(Tools::convertPrice($product['price_tax_incl'], $currency), $currency); + // // Concret price + // $product['price_tax_incl'] = Tools::ps_round(Tools::convertPrice($product['price_tax_incl'], $currency), 2); + // $product['price_tax_excl'] = Tools::ps_round(Tools::convertPrice($product['price_tax_excl'], $currency), 2); + // $productObj = new Product((int)$product['id_product'], false, (int)$this->context->language->id); + // $combinations = array(); + // $attributes = $productObj->getAttributesGroups((int)$this->context->language->id); + + // // Tax rate for this customer + // if (Tools::isSubmit('id_address')) { + // $product['tax_rate'] = $productObj->getTaxesRate(new Address(Tools::getValue('id_address'))); + // } + + // $product['warehouse_list'] = array(); + + // foreach ($attributes as $attribute) { + // if (!isset($combinations[$attribute['id_product_attribute']]['attributes'])) { + // $combinations[$attribute['id_product_attribute']]['attributes'] = ''; + // } + // $combinations[$attribute['id_product_attribute']]['attributes'] .= $attribute['attribute_name'].' - '; + // $combinations[$attribute['id_product_attribute']]['id_product_attribute'] = $attribute['id_product_attribute']; + // $combinations[$attribute['id_product_attribute']]['default_on'] = $attribute['default_on']; + // if (!isset($combinations[$attribute['id_product_attribute']]['price'])) { + // $price_tax_incl = Product::getPriceStatic((int)$product['id_product'], true, $attribute['id_product_attribute']); + // $price_tax_excl = Product::getPriceStatic((int)$product['id_product'], false, $attribute['id_product_attribute']); + // $combinations[$attribute['id_product_attribute']]['price_tax_incl'] = Tools::ps_round(Tools::convertPrice($price_tax_incl, $currency), 2); + // $combinations[$attribute['id_product_attribute']]['price_tax_excl'] = Tools::ps_round(Tools::convertPrice($price_tax_excl, $currency), 2); + // $combinations[$attribute['id_product_attribute']]['formatted_price'] = Tools::displayPrice(Tools::convertPrice($price_tax_excl, $currency), $currency); + // } + // if (!isset($combinations[$attribute['id_product_attribute']]['qty_in_stock'])) { + // $combinations[$attribute['id_product_attribute']]['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct((int)$product['id_product'], $attribute['id_product_attribute'], (int)$this->context->shop->id); + // } + + // if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)$product['advanced_stock_management'] == 1) { + // $product['warehouse_list'][$attribute['id_product_attribute']] = Warehouse::getProductWarehouseList($product['id_product'], $attribute['id_product_attribute']); + // } else { + // $product['warehouse_list'][$attribute['id_product_attribute']] = array(); + // } + + // $product['stock'][$attribute['id_product_attribute']] = Product::getRealQuantity($product['id_product'], $attribute['id_product_attribute']); + // } + + // if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)$product['advanced_stock_management'] == 1) { + // $product['warehouse_list'][0] = Warehouse::getProductWarehouseList($product['id_product']); + // } else { + // $product['warehouse_list'][0] = array(); + // } + + // $product['stock'][0] = StockAvailable::getQuantityAvailableByProduct((int)$product['id_product'], 0, (int)$this->context->shop->id); + + // foreach ($combinations as &$combination) { + // $combination['attributes'] = rtrim($combination['attributes'], ' - '); + // } + // $product['combinations'] = $combinations; + + // if ($product['customizable']) { + // $product_instance = new Product((int)$product['id_product']); + // $product['customization_fields'] = $product_instance->getCustomizationFields($this->context->language->id); + // } + // } + + // $to_return = array( + // 'products' => $products, + // 'found' => true + // ); + // } else { + // $to_return = array('found' => false); + // } + + // $this->content = json_encode($to_return); + // } + public function ajaxProcessSendMailValidateOrder() { if ($this->tabAccess['edit'] === '1') { @@ -1807,6 +2212,360 @@ class AdminOrdersControllerCore extends AdminController } } + public function ajaxProcessAddServiceProductOnOrder() + { + // Load object + $order = new Order((int)Tools::getValue('id_order')); + if (!Validate::isLoadedObject($order)) { + die(Tools::jsonEncode(array( + 'result' => false, + 'error' => Tools::displayError('The order object cannot be loaded.') + ))); + } + + $old_cart_rules = Context::getContext()->cart->getCartRules(); + + if ($order->hasBeenShipped()) { + die(Tools::jsonEncode(array( + 'result' => false, + 'error' => Tools::displayError('You cannot add products to delivered orders. ') + ))); + } + + $product_informations = $_POST['add_product']; + if (isset($_POST['add_invoice'])) { + $invoice_informations = $_POST['add_invoice']; + } else { + $invoice_informations = array(); + } + $product = new Product($product_informations['product_id'], false, $order->id_lang); + if (!Validate::isLoadedObject($product)) { + die(Tools::jsonEncode(array( + 'result' => false, + 'error' => Tools::displayError('The product object cannot be loaded.') + ))); + } + + if (isset($product_informations['product_attribute_id']) && $product_informations['product_attribute_id']) { + $combination = new Combination($product_informations['product_attribute_id']); + if (!Validate::isLoadedObject($combination)) { + die(Tools::jsonEncode(array( + 'result' => false, + 'error' => Tools::displayError('The combination object cannot be loaded.') + ))); + } + } + + if ($product->booking_product || Product::SERVICE_PRODUCT_WITH_ROOMTYPE == $product->service_product_type) { + die(Tools::jsonEncode(array( + 'result' => false, + 'error' => Tools::displayError('The product cannot be added through this method.') + ))); + } + + // Total method + $total_method = Cart::BOTH_WITHOUT_SHIPPING; + + // Create new cart + $cart = new Cart(); + $cart->id_shop_group = $order->id_shop_group; + $cart->id_shop = $order->id_shop; + $cart->id_customer = $order->id_customer; + $cart->id_carrier = $order->id_carrier; + $cart->id_address_delivery = $order->id_address_delivery; + $cart->id_address_invoice = $order->id_address_invoice; + $cart->id_currency = $order->id_currency; + $cart->id_lang = $order->id_lang; + $cart->secure_key = $order->secure_key; + + // Save new cart + $cart->add(); + + // Save context (in order to apply cart rule) + $this->context->cart = $cart; + $this->context->customer = new Customer($order->id_customer); + + // always add taxes even if there are not displayed to the customer + $use_taxes = true; + + $initial_product_price_tax_incl = Product::getPriceStatic( + $product->id, + $use_taxes, + isset($combination) ? $combination->id : null, + 2, + null, + false, + true, + 1, + false, + $order->id_customer, + $cart->id, + $order->id_address_tax + ); + + // Creating specific price if needed + if ($product_informations['product_price_tax_incl'] != $initial_product_price_tax_incl) { + $specific_price = new SpecificPrice(); + $specific_price->id_shop = 0; + $specific_price->id_shop_group = 0; + $specific_price->id_currency = 0; + $specific_price->id_country = 0; + $specific_price->id_group = 0; + $specific_price->id_customer = $order->id_customer; + $specific_price->id_product = $product->id; + if (isset($combination)) { + $specific_price->id_product_attribute = $combination->id; + } else { + $specific_price->id_product_attribute = 0; + } + $specific_price->price = $product_informations['product_price_tax_excl']; + $specific_price->from_quantity = 1; + $specific_price->reduction = 0; + $specific_price->reduction_type = 'amount'; + $specific_price->reduction_tax = 0; + $specific_price->from = '0000-00-00 00:00:00'; + $specific_price->to = '0000-00-00 00:00:00'; + $specific_price->add(); + } + + // Add product to cart + $update_quantity = $cart->updateQty($product_informations['product_quantity'], $product->id, isset($product_informations['product_attribute_id']) ? $product_informations['product_attribute_id'] : null, + isset($combination) ? $combination->id : null, 'up', 0, new Shop($cart->id_shop)); + + if ($update_quantity < 0) { + // If product has attribute, minimal quantity is set with minimal quantity of attribute + $minimal_quantity = ($product_informations['product_attribute_id']) ? Attribute::getAttributeMinimalQty($product_informations['product_attribute_id']) : $product->minimal_quantity; + die(Tools::jsonEncode(array('error' => sprintf(Tools::displayError('You must add %d minimum quantity', false), $minimal_quantity)))); + } elseif (!$update_quantity) { + die(Tools::jsonEncode(array('error' => Tools::displayError('You already have the maximum quantity available for this product.', false)))); + } + + // If order is valid, we can create a new invoice or edit an existing invoice + if ($order->hasInvoice()) { + $order_invoice = new OrderInvoice($product_informations['invoice']); + // Create new invoice + if ($order_invoice->id == 0) { + // If we create a new invoice, we calculate shipping cost + $total_method = Cart::BOTH; + // Create Cart rule in order to make free shipping + if (isset($invoice_informations['free_shipping']) && $invoice_informations['free_shipping']) { + $cart_rule = new CartRule(); + $cart_rule->id_customer = $order->id_customer; + $cart_rule->name = array( + Configuration::get('PS_LANG_DEFAULT') => $this->l('[Generated] CartRule for Free Shipping') + ); + $cart_rule->date_from = date('Y-m-d H:i:s', time()); + $cart_rule->date_to = date('Y-m-d H:i:s', time() + 24 * 3600); + $cart_rule->quantity = 1; + $cart_rule->quantity_per_user = 1; + $cart_rule->minimum_amount_currency = $order->id_currency; + $cart_rule->reduction_currency = $order->id_currency; + $cart_rule->free_shipping = true; + $cart_rule->active = 1; + $cart_rule->add(); + + // Add cart rule to cart and in order + $cart->addCartRule($cart_rule->id); + $values = array( + 'tax_incl' => $cart_rule->getContextualValue(true), + 'tax_excl' => $cart_rule->getContextualValue(false) + ); + $order->addCartRule($cart_rule->id, $cart_rule->name[Configuration::get('PS_LANG_DEFAULT')], $values); + } + + $order_invoice->id_order = $order->id; + if ($order_invoice->number) { + Configuration::updateValue('PS_INVOICE_START_NUMBER', false, false, null, $order->id_shop); + } else { + $order_invoice->number = Order::getLastInvoiceNumber() + 1; + } + + $invoice_address = new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE', null, null, $order->id_shop)}); + $carrier = new Carrier((int)$order->id_carrier); + $tax_calculator = $carrier->getTaxCalculator($invoice_address); + + $order_invoice->total_paid_tax_excl = Tools::ps_round((float)$cart->getOrderTotal(false, $total_method), 2); + $order_invoice->total_paid_tax_incl = Tools::ps_round((float)$cart->getOrderTotal($use_taxes, $total_method), 2); + $order_invoice->total_products = (float)$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); + $order_invoice->total_products_wt = (float)$cart->getOrderTotal($use_taxes, Cart::ONLY_PRODUCTS); + $order_invoice->total_shipping_tax_excl = (float)$cart->getTotalShippingCost(null, false); + $order_invoice->total_shipping_tax_incl = (float)$cart->getTotalShippingCost(); + + $order_invoice->total_wrapping_tax_excl = abs($cart->getOrderTotal(false, Cart::ONLY_WRAPPING)); + $order_invoice->total_wrapping_tax_incl = abs($cart->getOrderTotal($use_taxes, Cart::ONLY_WRAPPING)); + $order_invoice->shipping_tax_computation_method = (int)$tax_calculator->computation_method; + + // Update current order field, only shipping because other field is updated later + $order->total_shipping += $order_invoice->total_shipping_tax_incl; + $order->total_shipping_tax_excl += $order_invoice->total_shipping_tax_excl; + $order->total_shipping_tax_incl += ($use_taxes) ? $order_invoice->total_shipping_tax_incl : $order_invoice->total_shipping_tax_excl; + + $order->total_wrapping += abs($cart->getOrderTotal($use_taxes, Cart::ONLY_WRAPPING)); + $order->total_wrapping_tax_excl += abs($cart->getOrderTotal(false, Cart::ONLY_WRAPPING)); + $order->total_wrapping_tax_incl += abs($cart->getOrderTotal($use_taxes, Cart::ONLY_WRAPPING)); + $order_invoice->add(); + + $order_invoice->saveCarrierTaxCalculator($tax_calculator->getTaxesAmount($order_invoice->total_shipping_tax_excl)); + + $order_carrier = new OrderCarrier(); + $order_carrier->id_order = (int)$order->id; + $order_carrier->id_carrier = (int)$order->id_carrier; + $order_carrier->id_order_invoice = (int)$order_invoice->id; + $order_carrier->weight = (float)$cart->getTotalWeight(); + $order_carrier->shipping_cost_tax_excl = (float)$order_invoice->total_shipping_tax_excl; + $order_carrier->shipping_cost_tax_incl = ($use_taxes) ? (float)$order_invoice->total_shipping_tax_incl : (float)$order_invoice->total_shipping_tax_excl; + $order_carrier->add(); + } + // Update current invoice + else { + $order_invoice->total_paid_tax_excl += Tools::ps_round((float)($cart->getOrderTotal(false, $total_method)), 2); + $order_invoice->total_paid_tax_incl += Tools::ps_round((float)($cart->getOrderTotal($use_taxes, $total_method)), 2); + $order_invoice->total_products += (float)$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); + $order_invoice->total_products_wt += (float)$cart->getOrderTotal($use_taxes, Cart::ONLY_PRODUCTS); + $order_invoice->update(); + } + } + + // Create Order detail information + $order_detail = new OrderDetail(); + $order_detail->createList($order, $cart, $order->getCurrentOrderState(), $cart->getProducts(), (isset($order_invoice) ? $order_invoice->id : 0), $use_taxes, (int)Tools::getValue('add_product_warehouse')); + + // update totals amount of order + $order->total_products += (float)$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); + $order->total_products_wt += (float)$cart->getOrderTotal($use_taxes, Cart::ONLY_PRODUCTS); + + $order->total_paid += Tools::ps_round((float)($cart->getOrderTotal(true, $total_method)), 2); + $order->total_paid_tax_excl += Tools::ps_round((float)($cart->getOrderTotal(false, $total_method)), 2); + $order->total_paid_tax_incl += Tools::ps_round((float)($cart->getOrderTotal($use_taxes, $total_method)), 2); + + if (isset($order_invoice) && Validate::isLoadedObject($order_invoice)) { + $order->total_shipping = $order_invoice->total_shipping_tax_incl; + $order->total_shipping_tax_incl = $order_invoice->total_shipping_tax_incl; + $order->total_shipping_tax_excl = $order_invoice->total_shipping_tax_excl; + } + + // discount + $order->total_discounts += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + $order->total_discounts_tax_excl += (float)abs($cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS)); + $order->total_discounts_tax_incl += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + + // Save changes of order + $order->update(); + + // Update weight SUM + $order_carrier = new OrderCarrier((int)$order->getIdOrderCarrier()); + if (Validate::isLoadedObject($order_carrier)) { + $order_carrier->weight = (float)$order->getTotalWeight(); + if ($order_carrier->update()) { + $order->weight = sprintf("%.3f ".Configuration::get('PS_WEIGHT_UNIT'), $order_carrier->weight); + } + } + + // Update Tax lines + $order_detail->updateTaxAmount($order); + + // Delete specific price if exists + if (isset($specific_price)) { + $specific_price->delete(); + } + + $products = $this->getProducts($order); + + // Get the last product + $product = end($products); + $product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']); + $resume = OrderSlip::getProductSlipResume((int)$product['id_order_detail']); + $product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity']; + $product['amount_refundable'] = $product['total_price_tax_excl'] - $resume['amount_tax_excl']; + $product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']); + $product['return_history'] = OrderReturn::getProductReturnDetail((int)$product['id_order_detail']); + $product['refund_history'] = OrderSlip::getProductSlipDetail((int)$product['id_order_detail']); + if ($product['id_warehouse'] != 0) { + $warehouse = new Warehouse((int)$product['id_warehouse']); + $product['warehouse_name'] = $warehouse->name; + $warehouse_location = WarehouseProductLocation::getProductLocation($product['product_id'], $product['product_attribute_id'], $product['id_warehouse']); + if (!empty($warehouse_location)) { + $product['warehouse_location'] = $warehouse_location; + } else { + $product['warehouse_location'] = false; + } + } else { + $product['warehouse_name'] = '--'; + $product['warehouse_location'] = false; + } + + // Get invoices collection + $invoice_collection = $order->getInvoicesCollection(); + + $invoice_array = array(); + foreach ($invoice_collection as $invoice) { + /** @var OrderInvoice $invoice */ + $invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop); + $invoice_array[] = $invoice; + } + + // Assign to smarty informations in order to show the new product line + $this->context->smarty->assign(array( + 'product' => $product, + 'order' => $order, + 'currency' => new Currency($order->id_currency), + 'can_edit' => $this->tabAccess['edit'], + 'invoices_collection' => $invoice_collection, + 'current_id_lang' => Context::getContext()->language->id, + 'link' => Context::getContext()->link, + 'current_index' => self::$currentIndex, + 'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') + )); + + $this->sendChangedNotification($order); + $new_cart_rules = Context::getContext()->cart->getCartRules(); + sort($old_cart_rules); + sort($new_cart_rules); + $result = array_diff($new_cart_rules, $old_cart_rules); + $refresh = false; + + $res = true; + foreach ($result as $cart_rule) { + $refresh = true; + // Create OrderCartRule + $rule = new CartRule($cart_rule['id_cart_rule']); + $values = array( + 'tax_incl' => $rule->getContextualValue(true), + 'tax_excl' => $rule->getContextualValue(false) + ); + $order_cart_rule = new OrderCartRule(); + $order_cart_rule->id_order = $order->id; + $order_cart_rule->id_cart_rule = $cart_rule['id_cart_rule']; + $order_cart_rule->id_order_invoice = $order_invoice->id; + $order_cart_rule->name = $cart_rule['name']; + $order_cart_rule->value = $values['tax_incl']; + $order_cart_rule->value_tax_excl = $values['tax_excl']; + $res &= $order_cart_rule->add(); + + $order->total_discounts += $order_cart_rule->value; + $order->total_discounts_tax_incl += $order_cart_rule->value; + $order->total_discounts_tax_excl += $order_cart_rule->value_tax_excl; + $order->total_paid -= $order_cart_rule->value; + $order->total_paid_tax_incl -= $order_cart_rule->value; + $order->total_paid_tax_excl -= $order_cart_rule->value_tax_excl; + } + + // Update Order + $res &= $order->update(); + + die(Tools::jsonEncode(array( + 'result' => true, + 'view' => $this->createTemplate('_product_line.tpl')->fetch(), + 'can_edit' => $this->tabAccess['add'], + 'order' => $order, + 'invoices' => $invoice_array, + 'documents_html' => $this->createTemplate('_documents.tpl')->fetch(), + 'shipping_html' => $this->createTemplate('_shipping.tpl')->fetch(), + 'discount_form_html' => $this->createTemplate('_discount_form.tpl')->fetch(), + 'refresh' => $refresh + ))); + } + public function ajaxProcessAddProductOnOrder() { // Load object @@ -2010,10 +2769,6 @@ class AdminOrdersControllerCore extends AdminController $this->context->cart = $cart; $this->context->customer = new Customer($order->id_customer); - if ($order->with_occupancy) { - $objRoomType = new HotelRoomType(); - $roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($id_product); - } /*By Webkul to make entries in HotelCartBookingData */ $hotel_room_info_arr = $hotel_room_data['rm_data'][$idProduct]['data']['available']; $chkQty = 0; @@ -2023,12 +2778,12 @@ class AdminOrdersControllerCore extends AdminController $objCartBookingData = new HotelCartBookingData(); $objCartBookingData->id_cart = $this->context->cart->id; $objCartBookingData->id_guest = $this->context->cookie->id_guest; - $objCartBookingData->id_customer = $this->context->customer->id; + $objCartBookingData->id_customer = $order->id_customer; $objCartBookingData->id_currency = $order->id_currency; $objCartBookingData->id_product = $room_info['id_product']; $objCartBookingData->id_room = $room_info['id_room']; $objCartBookingData->id_hotel = $room_info['id_hotel']; - $objCartBookingData->booking_type = HotelBookingDetail::ALLOTMENT_AUTO; + $objCartBookingData->booking_type = 1; $objCartBookingData->quantity = $num_days; $objCartBookingData->date_from = $date_from; $objCartBookingData->date_to = $date_to; @@ -2039,8 +2794,8 @@ class AdminOrdersControllerCore extends AdminController $objCartBookingData->children = $room_occupancy['children']; $objCartBookingData->child_ages = $room_occupancy['children'] ? json_encode($room_occupancy['child_ages']) : json_encode(array()); } else { - $objCartBookingData->adults = $roomTypeInfo['adults']; - $objCartBookingData->children = $roomTypeInfo['children']; + $objCartBookingData->adults = $room_info_by_id_product['adults']; + $objCartBookingData->children = $room_info_by_id_product['children']; $objCartBookingData->child_ages = json_encode(array()); } $objCartBookingData->save(); @@ -2351,7 +3106,7 @@ class AdminOrdersControllerCore extends AdminController $objBookingDetail->id_cart = $this->context->cart->id; $objBookingDetail->id_room = $objCartBookingData->id_room; $objBookingDetail->id_hotel = $objCartBookingData->id_hotel; - $objBookingDetail->id_customer = $this->context->customer->id; + $objBookingDetail->id_customer = $order->id_customer; $objBookingDetail->booking_type = $objCartBookingData->booking_type; $objBookingDetail->id_status = 1; $objBookingDetail->comment = $objCartBookingData->comment; @@ -2422,26 +3177,62 @@ class AdminOrdersControllerCore extends AdminController ))); } + /** + * This function is called when order is changed (Add/Edit/Delete room on order) + */ public function sendChangedNotification(Order $order = null) { if (is_null($order)) { $order = new Order(Tools::getValue('id_order')); } + $this->updateOrderStatusOnOrderChange($order); + + // load updated object + $order = new Order(Tools::getValue('id_order')); + Hook::exec('actionOrderEdited', array('order' => $order)); } + /** + * This function is called to manage order status when order is changed + */ + public function updateOrderStatusOnOrderChange($objOrder) + { + // check if new order amount is greater that old order amount and order payment is accepted + // then update order status to partial payment accepted + $currentOrderState = $objOrder->getCurrentOrderState(); + $psOsPartialPaymentAccepted = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED'); + if ($currentOrderState->paid == 1 && $currentOrderState->id != $psOsPartialPaymentAccepted) { + // calculate due amount + $dueAmount = $objOrder->total_paid_tax_incl - $objOrder->total_paid_real; + if ($dueAmount > 0) { + // now change order status to partial payment + $objOrderHistory = new OrderHistory(); + $objOrderHistory->id_order = $objOrder->id; + $objOrderHistory->id_employee = (int) $this->context->employee->id; + + $useExistingPayment = false; + if (!$objOrder->hasInvoice()) { + $useExistingPayment = true; + } + + $objOrderHistory->changeIdOrderState($psOsPartialPaymentAccepted, $objOrder, $useExistingPayment); + $objOrderHistory->add(); + } + } + } + public function ajaxProcessLoadProductInformation() { - // $order_detail = new OrderDetail(Tools::getValue('id_order_detail')); - // if (!Validate::isLoadedObject($order_detail)) - // die(json_encode(array( - // 'result' => false, - // 'error' => Tools::displayError('The OrderDetail object cannot be loaded.') - // ))); + $order_detail = new OrderDetail(Tools::getValue('id_order_detail')); + if (!Validate::isLoadedObject($order_detail)) + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('The OrderDetail object cannot be loaded.') + ))); - $id_product = Tools::getValue('id_product'); - $product = new Product($id_product); + $product = new Product($order_detail->product_id); if (!Validate::isLoadedObject($product)) { die(json_encode(array( 'result' => false, @@ -2462,12 +3253,12 @@ class AdminOrdersControllerCore extends AdminController 'product' => $product, 'tax_rate' => $product->getTaxesRate($address), /*Original*/ - /*'price_tax_incl' => Product::getPriceStatic($product->id, true, $order_detail->product_attribute_id, 2), - 'price_tax_excl' => Product::getPriceStatic($product->id, false, $order_detail->product_attribute_id, 2),*/ + 'price_tax_incl' => Product::getPriceStatic($product->id, true, $order_detail->product_attribute_id, 2), + 'price_tax_excl' => Product::getPriceStatic($product->id, false, $order_detail->product_attribute_id, 2), /*Changed by webkul because attribute_id will always be 0 (No combination)*/ - 'price_tax_incl' => Product::getPriceStatic($product->id, true, 0, 2), - 'price_tax_excl' => Product::getPriceStatic($product->id, false, 0, 2), - //'reduction_percent' => $order_detail->reduction_percent + // 'price_tax_incl' => Product::getPriceStatic($product->id, true, 0, 2), + // 'price_tax_excl' => Product::getPriceStatic($product->id, false, 0, 2), + 'reduction_percent' => $order_detail->reduction_percent ))); } @@ -2497,7 +3288,7 @@ class AdminOrdersControllerCore extends AdminController $hrt_feature_price->add(); } - public function ajaxProcessEditProductOnOrder() + public function ajaxProcessEditRoomOnOrder() { // Return value $res = true; @@ -2506,12 +3297,12 @@ class AdminOrdersControllerCore extends AdminController $cart = new Cart($order->id_cart); $customer = new Cart($order->id_customer); //$order_detail = new OrderDetail((int)Tools::getValue('product_id_order_detail')); - $order_detail = new OrderDetail((int) Tools::getValue('order_detail_id'));//by webkul id_order_detail from our table - $this->doEditProductValidation($order_detail, $order, isset($order_invoice) ? $order_invoice : null); + $order_detail = new OrderDetail((int) Tools::getValue('id_order_detail'));//by webkul id_order_detail from our table + $this->doEditRoomValidation($order_detail, $order, isset($order_invoice) ? $order_invoice : null); + if (Tools::isSubmit('product_invoice')) { $order_invoice = new OrderInvoice((int) Tools::getValue('product_invoice')); } - /*By webkul To edit Order and cart entries when edit rooms from the orderLine when editing the order*/ $product_informations = $_POST['edit_product']; $new_date_from = trim(date('Y-m-d', strtotime($product_informations['date_from']))); @@ -2526,10 +3317,12 @@ class AdminOrdersControllerCore extends AdminController $product_quantity = (int) $obj_booking_detail->getNumberOfDays($new_date_from, $new_date_to); $old_product_quantity = (int) $obj_booking_detail->getNumberOfDays($old_date_from, $old_date_to); $qty_diff = $product_quantity - $old_product_quantity; - $occupancy = array_shift(Tools::getValue('occupancy')); - $adults = $occupancy['adults']; - $children = $occupancy['children']; - $child_ages = $occupancy['child_ages']; + if ($order->with_occupancy) { + $occupancy = array_shift(Tools::getValue('occupancy')); + $adults = $occupancy['adults']; + $children = $occupancy['children']; + $child_ages = $occupancy['child_ages']; + } /*By webkul to validate fields before deleting the cart and order data form the tables*/ if ($id_hotel == '') { @@ -2587,30 +3380,36 @@ class AdminOrdersControllerCore extends AdminController 'result' => false, 'error' => Tools::displayError('Invalid quantity.'), ))); - } elseif (!isset($adults) || !$adults || !Validate::isUnsignedInt($adults)) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid number of adults.'), - ))); - } elseif (!Validate::isUnsignedInt($children)) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid number of children.'), - ))); } - if ($children > 0) { - if (!isset($child_ages) || ($children != count($child_ages))) { + + // validations if order is with occupancy + if ($order->with_occupancy) { + if (!isset($adults) || !$adults || !Validate::isUnsignedInt($adults)) { die(json_encode(array( 'result' => false, - 'error' => Tools::displayError('Please provide all children age.'), + 'error' => Tools::displayError('Invalid number of adults.'), ))); - } else { - foreach($child_ages as $childAge) { - if (!Validate::isUnsignedInt($childAge)) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid children age.'), - ))); + } elseif (!Validate::isUnsignedInt($children)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid number of children.'), + ))); + } + + if ($children > 0) { + if (!isset($child_ages) || ($children != count($child_ages))) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Please provide all children age.'), + ))); + } else { + foreach($child_ages as $childAge) { + if (!Validate::isUnsignedInt($childAge)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid children age.'), + ))); + } } } } @@ -2634,7 +3433,7 @@ class AdminOrdersControllerCore extends AdminController $totalProductPriceAfterTI = 0; $totalRoomPriceAfterTE = 0; $totalRoomPriceAfterTI = 0; - $bookedRooms = $obj_booking_detail->getBookedRoomsByIdOrderDetail((int) Tools::getValue('order_detail_id'), $id_product); + $bookedRooms = $obj_booking_detail->getBookedRoomsByIdOrderDetail((int) Tools::getValue('id_order_detail'), $id_product); if ($bookedRooms) { $params = array( 'id_cart' => $cart->id, @@ -2658,7 +3457,8 @@ class AdminOrdersControllerCore extends AdminController Group::getCurrent()->id, $cart->id, $cart->id_guest, - $roomInfo['id_room'] + $roomInfo['id_room'], + 0 ); $totalProductPriceAfterTE += (float) $roomTotalPrice['total_price_tax_excl']; @@ -2894,19 +3694,6 @@ class AdminOrdersControllerCore extends AdminController } } } - - if (isset($order_invoice)) { - // Apply changes on OrderInvoice - $order_invoice->total_paid_tax_excl = $objOrder->total_paid_tax_excl; - $order_invoice->total_paid_tax_incl = $objOrder->total_paid_tax_incl; - } - - - // Save order invoice - if (isset($order_invoice)) { - $res &= $order_invoice->update(); - } - // change order total save $objOrder->save(); } @@ -2933,10 +3720,216 @@ class AdminOrdersControllerCore extends AdminController ))); } - public function ajaxProcessDeleteProductLine() + public function ajaxProcessEditProductOnOrder() + { + // Return value + $res = true; + + $order = new Order((int)Tools::getValue('id_order')); + $order_detail = new OrderDetail((int)Tools::getValue('product_id_order_detail')); + if (Tools::isSubmit('product_invoice')) { + $order_invoice = new OrderInvoice((int)Tools::getValue('product_invoice')); + } + + // If multiple product_quantity, the order details concern a product customized + $product_quantity = 0; + if (is_array(Tools::getValue('product_quantity'))) { + foreach (Tools::getValue('product_quantity') as $id_customization => $qty) { + // Update quantity of each customization + Db::getInstance()->update('customization', array('quantity' => (int)$qty), 'id_customization = ' . (int)$id_customization); + // Calculate the real quantity of the product + $product_quantity += $qty; + } + } else { + $product_quantity = Tools::getValue('product_quantity'); + } + + $this->checkStockAvailable($order_detail, ($product_quantity - $order_detail->product_quantity)); + + // Check fields validity + $this->doEditProductValidation($order_detail, $order, isset($order_invoice) ? $order_invoice : null); + + // If multiple product_quantity, the order details concern a product customized + $product_quantity = 0; + if (is_array(Tools::getValue('product_quantity'))) { + foreach (Tools::getValue('product_quantity') as $id_customization => $qty) { + // Update quantity of each customization + Db::getInstance()->update('customization', array('quantity' => (int)$qty), 'id_customization = '.(int)$id_customization); + // Calculate the real quantity of the product + $product_quantity += $qty; + } + } else { + $product_quantity = Tools::getValue('product_quantity'); + } + + $product_price_tax_incl = $order_detail->unit_price_tax_incl; + $product_price_tax_excl = $order_detail->unit_price_tax_excl; + $total_products_tax_incl = $product_price_tax_incl * $product_quantity; + $total_products_tax_excl = $product_price_tax_excl * $product_quantity; + + // Calculate differences of price (Before / After) + $diff_price_tax_incl = $total_products_tax_incl - $order_detail->total_price_tax_incl; + $diff_price_tax_excl = $total_products_tax_excl - $order_detail->total_price_tax_excl; + + // Apply change on OrderInvoice + if (isset($order_invoice)) { + // If OrderInvoice to use is different, we update the old invoice and new invoice + if ($order_detail->id_order_invoice != $order_invoice->id) { + $old_order_invoice = new OrderInvoice($order_detail->id_order_invoice); + // We remove cost of products + $old_order_invoice->total_products -= $order_detail->total_price_tax_excl; + $old_order_invoice->total_products_wt -= $order_detail->total_price_tax_incl; + + $old_order_invoice->total_paid_tax_excl -= $order_detail->total_price_tax_excl; + $old_order_invoice->total_paid_tax_incl -= $order_detail->total_price_tax_incl; + + $res &= $old_order_invoice->update(); + + $order_invoice->total_products += $order_detail->total_price_tax_excl; + $order_invoice->total_products_wt += $order_detail->total_price_tax_incl; + + $order_invoice->total_paid_tax_excl += $order_detail->total_price_tax_excl; + $order_invoice->total_paid_tax_incl += $order_detail->total_price_tax_incl; + + $order_detail->id_order_invoice = $order_invoice->id; + } + } + + if ($diff_price_tax_incl != 0 && $diff_price_tax_excl != 0) { + $order_detail->unit_price_tax_excl = $product_price_tax_excl; + $order_detail->unit_price_tax_incl = $product_price_tax_incl; + + $order_detail->total_price_tax_incl += $diff_price_tax_incl; + $order_detail->total_price_tax_excl += $diff_price_tax_excl; + + if (isset($order_invoice)) { + // Apply changes on OrderInvoice + $order_invoice->total_products += $diff_price_tax_excl; + $order_invoice->total_products_wt += $diff_price_tax_incl; + + $order_invoice->total_paid_tax_excl += $diff_price_tax_excl; + $order_invoice->total_paid_tax_incl += $diff_price_tax_incl; + } + + // Apply changes on Order + $order = new Order($order_detail->id_order); + $order->total_products += $diff_price_tax_excl; + $order->total_products_wt += $diff_price_tax_incl; + + $order->total_paid += $diff_price_tax_incl; + $order->total_paid_tax_excl += $diff_price_tax_excl; + $order->total_paid_tax_incl += $diff_price_tax_incl; + + $res &= $order->update(); + } + + $old_quantity = $order_detail->product_quantity; + + $order_detail->product_quantity = $product_quantity; + $order_detail->reduction_percent = 0; + + // update taxes + $res &= $order_detail->updateTaxAmount($order); + + // Save order detail + $res &= $order_detail->update(); + + // Update weight SUM + $order_carrier = new OrderCarrier((int)$order->getIdOrderCarrier()); + if (Validate::isLoadedObject($order_carrier)) { + $order_carrier->weight = (float)$order->getTotalWeight(); + $res &= $order_carrier->update(); + if ($res) { + $order->weight = sprintf("%.3f ".Configuration::get('PS_WEIGHT_UNIT'), $order_carrier->weight); + } + } + + // Save order invoice + if (isset($order_invoice)) { + $res &= $order_invoice->update(); + } + + // Update product available quantity + StockAvailable::updateQuantity($order_detail->product_id, $order_detail->product_attribute_id, ($old_quantity - $order_detail->product_quantity), $order->id_shop); + + $products = $this->getProducts($order); + // Get the last product + $product = $products[$order_detail->id]; + $product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']); + $resume = OrderSlip::getProductSlipResume($order_detail->id); + $product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity']; + $product['amount_refundable'] = $product['total_price_tax_excl'] - $resume['amount_tax_excl']; + $product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']); + $product['refund_history'] = OrderSlip::getProductSlipDetail($order_detail->id); + if ($product['id_warehouse'] != 0) { + $warehouse = new Warehouse((int)$product['id_warehouse']); + $product['warehouse_name'] = $warehouse->name; + $warehouse_location = WarehouseProductLocation::getProductLocation($product['product_id'], $product['product_attribute_id'], $product['id_warehouse']); + if (!empty($warehouse_location)) { + $product['warehouse_location'] = $warehouse_location; + } else { + $product['warehouse_location'] = false; + } + } else { + $product['warehouse_name'] = '--'; + $product['warehouse_location'] = false; + } + + // Get invoices collection + $invoice_collection = $order->getInvoicesCollection(); + + $invoice_array = array(); + foreach ($invoice_collection as $invoice) { + /** @var OrderInvoice $invoice */ + $invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop); + $invoice_array[] = $invoice; + } + + // Assign to smarty informations in order to show the new product line + $this->context->smarty->assign(array( + 'product' => $product, + 'order' => $order, + 'currency' => new Currency($order->id_currency), + 'can_edit' => $this->tabAccess['edit'], + 'invoices_collection' => $invoice_collection, + 'current_id_lang' => Context::getContext()->language->id, + 'link' => Context::getContext()->link, + 'current_index' => self::$currentIndex, + 'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') + )); + + if (!$res) { + die(Tools::jsonEncode(array( + 'result' => $res, + 'error' => Tools::displayError('An error occurred while editing the product line.') + ))); + } + + if (is_array(Tools::getValue('product_quantity'))) { + $view = $this->createTemplate('_customized_data.tpl')->fetch(); + } else { + $view = $this->createTemplate('_product_line.tpl')->fetch(); + } + + $this->sendChangedNotification($order); + + die(Tools::jsonEncode(array( + 'result' => $res, + 'view' => $view, + 'can_edit' => $this->tabAccess['add'], + 'invoices_collection' => $invoice_collection, + 'order' => $order, + 'invoices' => $invoice_array, + 'documents_html' => $this->createTemplate('_documents.tpl')->fetch(), + 'shipping_html' => $this->createTemplate('_shipping.tpl')->fetch(), + 'customized_product' => is_array(Tools::getValue('product_quantity')) + ))); + } + + public function ajaxProcessDeleteRoomLine() { $res = true; - $order_detail = new OrderDetail((int) Tools::getValue('order_detail_id')); + $order_detail = new OrderDetail((int) Tools::getValue('id_order_detail')); $id_order = (int) Tools::getValue('id_order'); $order = new Order($id_order); /*By webkul To delete Order and cart entries when deleting rooms from the orderLine when editing the order*/ @@ -3012,6 +4005,36 @@ class AdminOrdersControllerCore extends AdminController 0 ); + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); + $additionlServicesTI = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom( + $id_order, + $id_product, + $date_from, + $date_to, + $id_room, + 1, + 1 + ); + + $additionlServicesTE = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom( + $id_order, + $id_product, + $date_from, + $date_to, + $id_room, + 1, + 0 + ); + + $selectedAdditonalServices = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom( + $id_order, + $id_product, + $date_from, + $date_to, + $id_room + ); + + /*$totalProductPriceBeforeTE = $order_detail->total_price_tax_excl; $totalProductPriceBeforeTI = $order_detail->total_price_tax_incl;*/ // by webkul to calculate rates of the product from hotelreservation syatem tables with feature prices.... @@ -3044,14 +4067,33 @@ class AdminOrdersControllerCore extends AdminController // Save order detail $res &= $order_detail->update(); } + // update order detail for selected aditional services + foreach ($selectedAdditonalServices['additional_services'] as $service) { + $serviceOrderDetail = new OrderDetail($service['id_order_detail']); + if ($service['quantity'] >= $serviceOrderDetail->product_quantity) { + $serviceOrderDetail->delete(); + } else { + $order_detail->total_price_tax_incl -= $service['total_price_tax_incl']; + $order_detail->total_price_tax_excl -= $service['total_price_tax_excl']; + + $serviceOldQuantity = $serviceOrderDetail->product_quantity; + $serviceOrderDetail->product_quantity = $serviceOldQuantity - $service['quantity']; + + // update taxes + $res &= $order_detail->updateTaxAmount($order); + + // Save order detail + $res &= $order_detail->update(); + } + } /*End*/ // Update OrderInvoice of this OrderDetail if ($order_detail->id_order_invoice != 0) { // values changes as values are calculated accoding to the quantity of the product by webkul $order_invoice = new OrderInvoice($order_detail->id_order_invoice); - $order_invoice->total_paid_tax_excl -= ($diff_products_tax_excl + $roomExtraDemandTE); - $order_invoice->total_paid_tax_incl -= ($diff_products_tax_incl + $roomExtraDemandTI); + $order_invoice->total_paid_tax_excl -= ($diff_products_tax_excl + $roomExtraDemandTE + $additionlServicesTE); + $order_invoice->total_paid_tax_incl -= ($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI); $order_invoice->total_products -= $diff_products_tax_excl; $order_invoice->total_products_wt -= $diff_products_tax_incl; $res &= $order_invoice->update(); @@ -3060,10 +4102,10 @@ class AdminOrdersControllerCore extends AdminController // Update Order // values changes as values are calculated accoding to the quantity of the product by webkul $order->total_paid -= ($diff_products_tax_incl + $roomExtraDemandTI); - $order->total_paid_tax_incl -= ($diff_products_tax_incl + $roomExtraDemandTI); - $order->total_paid_tax_excl -= ($diff_products_tax_excl + $roomExtraDemandTE); - $order->total_products -= $diff_products_tax_excl; - $order->total_products_wt -= $diff_products_tax_incl; + $order->total_paid_tax_incl -= ($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI); + $order->total_paid_tax_excl -= ($diff_products_tax_excl + $roomExtraDemandTE + $additionlServicesTE); + $order->total_products -= ($diff_products_tax_excl + $additionlServicesTE); + $order->total_products_wt -= ($diff_products_tax_incl + $additionlServicesTI); $res &= $order->update(); @@ -3100,6 +4142,8 @@ class AdminOrdersControllerCore extends AdminController // delete the demands od this booking $objBookingDemand->deleteBookingDemands($idHotelBooking); + $objRoomTypeServiceProductOrderDetail->deleteRoomSevicesByIdHotelBookingDetail($idHotelBooking); + /*By webkul to delete cart and order entries from cart and order tables of hotelreservationsystem when delete booking form the order line in order detaoil page*/ $obj_htl_cart_booking = new HotelCartBookingData(); $delete_room_order = $obj_htl_cart_booking->deleteOrderedRoomFromCart($id_order, $id_hotel, $id_room, $date_from, $date_to); @@ -3128,7 +4172,185 @@ class AdminOrdersControllerCore extends AdminController ))); } + public function ajaxProcessDeleteProductLine() + { + $res = true; + + $order_detail = new OrderDetail((int)Tools::getValue('id_order_detail')); + $order = new Order((int)Tools::getValue('id_order')); + + $this->doDeleteProductLineValidation($order_detail, $order); + + // Update OrderInvoice of this OrderDetail + if ($order_detail->id_order_invoice != 0) { + $order_invoice = new OrderInvoice($order_detail->id_order_invoice); + $order_invoice->total_paid_tax_excl -= $order_detail->total_price_tax_excl; + $order_invoice->total_paid_tax_incl -= $order_detail->total_price_tax_incl; + $order_invoice->total_products -= $order_detail->total_price_tax_excl; + $order_invoice->total_products_wt -= $order_detail->total_price_tax_incl; + $res &= $order_invoice->update(); + } + + // Update Order + $order->total_paid -= $order_detail->total_price_tax_incl; + $order->total_paid_tax_incl -= $order_detail->total_price_tax_incl; + $order->total_paid_tax_excl -= $order_detail->total_price_tax_excl; + $order->total_products -= $order_detail->total_price_tax_excl; + $order->total_products_wt -= $order_detail->total_price_tax_incl; + + $res &= $order->update(); + + // Reinject quantity in stock + $this->reinjectQuantity($order_detail, $order_detail->product_quantity, true); + + // Update weight SUM + $order_carrier = new OrderCarrier((int)$order->getIdOrderCarrier()); + if (Validate::isLoadedObject($order_carrier)) { + $order_carrier->weight = (float)$order->getTotalWeight(); + $res &= $order_carrier->update(); + if ($res) { + $order->weight = sprintf("%.3f ".Configuration::get('PS_WEIGHT_UNIT'), $order_carrier->weight); + } + } + + if (!$res) { + die(Tools::jsonEncode(array( + 'result' => $res, + 'error' => Tools::displayError('An error occurred while attempting to delete the product line.') + ))); + } + + // Get invoices collection + $invoice_collection = $order->getInvoicesCollection(); + + $invoice_array = array(); + foreach ($invoice_collection as $invoice) { + /** @var OrderInvoice $invoice */ + $invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop); + $invoice_array[] = $invoice; + } + + // Assign to smarty informations in order to show the new product line + $this->context->smarty->assign(array( + 'order' => $order, + 'currency' => new Currency($order->id_currency), + 'invoices_collection' => $invoice_collection, + 'current_id_lang' => Context::getContext()->language->id, + 'link' => Context::getContext()->link, + 'current_index' => self::$currentIndex + )); + + $this->sendChangedNotification($order); + + die(Tools::jsonEncode(array( + 'result' => $res, + 'order' => $order, + 'invoices' => $invoice_array, + 'documents_html' => $this->createTemplate('_documents.tpl')->fetch(), + 'shipping_html' => $this->createTemplate('_shipping.tpl')->fetch() + ))); + } + protected function doEditProductValidation(OrderDetail $order_detail, Order $order, OrderInvoice $order_invoice = null) + { + $this->doEditValidation($order_detail, $order, $order_invoice); + + if (!is_array(Tools::getValue('product_quantity')) && !Validate::isUnsignedInt(Tools::getValue('product_quantity'))) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid quantity') + ))); + } elseif (is_array(Tools::getValue('product_quantity'))) { + foreach (Tools::getValue('product_quantity') as $qty) { + if (!Validate::isUnsignedInt($qty)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid quantity') + ))); + } + } + } + } + + protected function doEditRoomValidation(OrderDetail $order_detail, Order $order, OrderInvoice $order_invoice = null) + { + $this->doEditValidation($order_detail, $order, $order_invoice); + + $product_price_tax_incl = str_replace(',', '.', Tools::getValue('product_price_tax_incl')); + $product_price_tax_excl = str_replace(',', '.', Tools::getValue('product_price_tax_excl')); + + if (!Validate::isPrice($product_price_tax_incl) || !Validate::isPrice($product_price_tax_excl)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid price') + ))); + } + + $product_informations = Tools::getValue('edit_product'); + $old_date_from = date('Y-m-d', strtotime(trim(Tools::getValue('date_from')))); + $old_date_to = date('Y-m-d', strtotime(trim(Tools::getValue('date_to')))); + $new_date_from = trim(date('Y-m-d', strtotime($product_informations['date_from']))); + $new_date_to = trim(date('Y-m-d', strtotime($product_informations['date_to']))); + $obj_booking_detail = new HotelBookingDetail(); + $product_quantity = (int) $obj_booking_detail->getNumberOfDays($new_date_from, $new_date_to); + + if (trim(Tools::getValue('id_hotel')) == '') { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Hotel Id is mising.'), + ))); + } elseif (trim(Tools::getValue('id_room')) == '') { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Room Id is missing.'), + ))); + } elseif (trim(date('Y-m-d', strtotime($product_informations['date_from']))) == '') { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Please Enter Check In Date.'), + ))); + } elseif (!Validate::isDateFormat($new_date_from)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Please Enter a Valid Check In Date.'), + ))); + } elseif ($new_date_to == '') { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Please Enter Check Out Date.'), + ))); + } elseif (!Validate::isDateFormat($new_date_to)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Please Enter a valid Check out Date.'), + ))); + } elseif ($new_date_from < $curr_date) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Check In date should not be after current date.'), + ))); + } elseif ($new_date_to <= $new_date_from) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Check out Date Should be after Check In date.'), + ))); + } elseif (!Validate::isUnsignedInt($product_quantity)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid quantity.'), + ))); + } + + $rooms_booked = $obj_booking_detail->getRoomBookinInformationForDateRangeByOrder($id_room, $old_date_from, $old_date_to, $new_date_from, $new_date_to); + if ($rooms_booked) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('This Room Unavailable For Selected Duration.'), + ))); + } + } + + protected function doEditValidation(OrderDetail $order_detail, Order $order, OrderInvoice $order_invoice = null) { if (!Validate::isLoadedObject($order_detail)) { die(json_encode(array( @@ -3172,30 +4394,6 @@ class AdminOrdersControllerCore extends AdminController 'error' => Tools::displayError('You cannot use this invoice for the order') ))); } - - // Clean price - $product_price_tax_incl = str_replace(',', '.', Tools::getValue('product_price_tax_incl')); - $product_price_tax_excl = str_replace(',', '.', Tools::getValue('product_price_tax_excl')); - - if (!Validate::isPrice($product_price_tax_incl) || !Validate::isPrice($product_price_tax_excl)) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid price') - ))); - } - //commented by webkul here quantity is gap between booking days which is calulated and validated in ajaxProcessEditProductOnOrder(); - /*if (!is_array(Tools::getValue('product_quantity')) && !Validate::isUnsignedInt(Tools::getValue('product_quantity'))) - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid quantity') - ))); - elseif (is_array(Tools::getValue('product_quantity'))) - foreach (Tools::getValue('product_quantity') as $qty) - if (!Validate::isUnsignedInt($qty)) - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid quantity') - )));*/ } protected function doDeleteProductLineValidation(OrderDetail $order_detail, Order $order) @@ -3476,10 +4674,27 @@ class AdminOrdersControllerCore extends AdminController die(json_encode($result)); } + public function ajaxProcessDeleteProductProcess() + { + $errors = array(); + if ((!$id_product = (int)Tools::getValue('id_product')) || !Validate::isInt($id_product)) { + $errors[] = Tools::displayError('Invalid product'); + } + $cart_id = Tools::getValue('id_cart'); + if (!Validate::isLoadedObject($objCart = new Cart($cart_id))) { + $errors[] = Tools::displayError('Cart not found'); + } + if (count($errors)) { + die(json_encode($errors)); + } + if ($objCart->deleteProduct($id_product)) { + die(json_encode(array('status' => 'deleted'))); + } + } + // To show rooms extra demands in the modal box in order details view page public function ajaxProcessGetRoomTypeBookingDemands() { - $extraDemandsTpl = ''; if (($idProduct = Tools::getValue('id_product')) && ($idOrder = Tools::getValue('id_order')) && ($idRoom = Tools::getValue('id_room')) @@ -3489,8 +4704,21 @@ class AdminOrdersControllerCore extends AdminController $smartyVars = array(); $objOrder = new Order($idOrder); $smartyVars['orderCurrency'] = $objOrder->id_currency; + $smartyVars['link'] = $this->context->link; + + $objBookingDemand = new HotelBookingDetail(); + $htlBookingDetail = $objBookingDemand->getRowByIdOrderIdProductInDateRange( + $idOrder, + $idProduct, + $dateFrom, + $dateTo, + $idRoom + ); + + $smartyVars['id_booking_detail'] = $htlBookingDetail['id']; $objBookingDemand = new HotelBookingDemands(); + if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands( $idOrder, $idProduct, @@ -3518,17 +4746,462 @@ class AdminOrdersControllerCore extends AdminController } } + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); + if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom( + $idOrder, + $idProduct, + $dateFrom, + $dateTo, + $idRoom + )) { + $smartyVars['additionalServices'] = $additionalServices; + } + + if ($orderEdit = Tools::getValue('orderEdit')) { + $smartyVars['orderEdit'] = $orderEdit; + + // get room type additional demands + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null)) { + foreach ($roomTypeServiceProducts as $key => $product) { + if (in_array($product['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) { + unset($roomTypeServiceProducts[$key]); + } + } + $smartyVars['roomTypeServiceProducts'] = $roomTypeServiceProducts; + } + } $this->context->smarty->assign($smartyVars); - $extraDemandsTpl .= $this->context->smarty->fetch( - _PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_room_extra_demands.tpl' - ); } + + $extraDemandsTpl = $this->context->smarty->fetch( + _PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_room_extra_services_modal.tpl' + ); die($extraDemandsTpl); } + public function processRenderServicesPanel($idOrder, $idProduct, $dateFrom, $dateTo, $idRoom, $orderEdit) + { + $smartyVars = array(); + $objBookingDemand = new HotelBookingDetail(); + $htlBookingDetail = $objBookingDemand->getRowByIdOrderIdProductInDateRange( + $idOrder, + $idProduct, + $dateFrom, + $dateTo, + $idRoom + ); + + $smartyVars['id_booking_detail'] = $htlBookingDetail['id']; + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); + if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom( + $idOrder, + $idProduct, + $dateFrom, + $dateTo, + $idRoom + )) { + $smartyVars['additionalServices'] = $additionalServices; + } + + if ($orderEdit) { + $smartyVars['orderEdit'] = $orderEdit; + + // get room type additional demands + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null)) { + foreach ($roomTypeServiceProducts as $key => $product) { + if (in_array($product['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) { + unset($roomTypeServiceProducts[$key]); + } + } + $smartyVars['roomTypeServiceProducts'] = $roomTypeServiceProducts; + } + } + $smartyVars['show_active'] = true; + $this->context->smarty->assign($smartyVars); + + $servicesTpl = $this->context->smarty->fetch( + _PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_room_services_block.tpl' + ); + return $servicesTpl; + } + + public function processRenderFacilitiesBlock($idOrder, $idProduct, $dateFrom, $dateTo, $idRoom, $orderEdit) + { + $smartyVars = array(); + $objOrder = new Order($idOrder); + $smartyVars['orderCurrency'] = $objOrder->id_currency; + + $objBookingDemand = new HotelBookingDetail(); + $htlBookingDetail = $objBookingDemand->getRowByIdOrderIdProductInDateRange( + $idOrder, + $idProduct, + $dateFrom, + $dateTo, + $idRoom + ); + + $smartyVars['id_booking_detail'] = $htlBookingDetail['id']; + + $objBookingDemand = new HotelBookingDemands(); + + if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $idProduct, + $idRoom, + $dateFrom, + $dateTo + )) { + $smartyVars['extraDemands'] = $extraDemands; + } + + // if admin is editing order + if ($orderEdit) { + $smartyVars['orderEdit'] = $orderEdit; + + // get room type additional demands + $objRoomDemands = new HotelRoomTypeDemand(); + if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($idProduct)) { + foreach ($roomTypeDemands as &$demand) { + // if demand has advance options then set demand price as first advance option price. + if (isset($demand['adv_option']) && $demand['adv_option']) { + $demand['price'] = current($demand['adv_option'])['price']; + } + } + $smartyVars['roomTypeDemands'] = $roomTypeDemands; + } + } + $this->context->smarty->assign($smartyVars); + + $servicesTpl = $this->context->smarty->fetch( + _PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_room_facilities_block.tpl' + ); + return $servicesTpl; + } + + public function ajaxProcessUpdateRoomAdditionalServices() + { + $response = array('hasError' => false); + $id_room_type_service_product_order_detail = Tools::getValue('id_room_type_service_product_order_detail'); + $quantity = Tools::getValue('qty'); + + if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) { + $objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail); + if ($objOrderDetail->product_allow_multiple_quantity) { + if (!Validate::isUnsignedInt($quantity)) { + $response['hasError'] = true; + $response['errors'] = $this->l('Invalid quantity provided'); + } else { + $objRoomTypeServiceProductOrderDetail->quantity = $quantity; + $oldPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl; + $oldPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl; + $objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl * $quantity; + $objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl * $quantity; + $res = true; + if ($res &= $objRoomTypeServiceProductOrderDetail->save()) { + $order = new Order($objRoomTypeServiceProductOrderDetail->id_order); + $priceDiffTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl; + $priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl; + + $objOrderDetail->product_quantity = $quantity; + $objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl; + $objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl; + + $res &= $objOrderDetail->updateTaxAmount($order); + + $res &= $objOrderDetail->update(); + + $order->total_paid_tax_excl += $priceDiffTaxExcl; + $order->total_paid_tax_incl += $priceDiffTaxIncl; + $order->total_paid += $priceDiffTaxIncl; + + $res &= $order->update(); + } + } + if (!$res) { + $response['hasError'] = true; + $response['errors'] = $this->l('Error while updating service, please try refresing the page'); + } + } else { + $response['hasError'] = true; + $response['errors'] = $this->l('cannot order multiple quanitity for this service'); + } + $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail); + $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel( + $objOrderDetail->id_order, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room, + true + ); + } else { + $response['hasError'] = true; + $response['errors'] = $this->l('Additional service not found'); + } + + die(json_encode($response)); + } + + public function ajaxProcessDeleteRoomAdditionalService() + { + $response = array('hasError' => false); + $id_room_type_service_product_order_detail = Tools::getValue('id_room_type_service_product_order_detail'); + + if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) { + $objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail); + $priceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl; + $priceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl; + $quantity = $objRoomTypeServiceProductOrderDetail->quantity; + $res = true; + $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail); + + if ($res &= $objRoomTypeServiceProductOrderDetail->delete()) { + $order = new Order($objRoomTypeServiceProductOrderDetail->id_order); + if ($quantity >= $objOrderDetail->product_quantity) { + $objOrderDetail->delete(); + } else { + $objOrderDetail->product_quantity -= $quantity; + + $objOrderDetail->total_price_tax_excl -= $priceTaxExcl; + $objOrderDetail->total_price_tax_incl -= $priceTaxIncl; + + $res &= $objOrderDetail->updateTaxAmount($order); + + $res &= $objOrderDetail->update(); + } + + $order->total_paid_tax_excl -= $priceTaxExcl; + $order->total_paid_tax_incl -= $priceTaxIncl; + $order->total_paid += $priceTaxIncl; + + $res &= $order->update(); + } + if ($res) { + $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel( + $objOrderDetail->id_order, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room, + true + ); + } + } else { + $response['hasError'] = true; + $response['errors'] = $this->l('Additional service not found'); + } + + die(json_encode($response)); + } + + public function ajaxProcessAddRoomAdditionalServices() + { + $idBookingDetail = Tools::getValue('id_booking_detail'); + $response = array('hasError' => false); + if ($selectedServices = Tools::getValue('selected_service')) { + // valiadate services being added + if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail($idBookingDetail))) { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $qty = Tools::getValue('service_qty'); + foreach ($selectedServices as $key => $service) { + if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelBookingDetail->id_product, $service)) { + $objProduct = new Product($service, false, $this->context->language->id); + if ($objProduct->allow_multiple_quantity) { + if (!Validate::isUnsignedInt($qty[$service])) { + $response['hasError'] = true; + $response['errors'][] = sprintf($this->l('The quantity you\'ve entered is invalid for %s.'), $objProduct->name); + } + } else { + $qty[$service] = 1; + } + $selectedServices[$key] = array( + 'id' => $service, + 'qty' => $qty[$service], + 'name' => $objProduct->name, + ); + } else { + $response['hasError'] = true; + $response['errors'][] = sprintf($this->l('The service %s is not avaialable for current room.'), $objProduct->name); + } + } + + $objHotelCartBookingData = new HotelCartBookingData(); + $roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange( + $objHotelBookingDetail->id_cart, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room + ); + + // add services in room + if (!$response['hasError']) { + foreach ($selectedServices as $service) { + $order = new Order($objHotelBookingDetail->id_order); + + // Create new cart + $cart = new Cart(); + $cart->id_shop_group = $order->id_shop_group; + $cart->id_shop = $order->id_shop; + $cart->id_customer = $order->id_customer; + $cart->id_carrier = $order->id_carrier; + $cart->id_address_delivery = $order->id_address_delivery; + $cart->id_address_invoice = $order->id_address_invoice; + $cart->id_currency = $order->id_currency; + $cart->id_lang = $order->id_lang; + $cart->secure_key = $order->secure_key; + + // Save new cart + $cart->add(); + + $this->context->cart = $cart; + $this->context->customer = new Customer($order->id_customer); + + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + $objRoomTypeServiceProductCartDetail->addServiceProductInCart( + $service['id'], + $service['qty'], + $cart->id, + $roomHtlCartInfo['id'] + ); + $productList = $cart->getProducts(); + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $objHotelRoomType = new HotelRoomType(); + $roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($objHotelBookingDetail->id_product); + $totalPriceChangeTaxExcl = 0; + $totalPriceChangeTaxIncl = 0; + foreach ($productList as &$product) { + $totalPriceChangeTaxExcl += $totalPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice( + (int)$product['id_product'], + $roomInfo['id'], + $product['cart_quantity'], + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + false + ); + $totalPriceChangeTaxIncl += $totalPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice( + (int)$product['id_product'], + $roomInfo['id'], + $product['cart_quantity'], + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + true + ); + $unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice( + (int)$product['id_product'], + $roomInfo['id'], + 1, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + false + ); + $unitPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice( + (int)$product['id_product'], + $roomInfo['id'], + 1, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + true + ); + switch (Configuration::get('PS_ROUND_TYPE')) { + case Order::ROUND_TOTAL: + $product['total'] = $totalPriceTaxExcl; + $product['total_wt'] = $totalPriceTaxIncl; + break; + case Order::ROUND_LINE: + $product['total'] = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_); + $product['total_wt'] = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_); + break; + + case Order::ROUND_ITEM: + default: + $product['total'] = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$product['cart_quantity']; + $product['total_wt'] = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$product['cart_quantity']; + break; + } + + + } + + $order_detail = new OrderDetail(); + $order_detail->createList($order, $cart, $order->getCurrentOrderState(), $productList, (isset($order_invoice) ? $order_invoice->id : 0), true); + + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); + $objRoomTypeServiceProductOrderDetail->id_product = $product['id_product']; + $objRoomTypeServiceProductOrderDetail->id_order = $objHotelBookingDetail->id_order; + $objRoomTypeServiceProductOrderDetail->id_order_detail = $order_detail->id; + $objRoomTypeServiceProductOrderDetail->id_cart = $cart->id; + $objRoomTypeServiceProductOrderDetail->id_htl_booking_detail = $objHotelBookingDetail->id; + $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = $unitPriceTaxExcl; + $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = $unitPriceTaxIncl; + $objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $totalPriceTaxExcl; + $objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $totalPriceTaxIncl; + $objRoomTypeServiceProductOrderDetail->name = $product['name']; + $objRoomTypeServiceProductOrderDetail->quantity = $product['cart_quantity']; + $objRoomTypeServiceProductOrderDetail->save(); + + // update totals amount of order + $order->total_products += (float)$totalPriceChangeTaxExcl; + $order->total_products_wt += (float)$totalPriceChangeTaxIncl; + + $order->total_paid += Tools::ps_round((float)$totalPriceChangeTaxIncl, 2); + $order->total_paid_tax_excl += Tools::ps_round((float)($totalPriceChangeTaxExcl), 2); + $order->total_paid_tax_incl += Tools::ps_round((float)($totalPriceChangeTaxIncl), 2); + + if (isset($order_invoice) && Validate::isLoadedObject($order_invoice)) { + $order->total_shipping = $order_invoice->total_shipping_tax_incl; + $order->total_shipping_tax_incl = $order_invoice->total_shipping_tax_incl; + $order->total_shipping_tax_excl = $order_invoice->total_shipping_tax_excl; + } + + // discount + $order->total_discounts += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + $order->total_discounts_tax_excl += (float)abs($cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS)); + $order->total_discounts_tax_incl += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + // Save changes of order + $order->update(); + } + } + $response['service_panel'] = $servicesBlock = $this->processRenderServicesPanel( + $order->id, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room, + true + ); + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Room not found'); + } + } + + die(json_encode($response)); + } + + // Process when admin changes extra demands of any room while order creation process form.tpl + public function ajaxProcessChangeRoomDemands() + { + if ($idCartBooking = Tools::getValue('id_cart_booking')) { + if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) { + $roomDemands = Tools::getValue('room_demands'); + $roomDemands = json_decode($roomDemands, true); + $roomDemands = json_encode($roomDemands); + $objCartbookingCata->extra_demands = $roomDemands; + if ($objCartbookingCata->save()) { + die('1'); + } + } + } + die('0'); + } + // Process when admin edit rooms and edit rooms additional facilities public function ajaxProcessEditRoomExtraDemands() { + $response = array('success' => false); if ($idHtlBooking = Tools::getValue('id_htl_booking')) { if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail($idHtlBooking))) { $roomDemands = Tools::getValue('room_demands'); @@ -3607,18 +5280,28 @@ class AdminOrdersControllerCore extends AdminController $objBookingDemand->setBookingDemandTaxDetails(); } } - $order->save(); - - die('1'); + if ($order->save()) { + $response['facilities_panel'] = $this->processRenderFacilitiesBlock( + $order->id, + $objBookingDetail->id_product, + $objBookingDetail->date_from, + $objBookingDetail->date_to, + $objBookingDetail->id_room, + true + ); + $response['success'] = true; + } } } } - die('0'); + die(json_encode($response)); } // delete room extra demand while order edit public function ajaxProcessDeleteRoomExtraDemand() { + $response = array('success' => false); + $res = true; if ($idBookingDemand = Tools::getValue('id_booking_demand')) { if (Validate::isLoadedObject($objBookingDemand = new HotelBookingDemands($idBookingDemand))) { // first delete the tax details of the booking demand @@ -3641,13 +5324,80 @@ class AdminOrdersControllerCore extends AdminController $order_invoice->total_paid_tax_incl -= $objBookingDemand->total_price_tax_incl; $res &= $order_invoice->update(); } + if ($res) { + $response['facilities_panel'] = $this->processRenderFacilitiesBlock( + $order->id, + $objBookingDetail->id_product, + $objBookingDetail->date_from, + $objBookingDetail->date_to, + $objBookingDetail->id_room, + true + ); + $response['success'] = true; + } } - die('1'); } } } } - die('0'); + die(json_encode($response)); + } + + public function ajaxProcessUpdateServiceProduct() + { + $operator = Tools::getValue('operator', 'up'); + $idServiceProduct = Tools::getValue('id_product'); + $idCartBooking = Tools::getValue('id_cart_booking'); + $qty = Tools::getValue('qty'); + + if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + + if ($operator == 'up') { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelCartBookingData->id_product, $idServiceProduct)) { + // validate quanitity + if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) { + if ($objProduct->allow_multiple_quantity) { + if (!Validate::isUnsignedInt($qty)) { + $this->errors[] = Tools::displayError('The quantity code you\'ve entered is invalid.'); + // } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) { + // $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); + } + } else { + $qty = 1; + } + } else { + $this->errors[] = Tools::displayError('This Service is not available.'); + } + } else { + $this->errors[] = Tools::displayError('This Service is not available with selected room.'); + } + } + + if (empty($this->errors)) { + if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct( + $idCartBooking, + $idServiceProduct, + $qty, + $objHotelCartBookingData->id_cart, + $operator + )) { + $this->ajaxDie(json_encode(array( + 'hasError' => false + ))); + } else { + $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); + } + + } + } else { + $this->errors[] = Tools::displayError('Room not found. Please try reloading the page.'); + } + $this->ajaxDie(json_encode(array( + 'hasError' => true, + 'errors' => $this->errors + ))); } // To change the status of the room diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php index d57aa0d2e..1ea8b3f50 100644 --- a/controllers/admin/AdminPPreferencesController.php +++ b/controllers/admin/AdminPPreferencesController.php @@ -146,8 +146,8 @@ class AdminPPreferencesControllerCore extends AdminController 'cast' => 'intval', 'type' => 'select', 'list' => array( - array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')), - array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)')) + array('id' => HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')), + array('id' => HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)')) ), 'identifier' => 'id', ), @@ -181,8 +181,8 @@ class AdminPPreferencesControllerCore extends AdminController 'cast' => 'intval', 'type' => 'select', 'list' => array( - array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')), - array('id' => HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)')) + array('id' => HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY, 'name' => $this->l('Room Occupancy')), + array('id' => HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY, 'name' => $this->l('Rooms Quantity (No. of rooms)')) ), 'identifier' => 'id', ), @@ -298,6 +298,15 @@ class AdminPPreferencesControllerCore extends AdminController 'required' => false, 'type' => 'bool' ), + + 'PS_SERVICE_PRODUCT_CATEGORY_FILTER' => array( + 'title' => $this->l('Show category filter for service products'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'required' => false, + 'type' => 'bool' + ), + 'PS_HOTEL_IMAGES_PER_PAGE' => array( 'title' => $this->l('Number of hotel images per page'), 'hint' => $this->l('Number of hotel images displayed per page. Default is 9.'), @@ -433,11 +442,11 @@ class AdminPPreferencesControllerCore extends AdminController } if (Tools::getValue('PS_FRONT_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) { - $_POST['PS_FRONT_ROOM_UNIT_SELECTION_TYPE'] = HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY; + $_POST['PS_FRONT_ROOM_UNIT_SELECTION_TYPE'] = HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY; } if (Tools::getValue('PS_BACKOFFICE_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) { - $_POST['PS_BACKOFFICE_ROOM_BOOKING_TYPE'] = HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY; + $_POST['PS_BACKOFFICE_ROOM_BOOKING_TYPE'] = HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY; } if (Tools::getIsset('PS_CATALOG_MODE')) { diff --git a/controllers/admin/AdminPdfController.php b/controllers/admin/AdminPdfController.php index 9ec4f0e00..196555c9c 100644 --- a/controllers/admin/AdminPdfController.php +++ b/controllers/admin/AdminPdfController.php @@ -205,6 +205,7 @@ class AdminPdfControllerCore extends AdminController public function generatePDF($object, $template) { $pdf = new PDF($object, $template, Context::getContext()->smarty); - $pdf->render(); + // @todo remove "I" + $pdf->render("I"); } } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 1d4b293c3..88df3cd66 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -23,7 +23,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - /** * @property Product $object */ @@ -76,6 +75,7 @@ class AdminProductsControllerCore extends AdminController if (!Tools::getValue('id_product')) { $this->multishop_context_group = false; } + $this->context = Context::getContext(); // START send access query information to the admin controller @@ -93,49 +93,33 @@ class AdminProductsControllerCore extends AdminController $this->max_image_size = (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE'); $this->allow_export = true; - // @since 1.5 : translations for tabs $this->available_tabs_lang = array( 'Informations' => $this->l('Information'), - 'Pack' => $this->l('Pack'), - //'VirtualProduct' => $this->l('Virtual Product'), 'Prices' => $this->l('Prices'), 'Seo' => $this->l('SEO'), 'Images' => $this->l('Images'), + 'ServiceProduct' => $this->l('Service Products'), 'Associations' => $this->l('Associations'), - //'Shipping' => $this->l('Shipping'), - //'Combinations' => $this->l('Combinations'), 'Features' => $this->l('Features'), - //'Customization' => $this->l('Customization'), - //'Attachments' => $this->l('Attachments'), - //'Quantities' => $this->l('Quantities'), - //'Suppliers' => $this->l('Suppliers'), - 'Warehouses' => $this->l('Warehouses'), 'Configuration' => $this->l('Configuration'), 'Occupancy' => $this->l('Occupancy'), 'LengthOfStay' => $this->l('Length of Stay'), 'AdditionalFacilities' => $this->l('Additional Facilities'), ); - $this->available_tabs = array('Warehouses' => 14); if ($this->context->shop->getContext() != Shop::CONTEXT_GROUP) { $this->available_tabs = array_merge($this->available_tabs, array( 'Informations' => 0, - 'Pack' => 7, - //'VirtualProduct' => 8, 'Prices' => 1, 'Seo' => 2, 'Associations' => 3, - 'Images' => 9, - //'Shipping' => 4, - //'Combinations' => 5, - 'Features' => 10, - //'Customization' => 11, - //'Attachments' => 12, - //'Suppliers' => 13, - 'Configuration' => 14, - 'Occupancy' => 15, - 'LengthOfStay' => 16, - 'AdditionalFacilities' => 17, + 'Images' => 4, + 'Features' => 5, + 'Configuration' => 6, + 'Occupancy' => 7, + 'ServiceProduct' => 9, + 'LengthOfStay' => 10, + 'AdditionalFacilities' => 11, )); } @@ -148,8 +132,8 @@ class AdminProductsControllerCore extends AdminController foreach ($modules_list as $m) { // if module is setting name of the tab at the product edit page if (Validate::isLoadedObject($objModule = Module::getInstanceById($m['id_module']))) { - if (method_exists($objModule, 'moduleProductsExtraTabName')) { - $this->available_tabs_lang['Module'.ucfirst($m['module'])] = $objModule->moduleProductsExtraTabName(); + if (method_exists($objModule, 'moduleRoomTypeExtraTabName')) { + $this->available_tabs_lang['Module'.ucfirst($m['module'])] = $objModule->moduleRoomTypeExtraTabName(); } } // else set the display name of the product name as tab name @@ -209,7 +193,7 @@ class AdminProductsControllerCore extends AdminController LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_image` = image_shop.`id_image`) - LEFT JOIN `'._DB_PREFIX_.'product_download` pd ON (pd.`id_product` = a.`id_product` AND pd.`active` = 1) + LEFT JOIN `'._DB_PREFIX_.'product_download` pd ON (pd.`id_product` = a.`id_product` AND pd.`active` = 1) LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)'; $this->_select .= ' (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, '; @@ -221,6 +205,10 @@ class AdminProductsControllerCore extends AdminController $this->_join .= ' INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.') '; $this->_select .= ' , cp.`position`, '; } + + // show the list of the product according to the booking or service products + $this->_where .= ' AND a.`booking_product` = 1'; + $this->_use_found_rows = false; $this->_group = ''; @@ -342,6 +330,8 @@ class AdminProductsControllerCore extends AdminController $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-validate.js'); $this->addJs(__PS_BASE_URI__.'js/vendor/spin.js'); $this->addJs(__PS_BASE_URI__.'js/vendor/ladda.js'); + $this->addJS(_PS_JS_DIR_.'/datatable/jquery.dataTables.min.js'); + $this->addJS(_PS_JS_DIR_.'/datatable/dataTables.bootstrap.js'); } protected function _cleanMetaKeywords($keywords) @@ -506,7 +496,7 @@ class AdminProductsControllerCore extends AdminController public function ajaxProcessGetCategoryTree() { - $category = Tools::getValue('category', Category::getRootCategory()->id); + $category = Configuration::get('PS_LOCATIONS_CATEGORY'); $full_tree = Tools::getValue('fullTree', 0); $use_check_box = Tools::getValue('useCheckBox', 1); $selected = Tools::getValue('selected', array()); @@ -524,6 +514,16 @@ class AdminProductsControllerCore extends AdminController ->setNoJS(true) ->setRootCategory($category); + $tree->setTemplate('tree_associated_categories.tpl') + ->setHeaderTemplate('tree_associated_header.tpl') + ->setRootCategory(Configuration::get('PS_LOCATIONS_CATEGORY')) + ->setUseCheckBox(true) + ->setUseSearch(false) + ->setFullTree(0) + ->setSelectedCategories($selected) + ->setUseBulkActions(false) + ->setDisablAllCategories(true); + if ($input_name) { $tree->setInputName($input_name); } @@ -600,149 +600,6 @@ class AdminProductsControllerCore extends AdminController $this->tab_display = 'VirtualProduct'; } - public function ajaxProcessAddAttachment() - { - if ($this->tabAccess['edit'] === '0') { - return die(json_encode(array('error' => $this->l('You do not have the right permission')))); - } - if (isset($_FILES['attachment_file'])) { - if ((int)$_FILES['attachment_file']['error'] === 1) { - $_FILES['attachment_file']['error'] = array(); - - $max_upload = (int)ini_get('upload_max_filesize'); - $max_post = (int)ini_get('post_max_size'); - $upload_mb = min($max_upload, $max_post); - $_FILES['attachment_file']['error'][] = sprintf( - $this->l('File %1$s exceeds the size allowed by the server. The limit is set to %2$d MB.'), - ''.$_FILES['attachment_file']['name'].' ', - ''.$upload_mb.'' - ); - } - - $_FILES['attachment_file']['error'] = array(); - - $is_attachment_name_valid = false; - $attachment_names = Tools::getValue('attachment_name'); - $attachment_descriptions = Tools::getValue('attachment_description'); - - if (!isset($attachment_names) || !$attachment_names) { - $attachment_names = array(); - } - - if (!isset($attachment_descriptions) || !$attachment_descriptions) { - $attachment_descriptions = array(); - } - - foreach ($attachment_names as $lang => $name) { - $language = Language::getLanguage((int)$lang); - - if (Tools::strlen($name) > 0) { - $is_attachment_name_valid = true; - } - - if (!Validate::isGenericName($name)) { - $_FILES['attachment_file']['error'][] = sprintf(Tools::displayError('Invalid name for %s language'), $language['name']); - } elseif (Tools::strlen($name) > 32) { - $_FILES['attachment_file']['error'][] = sprintf(Tools::displayError('The name for %1s language is too long (%2d chars max).'), $language['name'], 32); - } - } - - foreach ($attachment_descriptions as $lang => $description) { - $language = Language::getLanguage((int)$lang); - - if (!Validate::isCleanHtml($description)) { - $_FILES['attachment_file']['error'][] = sprintf(Tools::displayError('Invalid description for %s language'), $language['name']); - } - } - - if (!$is_attachment_name_valid) { - $_FILES['attachment_file']['error'][] = Tools::displayError('An attachment name is required.'); - } - - if (empty($_FILES['attachment_file']['error'])) { - if (is_uploaded_file($_FILES['attachment_file']['tmp_name'])) { - if ($_FILES['attachment_file']['size'] > (Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 * 1024)) { - $_FILES['attachment_file']['error'][] = sprintf( - $this->l('The file is too large. Maximum size allowed is: %1$d kB. The file you are trying to upload is %2$d kB.'), - (Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024), - number_format(($_FILES['attachment_file']['size'] / 1024), 2, '.', '') - ); - } else { - do { - $uniqid = sha1(microtime()); - } while (file_exists(_PS_DOWNLOAD_DIR_.$uniqid)); - if (!copy($_FILES['attachment_file']['tmp_name'], _PS_DOWNLOAD_DIR_.$uniqid)) { - $_FILES['attachment_file']['error'][] = $this->l('File copy failed'); - } - @unlink($_FILES['attachment_file']['tmp_name']); - } - } else { - $_FILES['attachment_file']['error'][] = Tools::displayError('The file is missing.'); - } - - if (empty($_FILES['attachment_file']['error']) && isset($uniqid)) { - $attachment = new Attachment(); - - foreach ($attachment_names as $lang => $name) { - $attachment->name[(int)$lang] = $name; - } - - foreach ($attachment_descriptions as $lang => $description) { - $attachment->description[(int)$lang] = $description; - } - - $attachment->file = $uniqid; - $attachment->mime = $_FILES['attachment_file']['type']; - $attachment->file_name = $_FILES['attachment_file']['name']; - - if (empty($attachment->mime) || Tools::strlen($attachment->mime) > 128) { - $_FILES['attachment_file']['error'][] = Tools::displayError('Invalid file extension'); - } - if (!Validate::isGenericName($attachment->file_name)) { - $_FILES['attachment_file']['error'][] = Tools::displayError('Invalid file name'); - } - if (Tools::strlen($attachment->file_name) > 128) { - $_FILES['attachment_file']['error'][] = Tools::displayError('The file name is too long.'); - } - if (empty($this->errors)) { - $res = $attachment->add(); - if (!$res) { - $_FILES['attachment_file']['error'][] = Tools::displayError('This attachment was unable to be loaded into the database.'); - } else { - $_FILES['attachment_file']['id_attachment'] = $attachment->id; - $_FILES['attachment_file']['filename'] = $attachment->name[$this->context->employee->id_lang]; - $id_product = (int)Tools::getValue($this->identifier); - $res = $attachment->attachProduct($id_product); - if (!$res) { - $_FILES['attachment_file']['error'][] = Tools::displayError('We were unable to associate this attachment to a product.'); - } - } - } else { - $_FILES['attachment_file']['error'][] = Tools::displayError('Invalid file'); - } - } - } - - die(json_encode($_FILES)); - } - } - - /** - * Attach an existing attachment to the product - * - * @return void - */ - public function processAttachments() - { - if ($id = (int)Tools::getValue($this->identifier)) { - $attachments = trim(Tools::getValue('arrayAttachments'), ','); - $attachments = explode(',', $attachments); - if (!Attachment::attachToProduct($id, $attachments)) { - $this->errors[] = Tools::displayError('An error occurred while saving room type attachments.'); - } - } - } - public function processDuplicate() { if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { @@ -760,7 +617,6 @@ class AdminProductsControllerCore extends AdminController unset($product->id_product); $product->indexed = 0; $product->active = 0; - // suffix 'Duplicate' if same hotel $id_hotel_new = Tools::getValue('id_hotel'); $obj_hotel_room_type = new HotelRoomType(); @@ -978,146 +834,6 @@ class AdminProductsControllerCore extends AdminController } } - public function processProductAttribute() - { - // Don't process if the combination fields have not been submitted - if (!Combination::isFeatureActive() || !Tools::getValue('attribute_combination_list')) { - return; - } - - if (Validate::isLoadedObject($product = $this->object)) { - if ($this->isProductFieldUpdated('attribute_price') && (!Tools::getIsset('attribute_price') || Tools::getIsset('attribute_price') == null)) { - $this->errors[] = Tools::displayError('The price attribute is required.'); - } - if (!Tools::getIsset('attribute_combination_list') || Tools::isEmpty(Tools::getValue('attribute_combination_list'))) { - $this->errors[] = Tools::displayError('You must add at least one attribute.'); - } - - $array_checks = array( - 'reference' => 'isReference', - 'supplier_reference' => 'isReference', - 'location' => 'isReference', - 'ean13' => 'isEan13', - 'upc' => 'isUpc', - 'wholesale_price' => 'isPrice', - 'price' => 'isPrice', - 'ecotax' => 'isPrice', - 'quantity' => 'isInt', - 'weight' => 'isUnsignedFloat', - 'unit_price_impact' => 'isPrice', - 'default_on' => 'isBool', - 'minimal_quantity' => 'isUnsignedInt', - 'available_date' => 'isDateFormat' - ); - foreach ($array_checks as $property => $check) { - if (Tools::getValue('attribute_'.$property) !== false && !call_user_func(array('Validate', $check), Tools::getValue('attribute_'.$property))) { - $this->errors[] = sprintf(Tools::displayError('Field %s is not valid'), $property); - } - } - - if (!count($this->errors)) { - if (!isset($_POST['attribute_wholesale_price'])) { - $_POST['attribute_wholesale_price'] = 0; - } - if (!isset($_POST['attribute_price_impact'])) { - $_POST['attribute_price_impact'] = 0; - } - if (!isset($_POST['attribute_weight_impact'])) { - $_POST['attribute_weight_impact'] = 0; - } - if (!isset($_POST['attribute_ecotax'])) { - $_POST['attribute_ecotax'] = 0; - } - if (Tools::getValue('attribute_default')) { - $product->deleteDefaultAttributes(); - } - - // Change existing one - if (($id_product_attribute = (int)Tools::getValue('id_product_attribute')) || ($id_product_attribute = $product->productAttributeExists(Tools::getValue('attribute_combination_list'), false, null, true, true))) { - if ($this->tabAccess['edit'] === '1') { - if ($this->isProductFieldUpdated('available_date_attribute') && (Tools::getValue('available_date_attribute') != '' &&!Validate::isDateFormat(Tools::getValue('available_date_attribute')))) { - $this->errors[] = Tools::displayError('Invalid date format.'); - } else { - $product->updateAttribute((int)$id_product_attribute, - $this->isProductFieldUpdated('attribute_wholesale_price') ? Tools::getValue('attribute_wholesale_price') : null, - $this->isProductFieldUpdated('attribute_price_impact') ? Tools::getValue('attribute_price') * Tools::getValue('attribute_price_impact') : null, - $this->isProductFieldUpdated('attribute_weight_impact') ? Tools::getValue('attribute_weight') * Tools::getValue('attribute_weight_impact') : null, - $this->isProductFieldUpdated('attribute_unit_impact') ? Tools::getValue('attribute_unity') * Tools::getValue('attribute_unit_impact') : null, - $this->isProductFieldUpdated('attribute_ecotax') ? Tools::getValue('attribute_ecotax') : null, - Tools::getValue('id_image_attr'), - Tools::getValue('attribute_reference'), - Tools::getValue('attribute_ean13'), - $this->isProductFieldUpdated('attribute_default') ? Tools::getValue('attribute_default') : null, - Tools::getValue('attribute_location'), - Tools::getValue('attribute_upc'), - $this->isProductFieldUpdated('attribute_minimal_quantity') ? Tools::getValue('attribute_minimal_quantity') : null, - $this->isProductFieldUpdated('available_date_attribute') ? Tools::getValue('available_date_attribute') : null, false); - StockAvailable::setProductDependsOnStock((int)$product->id, $product->depends_on_stock, null, (int)$id_product_attribute); - StockAvailable::setProductOutOfStock((int)$product->id, $product->out_of_stock, null, (int)$id_product_attribute); - } - } else { - $this->errors[] = Tools::displayError('You do not have permission to add this.'); - } - } - // Add new - else { - if ($this->tabAccess['add'] === '1') { - if ($product->productAttributeExists(Tools::getValue('attribute_combination_list'))) { - $this->errors[] = Tools::displayError('This combination already exists.'); - } else { - $id_product_attribute = $product->addCombinationEntity( - Tools::getValue('attribute_wholesale_price'), - Tools::getValue('attribute_price') * Tools::getValue('attribute_price_impact'), - Tools::getValue('attribute_weight') * Tools::getValue('attribute_weight_impact'), - Tools::getValue('attribute_unity') * Tools::getValue('attribute_unit_impact'), - Tools::getValue('attribute_ecotax'), - 0, - Tools::getValue('id_image_attr'), - Tools::getValue('attribute_reference'), - null, - Tools::getValue('attribute_ean13'), - Tools::getValue('attribute_default'), - Tools::getValue('attribute_location'), - Tools::getValue('attribute_upc'), - Tools::getValue('attribute_minimal_quantity'), - array(), - Tools::getValue('available_date_attribute') - ); - StockAvailable::setProductDependsOnStock((int)$product->id, $product->depends_on_stock, null, (int)$id_product_attribute); - StockAvailable::setProductOutOfStock((int)$product->id, $product->out_of_stock, null, (int)$id_product_attribute); - } - } else { - $this->errors[] = Tools::displayError('You do not have permission to').'
    '.Tools::displayError('edit here.'); - } - } - if (!count($this->errors)) { - $combination = new Combination((int)$id_product_attribute); - $combination->setAttributes(Tools::getValue('attribute_combination_list')); - - // images could be deleted before - $id_images = Tools::getValue('id_image_attr'); - if (!empty($id_images)) { - $combination->setImages($id_images); - } - - $product->checkDefaultAttributes(); - if (Tools::getValue('attribute_default')) { - Product::updateDefaultAttribute((int)$product->id); - if (isset($id_product_attribute)) { - $product->cache_default_attribute = (int)$id_product_attribute; - } - - if ($available_date = Tools::getValue('available_date_attribute')) { - $product->setAvailableDate($available_date); - } else { - $product->setAvailableDate(); - } - } - } - } - } - } - public function processFeatures() { if (!Feature::isFeatureActive()) { @@ -1365,54 +1081,6 @@ class AdminProductsControllerCore extends AdminController } } - public function processCustomizationConfiguration() - { - $product = $this->object; - // Get the number of existing customization fields ($product->text_fields is the updated value, not the existing value) - $current_customization = $product->getCustomizationFieldIds(); - $files_count = 0; - $text_count = 0; - if (is_array($current_customization)) { - foreach ($current_customization as $field) { - if ($field['type'] == 1) { - $text_count++; - } else { - $files_count++; - } - } - } - - if (!$product->createLabels((int)$product->uploadable_files - $files_count, (int)$product->text_fields - $text_count)) { - $this->errors[] = Tools::displayError('An error occurred while creating customization fields.'); - } - if (!count($this->errors) && !$product->updateLabels()) { - $this->errors[] = Tools::displayError('An error occurred while updating customization fields.'); - } - $product->customizable = ($product->uploadable_files > 0 || $product->text_fields > 0) ? 1 : 0; - if (($product->uploadable_files != $files_count || $product->text_fields != $text_count) && !count($this->errors) && !$product->update()) { - $this->errors[] = Tools::displayError('An error occurred while updating the custom configuration.'); - } - } - - public function processProductCustomization() - { - if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { - foreach ($_POST as $field => $value) { - if (strncmp($field, 'label_', 6) == 0 && !Validate::isLabel($value)) { - $this->errors[] = Tools::displayError('The label fields defined are invalid.'); - } - } - if (empty($this->errors) && !$product->updateLabels()) { - $this->errors[] = Tools::displayError('An error occurred while updating customization fields.'); - } - if (empty($this->errors)) { - $this->confirmations[] = $this->l('Update successful'); - } - } else { - $this->errors[] = Tools::displayError('A room type must be created before adding customization.'); - } - } - /** * Overrides parent for custom redirect link */ @@ -1432,6 +1100,99 @@ class AdminProductsControllerCore extends AdminController $this->redirect_after = self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&action=Customization&conf=5'.(($id_category = (Tools::getIsset('id_category') ? (int)Tools::getValue('id_category') : '')) ? ('&id_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminProducts'); } } + public function ajaxProcessChangeServicePosition() + { + $response = array('success' => false); + $idElement = Tools::getValue('id_element'); + $idProduct = Tools::getValue('id_product'); + if ($idElement && $idProduct) { + $position = Tools::getValue('position'); + $toRowIndex = Tools::getValue('to_row_index'); + if (RoomTypeServiceProduct:: changePositions($idProduct, $idElement, $toRowIndex, $position)) { + $response['msg'] = $this->l('Updated Successfully'); + $response['success'] = true; + } + } + die(json_encode($response)); + } + + public function ajaxProcessUpdatedServiceProductPrice() + { + $response = array(); + if ($this->tabAccess['edit'] === '1') { + // process price update + $idProduct = Tools::getValue('id_product'); + $idServiceProduct = Tools::getValue('service_product_id'); + $idProductRoomtypePrice = Tools::getValue('id_room_type_service_product_price'); + $price = Tools::getValue('price'); + $id_tax_rules_group = Tools::getValue('id_tax_rules_group'); + + if (!$idProduct) { + $error = $this->l('Invalid room type.'); + } else { + $objRoomType = new HotelRoomType(); + if (!Product::isBookingProduct($idProduct)) { + $error = $this->l('Room Type details not found. Save room type details before updating price.'); + } + } + if (!$idServiceProduct) { + $error = $this->l('Service Product not found.'); + } + + if (!$price) { + $error = $this->l('Service product price must not be empty'); + } elseif (!Validate::isPrice($price)) { + $error = $this->l('Service product price is invalid'); + } + + if (!isset($error)) { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $priceExists = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( + $idServiceProduct, + $idProduct, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + ); + + if ($priceExists) { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice($priceExists['id_room_type_service_product_price']); + } else { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $objRoomTypeServiceProductPrice->id_product = $idServiceProduct; + $objRoomTypeServiceProductPrice->id_element = $idProduct; + $objRoomTypeServiceProductPrice->element_type = RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE; + } + + $objRoomTypeServiceProductPrice->price = $price; + $objRoomTypeServiceProductPrice->id_tax_rules_group = $id_tax_rules_group; + + if (!$objRoomTypeServiceProductPrice->save()) { + $error = $this->l('Unable to save price, please try again.'); + } else { + $response['price'] = Tools::DisplayPrice($price); + if (Validate::isLoadedObject($objTaxRuleGroup = new TaxRulesGroup( + $objRoomTypeServiceProductPrice->id_tax_rules_group, + $this->context->language->id + ))) { + $response['tax_rules_group_name'] = $objTaxRuleGroup->name; + } else { + $response['tax_rules_group_name'] = $this->l('No tax'); + } + } + } + } else { + $error = Tools::displayError('You do not have permission to edit this.'); + } + + if (isset($error)) { + $response['status'] = 'error'; + $response['message'] = $error; + } else { + $response['status'] = 'ok'; + $response['message'] = $this->l('Price Updated Successfully'); + } + + die(json_encode($response)); + } public function initProcess() { @@ -1629,103 +1390,6 @@ class AdminProductsControllerCore extends AdminController } } - public function ajaxProcessDeleteProductAttribute() - { - if (!Combination::isFeatureActive()) { - return; - } - - if ($this->tabAccess['delete'] === '1') { - $id_product = (int)Tools::getValue('id_product'); - $id_product_attribute = (int)Tools::getValue('id_product_attribute'); - - if ($id_product && Validate::isUnsignedId($id_product) && Validate::isLoadedObject($product = new Product($id_product))) { - if (($depends_on_stock = StockAvailable::dependsOnStock($id_product)) && StockAvailable::getQuantityAvailableByProduct($id_product, $id_product_attribute)) { - $json = array( - 'status' => 'error', - 'message'=> $this->l('It is not possible to delete a combination while it still has some quantities in the Advanced Stock Management. You must delete its stock first.') - ); - } else { - $product->deleteAttributeCombination((int)$id_product_attribute); - $product->checkDefaultAttributes(); - Tools::clearColorListCache((int)$product->id); - if (!$product->hasAttributes()) { - $product->cache_default_attribute = 0; - $product->update(); - } else { - Product::updateDefaultAttribute($id_product); - } - - if ($depends_on_stock && !Stock::deleteStockByIds($id_product, $id_product_attribute)) { - $json = array( - 'status' => 'error', - 'message'=> $this->l('Error while deleting the stock') - ); - } else { - $json = array( - 'status' => 'ok', - 'message'=> $this->_conf[1], - 'id_product_attribute' => (int)$id_product_attribute - ); - } - } - } else { - $json = array( - 'status' => 'error', - 'message'=> $this->l('You cannot delete this attribute.') - ); - } - } else { - $json = array( - 'status' => 'error', - 'message'=> $this->l('You do not have permission to delete this.') - ); - } - - die(json_encode($json)); - } - - public function ajaxProcessDefaultProductAttribute() - { - if ($this->tabAccess['edit'] === '1') { - if (!Combination::isFeatureActive()) { - return; - } - - if (Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { - $product->deleteDefaultAttributes(); - $product->setDefaultAttribute((int)Tools::getValue('id_product_attribute')); - $json = array( - 'status' => 'ok', - 'message'=> $this->_conf[4] - ); - } else { - $json = array( - 'status' => 'error', - 'message'=> $this->l('You cannot make this the default attribute.') - ); - } - - die(json_encode($json)); - } - } - - public function ajaxProcessEditProductAttribute() - { - if ($this->tabAccess['edit'] === '1') { - $id_product = (int)Tools::getValue('id_product'); - $id_product_attribute = (int)Tools::getValue('id_product_attribute'); - if ($id_product && Validate::isUnsignedId($id_product) && Validate::isLoadedObject($product = new Product((int)$id_product))) { - $combinations = $product->getAttributeCombinationsById($id_product_attribute, $this->context->language->id); - foreach ($combinations as $key => $combination) { - $combinations[$key]['attributes'][] = array($combination['group_name'], $combination['attribute_name'], $combination['id_attribute']); - } - - die(json_encode($combinations)); - } - } - } - public function ajaxPreProcess() { if (Tools::getIsset('update'.$this->table) && Tools::getIsset('id_'.$this->table)) { @@ -2012,20 +1676,18 @@ class AdminProductsControllerCore extends AdminController $this->object = new $this->className(); $this->_removeTaxFromEcotax(); $this->copyFromPost($this->object, $this->table); + $this->object->booking_product = true; if ($this->object->add()) { // associateroom type to hotel - $id_hotel = Tools::getValue('id_hotel'); - $objRoomType = new HotelRoomType(); - $objRoomType->id_product = $this->object->id; - $objRoomType->id_hotel = $id_hotel; - $objRoomType->save(); + // if ($this->object->is_virtual) { + + // } + + $this->assignRoomType($this->object); PrestaShopLogger::addLog(sprintf($this->l('%s addition', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id); - $this->addCarriers($this->object); - $this->updateAccessories($this->object); - $this->updatePackItems($this->object); - $this->updateDownloadProduct($this->object); + if (Configuration::get('PS_FORCE_ASM_NEW_PRODUCT') && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $this->object->getType() != Product::PTYPE_VIRTUAL) { $this->object->advanced_stock_management = 1; @@ -2193,13 +1855,13 @@ class AdminProductsControllerCore extends AdminController PrestaShopLogger::addLog(sprintf($this->l('%s modification', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int)$this->object->id, true, (int)$this->context->employee->id); if (in_array($this->context->shop->getContext(), array(Shop::CONTEXT_SHOP, Shop::CONTEXT_ALL))) { if ($this->isTabSubmitted('Shipping')) { - $this->addCarriers(); + // $this->addCarriers(); } if ($this->isTabSubmitted('Associations')) { - $this->updateAccessories($object); + // $this->updateAccessories($object); } if ($this->isTabSubmitted('Suppliers')) { - $this->processSuppliers(); + // $this->processSuppliers(); } if ($this->isTabSubmitted('Features')) { $this->processFeatures(); @@ -2234,12 +1896,12 @@ class AdminProductsControllerCore extends AdminController $this->processAdditionalFacilities(); } - $this->updatePackItems($object); + // $this->updatePackItems($object); // Disallow avanced stock management if the product become a pack if ($product_type_before == Product::PTYPE_SIMPLE && $object->getType() == Product::PTYPE_PACK) { StockAvailable::setProductDependsOnStock((int)$object->id, false); } - $this->updateDownloadProduct($object, 1); + // $this->updateDownloadProduct($object, 1); $this->updateTags(Language::getLanguages(false), $object); if ($this->isProductFieldUpdated('category_box') && !$object->updateCategories(Tools::getValue('categoryBox'))) { @@ -2419,22 +2081,30 @@ class AdminProductsControllerCore extends AdminController } } - $id_hotel = Tools::getValue('id_hotel'); - if (!$id_hotel || !Validate::isUnsignedInt($id_hotel)) { - $this->errors[] = Tools::displayError('Please select a hotel'); - } else if (!Validate::isLoadedObject($objHotel = new HotelBranchInformation($id_hotel))) { - $this->errors[] = Tools::displayError('Selected Hotel not found'); - } else { - $hotelIdCategory = $objHotel->id_category; - if (Validate::isLoadedObject($objCategory = new Category($hotelIdCategory))) { - foreach($objCategory->getParentsCategories() as $category) { - $_POST['categoryBox'][] = $category['id_category']; - } - if(!Tools::getValue('id_category_default')) { - $_POST['id_category_default'] = $hotelIdCategory; + // if (Tools::getValue('is_virtual')) { + $id_hotel = Tools::getValue('id_hotel'); + if (!$id_hotel || !Validate::isUnsignedInt($id_hotel)) { + $this->errors[] = Tools::displayError('Please select a hotel'); + } else if (!Validate::isLoadedObject($objHotel = new HotelBranchInformation($id_hotel))) { + $this->errors[] = Tools::displayError('Selected Hotel not found'); + } else { + $hotelIdCategory = $objHotel->id_category; + if (Validate::isLoadedObject($objCategory = new Category($hotelIdCategory))) { + foreach($objCategory->getParentsCategories() as $category) { + $_POST['categoryBox'][] = $category['id_category']; + } + if(!Tools::getValue('id_category_default')) { + $_POST['id_category_default'] = $hotelIdCategory; + } } } - } + // } else { + // $rootCategory = Category::getRootCategory(); + // $_POST['categoryBox'][] = $rootCategory->id_category; + // if(!Tools::getValue('id_category_default')) { + // $_POST['id_category_default'] = $rootCategory->id_category; + // } + // } // Categories if ($this->isProductFieldUpdated('id_category_default') && (!Tools::isSubmit('categoryBox') || !count(Tools::getValue('categoryBox')))) { @@ -2504,86 +2174,6 @@ class AdminProductsControllerCore extends AdminController } } - /** - * Update product download - * - * @param Product $product - * @param int $edit - * - * @return bool - */ - public function updateDownloadProduct($product, $edit = 0) - { - if ((int)Tools::getValue('is_virtual_file') == 1) { - if (isset($_FILES['virtual_product_file_uploader']) && $_FILES['virtual_product_file_uploader']['size'] > 0) { - $virtual_product_filename = ProductDownload::getNewFilename(); - $helper = new HelperUploader('virtual_product_file_uploader'); - $helper->setPostMaxSize(Tools::getOctets(ini_get('upload_max_filesize'))) - ->setSavePath(_PS_DOWNLOAD_DIR_)->upload($_FILES['virtual_product_file_uploader'], $virtual_product_filename); - } else { - $virtual_product_filename = Tools::getValue('virtual_product_filename', ProductDownload::getNewFilename()); - } - - $product->setDefaultAttribute(0);//reset cache_default_attribute - if (Tools::getValue('virtual_product_expiration_date') && !Validate::isDate(Tools::getValue('virtual_product_expiration_date'))) { - if (!Tools::getValue('virtual_product_expiration_date')) { - $this->errors[] = Tools::displayError('The expiration-date attribute is required.'); - return false; - } - } - - // Trick's - if ($edit == 1) { - $id_product_download = (int)ProductDownload::getIdFromIdProduct((int)$product->id, false); - if (!$id_product_download) { - $id_product_download = (int)Tools::getValue('virtual_product_id'); - } - } else { - $id_product_download = Tools::getValue('virtual_product_id'); - } - - $is_shareable = Tools::getValue('virtual_product_is_shareable'); - $virtual_product_name = Tools::getValue('virtual_product_name'); - $virtual_product_nb_days = Tools::getValue('virtual_product_nb_days'); - $virtual_product_nb_downloable = Tools::getValue('virtual_product_nb_downloable'); - $virtual_product_expiration_date = Tools::getValue('virtual_product_expiration_date'); - - $download = new ProductDownload((int)$id_product_download); - $download->id_product = (int)$product->id; - $download->display_filename = $virtual_product_name; - $download->filename = $virtual_product_filename; - $download->date_add = date('Y-m-d H:i:s'); - $download->date_expiration = $virtual_product_expiration_date ? $virtual_product_expiration_date.' 23:59:59' : ''; - $download->nb_days_accessible = (int)$virtual_product_nb_days; - $download->nb_downloadable = (int)$virtual_product_nb_downloable; - $download->active = 1; - $download->is_shareable = (int)$is_shareable; - if ($download->save()) { - return true; - } - } else { - /* unactive download product if checkbox not checked */ - if ($edit == 1) { - $id_product_download = (int)ProductDownload::getIdFromIdProduct((int)$product->id); - if (!$id_product_download) { - $id_product_download = (int)Tools::getValue('virtual_product_id'); - } - } else { - $id_product_download = ProductDownload::getIdFromIdProduct($product->id); - } - - if (!empty($id_product_download)) { - $product_download = new ProductDownload((int)$id_product_download); - $product_download->date_expiration = date('Y-m-d H:i:s', time() - 1); - $product_download->active = 0; - - return $product_download->save(); - } - } - - return false; - } - /** * Update product accessories * @@ -2646,6 +2236,12 @@ class AdminProductsControllerCore extends AdminController if ($this->ajax) { $this->content_only = true; } else { + if (($object = $this->loadObject(true)) && $object->isAssociatedToShop()) { + if (!$object->booking_product) { + $this->errors[] = $this->l('Room type not found.'); + return; + } + } $product_tabs = array(); // tab_display defines which tab to display first @@ -2688,11 +2284,12 @@ class AdminProductsControllerCore extends AdminController $this->tpl_list_vars['is_category_filter'] = (bool)$this->id_current_category; // Generate category selection tree - $tree = new HelperTreeCategories('categories-tree', $this->l('Filter by category')); + $catFilter = $this->l('Filter by Places'); + $tree = new HelperTreeCategories('categories-tree', $catFilter); $tree->setAttribute('is_category_filter', (bool)$this->id_current_category) ->setAttribute('base_url', preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex).'&token='.$this->token) ->setInputName('id-category') - ->setRootCategory(Category::getRootCategory()->id) + ->setRootCategory((int)Configuration::get('PS_LOCATIONS_CATEGORY')) ->setSelectedCategories(array((int)$id_category)); $this->tpl_list_vars['category_tree'] = $tree->render(); @@ -2730,7 +2327,7 @@ class AdminProductsControllerCore extends AdminController $helper->color = 'color2'; $helper->title = $this->l('Average Gross Margin %', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=product_avg_gross_margin'; - $helper->tooltip = $this->l('Gross margin expressed in percentage assesses how cost-effectively you sell your room types. Out of $100, you will retain $X to cover profit and expenses.', null, null, false); + $helper->tooltip = $this->l('Gross margin expressed in percentage assesses how cost-effectively you sell your room types / products. Out of $100, you will retain $X to cover profit and expenses.', null, null, false); $kpis[] = $helper->generate(); $helper = new HelperKpi(); @@ -2752,8 +2349,12 @@ class AdminProductsControllerCore extends AdminController $helper->color = 'color4'; $helper->href = $this->context->link->getAdminLink('AdminProducts'); $helper->title = $this->l('Disabled Room Types', null, null, false); - $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_products'; - $helper->tooltip = $this->l('X% of your room types are disabled and not visible to your customers.', null, null, false); + if (ConfigurationKPI::get('DISABLED_ROOM_TYPES') !== false) { + $helper->value = ConfigurationKPI::get('DISABLED_ROOM_TYPES'); + } + $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_room_types'; + $helper->refresh = (bool)(ConfigurationKPI::get('DISABLED_ROOM_TYPES_EXPIRE') < $time); + $helper->tooltip = $this->l('X% of your room types are disabled and not visible to your customers', null, null, false); $helper->href = Context::getContext()->link->getAdminLink('AdminProducts').'&productFilter_active=0&submitFilterproduct=1'; $kpis[] = $helper->generate(); @@ -2777,21 +2378,6 @@ class AdminProductsControllerCore extends AdminController onclick="initDuplicateRoomType('.(int)$id.');return false;">'.$this->l('Duplicate').''; } - public function ajaxProcessProductManufacturers() - { - $manufacturers = Manufacturer::getManufacturers(false, 0, true, false, false, false, true); - $jsonArray = array(); - - if ($manufacturers) { - foreach ($manufacturers as $manufacturer) { - $tmp = array("optionValue" => $manufacturer['id_manufacturer'], "optionDisplay" => htmlspecialchars(trim($manufacturer['name']))); - $jsonArray[] = json_encode($tmp); - } - } - - die('['.implode(',', $jsonArray).']'); - } - /** * Build a categories tree * @@ -2869,6 +2455,7 @@ class AdminProductsControllerCore extends AdminController if (empty($this->display)) { $this->page_header_toolbar_btn['new_product'] = array( 'href' => self::$currentIndex.'&addproduct&token='.$this->token, + // 'desc' => $this->l('Add new room type', null, null, false), 'desc' => $this->l('Add new room type', null, null, false), 'icon' => 'process-icon-new' ); @@ -2887,7 +2474,6 @@ class AdminProductsControllerCore extends AdminController } $js = 'initDuplicateRoomType('.(int)$product->id.');return false;'; - // adding button for duplicate this product if ($this->tabAccess['add']) { $this->page_header_toolbar_btn['duplicate'] = array( @@ -3005,6 +2591,7 @@ class AdminProductsControllerCore extends AdminController $this->getLanguages(); $this->tpl_form_vars['id_lang_default'] = Configuration::get('PS_LANG_DEFAULT'); + $this->tpl_form_vars['currency'] = $this->context->currency; $this->tpl_form_vars['currentIndex'] = self::$currentIndex; $this->tpl_form_vars['display_multishop_checkboxes'] = (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP && $this->display == 'edit'); @@ -3019,6 +2606,16 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['mod_security'] = Tools::apacheModExists('security'); $this->tpl_form_vars['ps_force_friendly_product'] = Configuration::get('PS_FORCE_FRIENDLY_PRODUCT'); + // add text for normal product and booking product + $this->tpl_form_vars['booking_product_text'] = array( + 'name'=> $this->l('Room Type'), + 'name_title'=> $this->l('Write the name of the Room Type for ex. Delux, Executive etc. Invalid characters <>;=#{}') + ); + $this->tpl_form_vars['normal_product_text'] = array( + 'name'=> $this->l('Name'), + 'name_title'=> $this->l('Write the name of the Product for ex. water bottle, etc. Invalid characters <>;=#{}') + ); + // autoload rich text editor (tiny mce) $this->tpl_form_vars['tinymce'] = true; $iso = $this->context->language->iso_code; @@ -3074,7 +2671,7 @@ class AdminProductsControllerCore extends AdminController $this->copyFromPost($this->object, $this->table); } - $this->initPack($this->object); + // $this->initPack($this->object); $this->{'initForm'.$this->tab_display}($this->object); $this->tpl_form_vars['product'] = $this->object; @@ -3121,237 +2718,20 @@ class AdminProductsControllerCore extends AdminController return $preview_url; } - /** - * Post treatment for suppliers - */ - public function processSuppliers() - { - if ((int)Tools::getValue('supplier_loaded') === 1 && Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { - // Get all id_product_attribute - $attributes = $product->getAttributesResume($this->context->language->id); - if (empty($attributes)) { - $attributes[] = array( - 'id_product_attribute' => 0, - 'attribute_designation' => '' - ); - } - // Get all available suppliers - $suppliers = Supplier::getSuppliers(); + protected function assignRoomType($product) { - // Get already associated suppliers - $associated_suppliers = ProductSupplier::getSupplierCollection($product->id); - - $suppliers_to_associate = array(); - $new_default_supplier = 0; - - if (Tools::isSubmit('default_supplier')) { - $new_default_supplier = (int)Tools::getValue('default_supplier'); - } - - // Get new associations - foreach ($suppliers as $supplier) { - if (Tools::isSubmit('check_supplier_'.$supplier['id_supplier'])) { - $suppliers_to_associate[] = $supplier['id_supplier']; - } - } - - // Delete already associated suppliers if needed - foreach ($associated_suppliers as $key => $associated_supplier) { - /** @var ProductSupplier $associated_supplier */ - if (!in_array($associated_supplier->id_supplier, $suppliers_to_associate)) { - $associated_supplier->delete(); - unset($associated_suppliers[$key]); - } - } - - // Associate suppliers - foreach ($suppliers_to_associate as $id) { - $to_add = true; - foreach ($associated_suppliers as $as) { - /** @var ProductSupplier $as */ - if ($id == $as->id_supplier) { - $to_add = false; - } - } - - if ($to_add) { - $product_supplier = new ProductSupplier(); - $product_supplier->id_product = $product->id; - $product_supplier->id_product_attribute = 0; - $product_supplier->id_supplier = $id; - if ($this->context->currency->id) { - $product_supplier->id_currency = (int)$this->context->currency->id; - } else { - $product_supplier->id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT'); - } - $product_supplier->save(); - - $associated_suppliers[] = $product_supplier; - foreach ($attributes as $attribute) { - if ((int)$attribute['id_product_attribute'] > 0) { - $product_supplier = new ProductSupplier(); - $product_supplier->id_product = $product->id; - $product_supplier->id_product_attribute = (int)$attribute['id_product_attribute']; - $product_supplier->id_supplier = $id; - $product_supplier->save(); - } - } - } - } - - // Manage references and prices - foreach ($attributes as $attribute) { - foreach ($associated_suppliers as $supplier) { - /** @var ProductSupplier $supplier */ - if (Tools::isSubmit('supplier_reference_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier) || - (Tools::isSubmit('product_price_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier) && - Tools::isSubmit('product_price_currency_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier))) { - $reference = pSQL( - Tools::getValue( - 'supplier_reference_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier, - '' - ) - ); - - $price = (float)str_replace( - array(' ', ','), - array('', '.'), - Tools::getValue( - 'product_price_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier, - 0 - ) - ); - - $price = Tools::ps_round($price, 6); - - $id_currency = (int)Tools::getValue( - 'product_price_currency_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier, - 0 - ); - - if ($id_currency <= 0 || (!($result = Currency::getCurrency($id_currency)) || empty($result))) { - $this->errors[] = Tools::displayError('The selected currency is not valid'); - } - - // Save product-supplier data - $product_supplier_id = (int)ProductSupplier::getIdByProductAndSupplier($product->id, $attribute['id_product_attribute'], $supplier->id_supplier); - - if (!$product_supplier_id) { - $product->addSupplierReference($supplier->id_supplier, (int)$attribute['id_product_attribute'], $reference, (float)$price, (int)$id_currency); - if ($product->id_supplier == $supplier->id_supplier) { - if ((int)$attribute['id_product_attribute'] > 0) { - $data = array( - 'supplier_reference' => pSQL($reference), - 'wholesale_price' => (float)Tools::convertPrice($price, $id_currency) - ); - $where = ' - a.id_product = '.(int)$product->id.' - AND a.id_product_attribute = '.(int)$attribute['id_product_attribute']; - ObjectModel::updateMultishopTable('Combination', $data, $where); - } else { - $product->wholesale_price = (float)Tools::convertPrice($price, $id_currency); //converted in the default currency - $product->supplier_reference = pSQL($reference); - $product->update(); - } - } - } else { - $product_supplier = new ProductSupplier($product_supplier_id); - $product_supplier->id_currency = (int)$id_currency; - $product_supplier->product_supplier_price_te = (float)$price; - $product_supplier->product_supplier_reference = pSQL($reference); - $product_supplier->update(); - } - } elseif (Tools::isSubmit('supplier_reference_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier)) { - //int attribute with default values if possible - if ((int)$attribute['id_product_attribute'] > 0) { - $product_supplier = new ProductSupplier(); - $product_supplier->id_product = $product->id; - $product_supplier->id_product_attribute = (int)$attribute['id_product_attribute']; - $product_supplier->id_supplier = $supplier->id_supplier; - $product_supplier->save(); - } - } - } - } - // Manage defaut supplier for product - if ($new_default_supplier != $product->id_supplier) { - $this->object->id_supplier = $new_default_supplier; - $this->object->update(); - } + if (!isset($product)) { + $product = new Product((int)Tools::getValue('id_product')); } - } - /** - * Post treatment for warehouses - */ - public function processWarehouses() - { - if ((int)Tools::getValue('warehouse_loaded') === 1 && Validate::isLoadedObject($product = new Product((int)$id_product = Tools::getValue('id_product')))) { - // Get all id_product_attribute - $attributes = $product->getAttributesResume($this->context->language->id); - if (empty($attributes)) { - $attributes[] = array( - 'id_product_attribute' => 0, - 'attribute_designation' => '' - ); + if (Validate::isLoadedObject($product)) { + if ($id_hotel = Tools::getValue('id_hotel')) { + $objRoomType = new HotelRoomType(); + $objRoomType->id_product = $product->id; + $objRoomType->id_hotel = $id_hotel; + $objRoomType->save(); } - - // Get all available warehouses - $warehouses = Warehouse::getWarehouses(true); - - // Get already associated warehouses - $associated_warehouses_collection = WarehouseProductLocation::getCollection($product->id); - - $elements_to_manage = array(); - - // get form inforamtion - foreach ($attributes as $attribute) { - foreach ($warehouses as $warehouse) { - $key = $warehouse['id_warehouse'].'_'.$product->id.'_'.$attribute['id_product_attribute']; - - // get elements to manage - if (Tools::isSubmit('check_warehouse_'.$key)) { - $location = Tools::getValue('location_warehouse_'.$key, ''); - $elements_to_manage[$key] = $location; - } - } - } - - // Delete entry if necessary - foreach ($associated_warehouses_collection as $awc) { - /** @var WarehouseProductLocation $awc */ - if (!array_key_exists($awc->id_warehouse.'_'.$awc->id_product.'_'.$awc->id_product_attribute, $elements_to_manage)) { - $awc->delete(); - } - } - - // Manage locations - foreach ($elements_to_manage as $key => $location) { - $params = explode('_', $key); - - $wpl_id = (int)WarehouseProductLocation::getIdByProductAndWarehouse((int)$params[1], (int)$params[2], (int)$params[0]); - - if (empty($wpl_id)) { - //create new record - $warehouse_location_entity = new WarehouseProductLocation(); - $warehouse_location_entity->id_product = (int)$params[1]; - $warehouse_location_entity->id_product_attribute = (int)$params[2]; - $warehouse_location_entity->id_warehouse = (int)$params[0]; - $warehouse_location_entity->location = pSQL($location); - $warehouse_location_entity->save(); - } else { - $warehouse_location_entity = new WarehouseProductLocation((int)$wpl_id); - - $location = pSQL($location); - - if ($location != $warehouse_location_entity->location) { - $warehouse_location_entity->location = pSQL($location); - $warehouse_location_entity->update(); - } - } - } - StockAvailable::synchronize((int)$id_product); } } @@ -3398,8 +2778,6 @@ class AdminProductsControllerCore extends AdminController 'product' => $obj, 'htl_info' => $hotelInfo, 'rm_status' => $roomStatus, - 'datesMissing' => $this->l('Some dates are missing. Please select all the date ranges.'), - 'datesOverlapping' => $this->l('Some dates are conflicting with each other. Please check and reselect the date ranges.'), ) ); } else { @@ -3415,6 +2793,100 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['custom_form'] = $data->fetch(); } + public function initFormServiceProduct($obj) + { + $data = $this->createTemplate($this->tpl_form); + if ($obj->id) { + + $address = new Address(); + $address->id_country = (int)$this->context->country->id; + $tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true); + $tax_rates = array( + 0 => array( + 'id_tax_rules_group' => 0, + 'rates' => array(0), + 'computation_method' => 0 + ) + ); + + foreach ($tax_rules_groups as $tax_rules_group) { + $id_tax_rules_group = (int)$tax_rules_group['id_tax_rules_group']; + $tax_calculator = TaxManagerFactory::getManager($address, $id_tax_rules_group)->getTaxCalculator(); + $tax_rates[$id_tax_rules_group] = array( + 'id_tax_rules_group' => $id_tax_rules_group, + 'rates' => array(), + 'computation_method' => (int)$tax_calculator->computation_method + ); + + if (isset($tax_calculator->taxes) && count($tax_calculator->taxes)) { + foreach ($tax_calculator->taxes as $tax) { + $tax_rates[$id_tax_rules_group]['rates'][] = (float)$tax->rate; + } + } else { + $tax_rates[$id_tax_rules_group]['rates'][] = 0; + } + } + + $objRoomType = new HotelRoomType(); + if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($obj->id)) { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $serviceProducts = $objRoomTypeServiceProduct->getProductsForRoomType( + $obj->id + ); + foreach ($serviceProducts as &$serviceProduct) { + $product = new Product($serviceProduct['id_product'], false, $this->context->language->id); + $serviceProductPriceInfo = $objRoomTypeServiceProductPrice->getProductRoomTypeLinkPriceInfo( + $product->id, + $obj->id, + RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE + ); + $serviceProduct['id_product'] = $product->id; + $serviceProduct['name'] = $product->name; + $serviceProduct['auto_add_to_cart'] = $product->auto_add_to_cart; + $serviceProduct['category'] = $product->category; + $serviceProduct['default_price'] = $product->price; + $serviceProduct['id_tax_rules_group'] = $product->id_tax_rules_group; + if ($serviceProductPriceInfo) { + $serviceProduct['custom_price'] = $serviceProductPriceInfo['price']; + $serviceProduct['id_tax_rules_group'] = $serviceProductPriceInfo['id_tax_rules_group']; + if ($serviceProductPriceInfo['id_tax_rules_group'] == 0) { + $serviceProduct['tax_rules_group_name'] = 'No tax'; + } else { + $objTaxRuleGroup = new TaxRulesGroup( + $serviceProductPriceInfo['id_tax_rules_group'], + $this->context->language->id + ); + $serviceProduct['tax_rules_group_name'] = $objTaxRuleGroup->name; + } + $serviceProduct['id_room_type_service_product_price'] = $serviceProductPriceInfo['id_room_type_service_product_price']; + } + + if ($product->id_tax_rules_group == 0) { + $serviceProduct['default_tax_rules_group_name'] = 'No tax'; + } else { + $objTaxRuleGroup = new TaxRulesGroup( + $product->id_tax_rules_group, + $this->context->language->id + ); + $serviceProduct['default_tax_rules_group_name'] = $objTaxRuleGroup->name; + } + } + $data->assign(array( + 'product' => $obj, + 'currency' => $this->context->currency, + 'service_products' => $serviceProducts, + 'tax_rules_groups' => $tax_rules_groups, + 'taxesRatesByGroup' => $tax_rates, + )); + } + } else { + $this->displayWarning($this->l('You must save this room type before managing Service Products.')); + } + + $this->tpl_form_vars['custom_form'] = $data->fetch(); + } + // send information for the occupancy tab public function initFormOccupancy($obj) { @@ -3643,7 +3115,7 @@ class AdminProductsControllerCore extends AdminController } } - public function validateDisableDateRanges($disableDates, $index) + public function validateDisableDateRanges($disableDates, $index, $idRoom) { if (count($disableDates)) { foreach ($disableDates as $disable_key => $disableDate) { @@ -3660,6 +3132,7 @@ class AdminProductsControllerCore extends AdminController $index ); } else { + $objHotelBookingDetail = new HotelBookingDetail(); foreach ($disableDates as $key => $disDate) { if ($key != $disable_key) { if ((($disableDate['date_from'] < $disDate['date_from']) && ($disableDate['date_to'] <= $disDate['date_from'])) || (($disableDate['date_from'] > $disDate['date_from']) && ($disableDate['date_from'] >= $disDate['date_to']))) { @@ -3671,6 +3144,13 @@ class AdminProductsControllerCore extends AdminController ); } } + // check if room has booking for current date range + if ($objHotelBookingDetail->chechRoomBooked($idRoom, $disDate['date_from'], $disDate['date_to'])) { + $this->errors[] = sprintf( + Tools::displayError('The %s room already has bookings for selected disable dates. Please reselect disable dates.'), + $index + ); + } } } } @@ -3768,7 +3248,7 @@ class AdminProductsControllerCore extends AdminController if ($roomInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) { $disableDates = json_decode($roomInfo['disable_dates_json'], true); if ($roomInfo['disable_dates_json'] !== 0) { - $this->validateDisableDateRanges($disableDates, $index); + $this->validateDisableDateRanges($disableDates, $index, $roomInfo['id']); } } } @@ -3796,15 +3276,26 @@ class AdminProductsControllerCore extends AdminController if ($obj->id) { $objGlobalDemand = new HotelRoomTypeGlobalDemand(); $allDemands = $objGlobalDemand->getAllDemands(); + foreach($allDemands as &$demand) { + if ($demand['id_tax_rules_group'] == 0) { + $demand['default_tax_rules_group_name'] = 'No tax'; + } else { + $objTaxRuleGroup = new TaxRulesGroup( + $demand['id_tax_rules_group'], + $this->context->language->id + ); + $demand['default_tax_rules_group_name'] = $objTaxRuleGroup->name; + } + } $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); // get room type additional facilities $objRoomDemand = new HotelRoomTypeDemand(); - $roomDemandPrices = $objRoomDemand->getRoomTypeDemands($obj->id, 0, 0); + $selectedDemands = $objRoomDemand->getRoomTypeDemands($obj->id, 0, 0); $data->assign(array( 'product' => $obj, - 'roomDemandPrices' => $roomDemandPrices, + 'selectedDemands' => $selectedDemands, 'allDemands' => $allDemands, 'defaultcurrencySign' => $objCurrency->sign, )); @@ -3965,7 +3456,7 @@ class AdminProductsControllerCore extends AdminController $tree = new HelperTreeCategories('associated-categories-tree', 'Associated categories'); $tree->setTemplate('tree_associated_categories.tpl') ->setHeaderTemplate('tree_associated_header.tpl') - ->setRootCategory((int)$root->id) + ->setRootCategory(Configuration::get('PS_LOCATIONS_CATEGORY')) ->setUseCheckBox(true) ->setUseSearch(false) ->setFullTree(0) @@ -4050,14 +3541,15 @@ class AdminProductsControllerCore extends AdminController } $address = new Address(); - // $address->id_country = (int)$this->context->country->id; - if (!$address_infos) { + // $address->id_country = (int)$this->context->country->id; + if (!$address_infos) { $address->id_country = (int)$this->context->country->id; } else { $address->id_country = (int)$address_infos['id_country']; $address->id_state = (int)$address_infos['id_state']; $address->zipcode = $address_infos['postcode']; } + $tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true); $tax_rates = array( 0 => array( @@ -4166,158 +3658,6 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['custom_form'] = $data->fetch(); } - /** - * Get an array of pack items for display from the product object if specified, else from POST/GET values - * - * @param Product $product - * @return array of pack items - */ - public function getPackItems($product = null) - { - $pack_items = array(); - - if (!$product) { - $names_input = Tools::getValue('namePackItems'); - $ids_input = Tools::getValue('inputPackItems'); - if (!$names_input || !$ids_input) { - return array(); - } - // ids is an array of string with format : QTYxID - $ids = array_unique(explode('-', $ids_input)); - $names = array_unique(explode('¤', $names_input)); - - if (!empty($ids)) { - $length = count($ids); - for ($i = 0; $i < $length; $i++) { - if (!empty($ids[$i]) && !empty($names[$i])) { - list($pack_items[$i]['pack_quantity'], $pack_items[$i]['id']) = explode('x', $ids[$i]); - $exploded_name = explode('x', $names[$i]); - $pack_items[$i]['name'] = $exploded_name[1]; - } - } - } - } else { - $i = 0; - foreach ($product->packItems as $pack_item) { - $pack_items[$i]['id'] = $pack_item->id; - $pack_items[$i]['pack_quantity'] = $pack_item->pack_quantity; - $pack_items[$i]['name'] = $pack_item->name; - $pack_items[$i]['reference'] = $pack_item->reference; - $pack_items[$i]['id_product_attribute'] = isset($pack_item->id_pack_product_attribute) && $pack_item->id_pack_product_attribute ? $pack_item->id_pack_product_attribute : 0; - $cover = $pack_item->id_pack_product_attribute ? Product::getCombinationImageById($pack_item->id_pack_product_attribute, Context::getContext()->language->id) : Product::getCover($pack_item->id); - $pack_items[$i]['image'] = Context::getContext()->link->getImageLink($pack_item->link_rewrite, $cover['id_image'], 'home_default'); - // @todo: don't rely on 'home_default' - //$path_to_image = _PS_IMG_DIR_.'p/'.Image::getImgFolderStatic($cover['id_image']).(int)$cover['id_image'].'.jpg'; - //$pack_items[$i]['image'] = ImageManager::thumbnail($path_to_image, 'pack_mini_'.$pack_item->id.'_'.$this->context->shop->id.'.jpg', 120); - $i++; - } - } - return $pack_items; - } - - /** - * @param Product $product - * @throws Exception - * @throws SmartyException - */ - public function initFormPack($product) - { - $data = $this->createTemplate($this->tpl_form); - - // If pack items have been submitted, we want to display them instead of the actuel content of the pack - // in database. In case of a submit error, the posted data is not lost and can be sent again. - if (Tools::getValue('namePackItems')) { - $input_pack_items = Tools::getValue('inputPackItems'); - $input_namepack_items = Tools::getValue('namePackItems'); - $pack_items = $this->getPackItems(); - } else { - $product->packItems = Pack::getItems($product->id, $this->context->language->id); - $pack_items = $this->getPackItems($product); - $input_namepack_items = ''; - $input_pack_items = ''; - foreach ($pack_items as $pack_item) { - $input_pack_items .= $pack_item['pack_quantity'].'x'.$pack_item['id'].'x'.$pack_item['id_product_attribute'].'-'; - $input_namepack_items .= $pack_item['pack_quantity'].' x '.$pack_item['name'].'¤'; - } - } - - $data->assign(array( - 'input_pack_items' => $input_pack_items, - 'input_namepack_items' => $input_namepack_items, - 'pack_items' => $pack_items, - 'product_type' => (int)Tools::getValue('type_product', $product->getType()) - )); - - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - - public function initFormVirtualProduct($product) - { - $data = $this->createTemplate($this->tpl_form); - - $currency = $this->context->currency; - - /* - * Form for adding a virtual product like software, mp3, etc... - */ - $product_download = new ProductDownload(); - if ($id_product_download = $product_download->getIdFromIdProduct($this->getFieldValue($product, 'id'))) { - $product_download = new ProductDownload($id_product_download); - } - $product->{'productDownload'} = $product_download; - - if ($product->productDownload->id && empty($product->productDownload->display_filename)) { - $this->errors[] = Tools::displayError('A file name is required in order to associate a file'); - $this->tab_display = 'VirtualProduct'; - } - - // @todo handle is_virtual with the value of the product - $exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$product->productDownload->filename; - $data->assign('product_downloaded', $product->productDownload->id); - - if (!file_exists($exists_file) - && !empty($product->productDownload->display_filename) - && empty($product->cache_default_attribute)) { - $msg = sprintf(Tools::displayError('File "%s" is missing'), - $product->productDownload->display_filename); - } else { - $msg = ''; - } - - $virtual_product_file_uploader = new HelperUploader('virtual_product_file_uploader'); - $virtual_product_file_uploader->setMultiple(false)->setUrl( - Context::getContext()->link->getAdminLink('AdminProducts').'&ajax=1&id_product='.(int)$product->id - .'&action=AddVirtualProductFile')->setPostMaxSize(Tools::getOctets(ini_get('upload_max_filesize'))) - ->setTemplate('virtual_product.tpl'); - - $data->assign(array( - 'download_product_file_missing' => $msg, - 'download_dir_writable' => ProductDownload::checkWritableDir(), - 'up_filename' => strval(Tools::getValue('virtual_product_filename')) - )); - - $product->productDownload->nb_downloadable = ($product->productDownload->id > 0) ? $product->productDownload->nb_downloadable : htmlentities(Tools::getValue('virtual_product_nb_downloable'), ENT_COMPAT, 'UTF-8'); - $product->productDownload->date_expiration = ($product->productDownload->id > 0) ? ((!empty($product->productDownload->date_expiration) && $product->productDownload->date_expiration != '0000-00-00 00:00:00') ? date('Y-m-d', strtotime($product->productDownload->date_expiration)) : '') : htmlentities(Tools::getValue('virtual_product_expiration_date'), ENT_COMPAT, 'UTF-8'); - $product->productDownload->nb_days_accessible = ($product->productDownload->id > 0) ? $product->productDownload->nb_days_accessible : htmlentities(Tools::getValue('virtual_product_nb_days'), ENT_COMPAT, 'UTF-8'); - $product->productDownload->is_shareable = $product->productDownload->id > 0 && $product->productDownload->is_shareable; - - $iso_tiny_mce = $this->context->language->iso_code; - $iso_tiny_mce = (file_exists(_PS_JS_DIR_.'tiny_mce/langs/'.$iso_tiny_mce.'.js') ? $iso_tiny_mce : 'en'); - $data->assign(array( - 'ad' => __PS_BASE_URI__.basename(_PS_ADMIN_DIR_), - 'iso_tiny_mce' => $iso_tiny_mce, - 'product' => $product, - 'token' => $this->token, - 'currency' => $currency, - 'link' => $this->context->link, - 'is_file' => $product->productDownload->checkFile(), - 'virtual_product_file_uploader' => $virtual_product_file_uploader->render() - )); - $data->assign($this->tpl_form_vars); - $this->tpl_form_vars['product'] = $product; - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - protected function _getFinalPrice($specific_price, $product_price, $tax_rate) { return $this->object->getPrice(false, $specific_price['id_product_attribute'], 2); @@ -4607,94 +3947,6 @@ class AdminProductsControllerCore extends AdminController return $content; } - /** - * @param Product $obj - * @throws Exception - * @throws SmartyException - */ - public function initFormCustomization($obj) - { - $data = $this->createTemplate($this->tpl_form); - - if ((bool)$obj->id) { - if ($this->product_exists_in_shop) { - $labels = $obj->getCustomizationFields(); - - $has_file_labels = (int)$this->getFieldValue($obj, 'uploadable_files'); - $has_text_labels = (int)$this->getFieldValue($obj, 'text_fields'); - - $data->assign(array( - 'obj' => $obj, - 'table' => $this->table, - 'languages' => $this->_languages, - 'has_file_labels' => $has_file_labels, - 'display_file_labels' => $this->_displayLabelFields($obj, $labels, $this->_languages, Configuration::get('PS_LANG_DEFAULT'), Product::CUSTOMIZE_FILE), - 'has_text_labels' => $has_text_labels, - 'display_text_labels' => $this->_displayLabelFields($obj, $labels, $this->_languages, Configuration::get('PS_LANG_DEFAULT'), Product::CUSTOMIZE_TEXTFIELD), - 'uploadable_files' => (int)($this->getFieldValue($obj, 'uploadable_files') ? (int)$this->getFieldValue($obj, 'uploadable_files') : '0'), - 'text_fields' => (int)($this->getFieldValue($obj, 'text_fields') ? (int)$this->getFieldValue($obj, 'text_fields') : '0'), - )); - } else { - $this->displayWarning($this->l('You must save the room type in this shop before adding customization.')); - } - } else { - $this->displayWarning($this->l('You must save this room type before adding customization.')); - } - - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - - public function initFormAttachments($obj) - { - if (!$this->default_form_language) { - $this->getLanguages(); - } - - $data = $this->createTemplate($this->tpl_form); - $data->assign('default_form_language', $this->default_form_language); - - if ((bool)$obj->id) { - if ($this->product_exists_in_shop) { - $attachment_name = array(); - $attachment_description = array(); - foreach ($this->_languages as $language) { - $attachment_name[$language['id_lang']] = ''; - $attachment_description[$language['id_lang']] = ''; - } - - $iso_tiny_mce = $this->context->language->iso_code; - $iso_tiny_mce = (file_exists(_PS_JS_DIR_.'tiny_mce/langs/'.$iso_tiny_mce.'.js') ? $iso_tiny_mce : 'en'); - - $attachment_uploader = new HelperUploader('attachment_file'); - $attachment_uploader->setMultiple(false)->setUseAjax(true)->setUrl( - Context::getContext()->link->getAdminLink('AdminProducts').'&ajax=1&id_product='.(int)$obj->id - .'&action=AddAttachment')->setPostMaxSize((Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 * 1024)) - ->setTemplate('attachment_ajax.tpl'); - - $data->assign(array( - 'obj' => $obj, - 'table' => $this->table, - 'ad' => __PS_BASE_URI__.basename(_PS_ADMIN_DIR_), - 'iso_tiny_mce' => $iso_tiny_mce, - 'languages' => $this->_languages, - 'id_lang' => $this->context->language->id, - 'attach1' => Attachment::getAttachments($this->context->language->id, $obj->id, true), - 'attach2' => Attachment::getAttachments($this->context->language->id, $obj->id, false), - 'default_form_language' => (int)Configuration::get('PS_LANG_DEFAULT'), - 'attachment_name' => $attachment_name, - 'attachment_description' => $attachment_description, - 'attachment_uploader' => $attachment_uploader->render() - )); - } else { - $this->displayWarning($this->l('You must save the room type in this shop before adding attachements.')); - } - } else { - $this->displayWarning($this->l('You must save this room type before adding attachements.')); - } - - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - /** * @param Product $product * @throws Exception @@ -4802,16 +4054,7 @@ class AdminProductsControllerCore extends AdminController $objRoomType = new HotelRoomType(); $objHotelInfo = new HotelBranchInformation(); - $idsHotel = $objHotelInfo->getProfileAccessedHotels($this->context->employee->id_profile, 1, 1); - $hotelsInfo = array(); - foreach ($idsHotel as $idHotel) { - $objHotelBranchInfo = new HotelBranchInformation($idHotel, $this->context->language->id); - $hotelsInfo[] = array( - 'id' => (int)$idHotel, - 'hotel_name' => $objHotelBranchInfo->hotel_name, - ); - } - $data->assign('htl_info', $hotelsInfo); + $data->assign('htl_info', $objHotelInfo->hotelsNameAndId()); if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($product->id)) { $data->assign('htl_room_type', $hotelRoomType); $hotelFullInfo = $objHotelInfo->hotelBranchInfoById($hotelRoomType['id_hotel']); @@ -4822,56 +4065,6 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['custom_form'] = $data->fetch(); } - public function initFormShipping($obj) - { - $data = $this->createTemplate($this->tpl_form); - $data->assign(array( - 'product' => $obj, - 'ps_dimension_unit' => Configuration::get('PS_DIMENSION_UNIT'), - 'ps_weight_unit' => Configuration::get('PS_WEIGHT_UNIT'), - 'carrier_list' => $this->getCarrierList(), - 'currency' => $this->context->currency, - 'country_display_tax_label' => $this->context->country->display_tax_label - )); - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - - protected function getCarrierList() - { - $carrier_list = Carrier::getCarriers($this->context->language->id, false, false, false, null, Carrier::ALL_CARRIERS); - - if ($product = $this->loadObject(true)) { - /** @var Product $product */ - $carrier_selected_list = $product->getCarriers(); - foreach ($carrier_list as &$carrier) { - foreach ($carrier_selected_list as $carrier_selected) { - if ($carrier_selected['id_reference'] == $carrier['id_reference']) { - $carrier['selected'] = true; - continue; - } - } - } - } - return $carrier_list; - } - - protected function addCarriers($product = null) - { - if (!isset($product)) { - $product = new Product((int)Tools::getValue('id_product')); - } - - if (Validate::isLoadedObject($product)) { - $carriers = array(); - - if (Tools::getValue('selectedCarriers')) { - $carriers = Tools::getValue('selectedCarriers'); - } - - $product->setCarriers($carriers); - } - } - public function ajaxProcessaddProductImage() { self::$currentIndex = 'index.php?tab=AdminProducts'; @@ -5084,479 +4277,6 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['custom_form'] = $data->fetch(); } - public function initFormCombinations($obj) - { - return $this->initFormAttributes($obj); - } - - /** - * @param Product $product - * @throws Exception - * @throws SmartyException - */ - public function initFormAttributes($product) - { - $data = $this->createTemplate($this->tpl_form); - if (!Combination::isFeatureActive()) { - $this->displayWarning($this->l('This feature has been disabled. '). - ' '.$this->l('Performances').''); - } elseif (Validate::isLoadedObject($product)) { - if ($this->product_exists_in_shop) { - if ($product->is_virtual) { - $data->assign('product', $product); - $this->displayWarning($this->l('A virtual product cannot have combinations.')); - } else { - $attribute_js = array(); - $attributes = Attribute::getAttributes($this->context->language->id, true); - foreach ($attributes as $k => $attribute) { - $attribute_js[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name']; - natsort($attribute_js[$attribute['id_attribute_group']]); - } - - $currency = $this->context->currency; - - $data->assign('attributeJs', $attribute_js); - $data->assign('attributes_groups', AttributeGroup::getAttributesGroups($this->context->language->id)); - - $data->assign('currency', $currency); - - $images = Image::getImages($this->context->language->id, $product->id); - - $data->assign('tax_exclude_option', Tax::excludeTaxeOption()); - $data->assign('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT')); - - $data->assign('ps_use_ecotax', Configuration::get('PS_USE_ECOTAX')); - $data->assign('field_value_unity', $this->getFieldValue($product, 'unity')); - - $data->assign('reasons', $reasons = StockMvtReason::getStockMvtReasons($this->context->language->id)); - $data->assign('ps_stock_mvt_reason_default', $ps_stock_mvt_reason_default = Configuration::get('PS_STOCK_MVT_REASON_DEFAULT')); - $data->assign('minimal_quantity', $this->getFieldValue($product, 'minimal_quantity') ? $this->getFieldValue($product, 'minimal_quantity') : 1); - $data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities($this->getFieldValue($product, 'available_date'), $this->context->language->id)) : '0000-00-00'); - - $i = 0; - $type = ImageType::getByNameNType('%', 'products', 'height'); - if (isset($type['name'])) { - $data->assign('imageType', $type['name']); - } else { - $data->assign('imageType', ImageType::getFormatedName('small')); - } - $data->assign('imageWidth', (isset($image_type['width']) ? (int)($image_type['width']) : 64) + 25); - foreach ($images as $k => $image) { - $images[$k]['obj'] = new Image($image['id_image']); - ++$i; - } - $data->assign('images', $images); - - $data->assign($this->tpl_form_vars); - $data->assign(array( - 'list' => $this->renderListAttributes($product, $currency), - 'product' => $product, - 'id_category' => $product->getDefaultCategory(), - 'token_generator' => Tools::getAdminTokenLite('AdminAttributeGenerator'), - 'combination_exists' => (Shop::isFeatureActive() && (Shop::getContextShopGroup()->share_stock) && count(AttributeGroup::getAttributesGroups($this->context->language->id)) > 0 && $product->hasAttributes()) - )); - } - } else { - $this->displayWarning($this->l('You must save the room type in this shop before adding combinations.')); - } - } else { - $data->assign('product', $product); - $this->displayWarning($this->l('You must save this room type before adding combinations.')); - } - - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - - /** - * @param Product $product - * @param Currency|array|int $currency - * @return string - */ - public function renderListAttributes($product, $currency) - { - $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); - $this->addRowAction('edit'); - $this->addRowAction('default'); - $this->addRowAction('delete'); - - $default_class = 'highlighted'; - - $this->fields_list = array( - 'attributes' => array('title' => $this->l('Attribute - value pair'), 'align' => 'left'), - 'price' => array('title' => $this->l('Impact on price'), 'type' => 'price', 'align' => 'left'), - 'weight' => array('title' => $this->l('Impact on weight'), 'align' => 'left'), - 'reference' => array('title' => $this->l('Reference'), 'align' => 'left'), - 'ean13' => array('title' => $this->l('EAN-13'), 'align' => 'left'), - 'upc' => array('title' => $this->l('UPC'), 'align' => 'left') - ); - - if ($product->id) { - /* Build attributes combinations */ - $combinations = $product->getAttributeCombinations($this->context->language->id); - $groups = array(); - $comb_array = array(); - if (is_array($combinations)) { - $combination_images = $product->getCombinationImages($this->context->language->id); - foreach ($combinations as $k => $combination) { - $price_to_convert = Tools::convertPrice($combination['price'], $currency); - $price = Tools::displayPrice($price_to_convert, $currency); - - $comb_array[$combination['id_product_attribute']]['id_product_attribute'] = $combination['id_product_attribute']; - $comb_array[$combination['id_product_attribute']]['attributes'][] = array($combination['group_name'], $combination['attribute_name'], $combination['id_attribute']); - $comb_array[$combination['id_product_attribute']]['wholesale_price'] = $combination['wholesale_price']; - $comb_array[$combination['id_product_attribute']]['price'] = $price; - $comb_array[$combination['id_product_attribute']]['weight'] = $combination['weight'].Configuration::get('PS_WEIGHT_UNIT'); - $comb_array[$combination['id_product_attribute']]['unit_impact'] = $combination['unit_price_impact']; - $comb_array[$combination['id_product_attribute']]['reference'] = $combination['reference']; - $comb_array[$combination['id_product_attribute']]['ean13'] = $combination['ean13']; - $comb_array[$combination['id_product_attribute']]['upc'] = $combination['upc']; - $comb_array[$combination['id_product_attribute']]['id_image'] = isset($combination_images[$combination['id_product_attribute']][0]['id_image']) ? $combination_images[$combination['id_product_attribute']][0]['id_image'] : 0; - $comb_array[$combination['id_product_attribute']]['available_date'] = strftime($combination['available_date']); - $comb_array[$combination['id_product_attribute']]['default_on'] = $combination['default_on']; - if ($combination['is_color_group']) { - $groups[$combination['id_attribute_group']] = $combination['group_name']; - } - } - } - - if (isset($comb_array)) { - foreach ($comb_array as $id_product_attribute => $product_attribute) { - $list = ''; - - /* In order to keep the same attributes order */ - asort($product_attribute['attributes']); - - foreach ($product_attribute['attributes'] as $attribute) { - $list .= $attribute[0].' - '.$attribute[1].', '; - } - - $list = rtrim($list, ', '); - $comb_array[$id_product_attribute]['image'] = $product_attribute['id_image'] ? new Image($product_attribute['id_image']) : false; - $comb_array[$id_product_attribute]['available_date'] = $product_attribute['available_date'] != 0 ? date('Y-m-d', strtotime($product_attribute['available_date'])) : '0000-00-00'; - $comb_array[$id_product_attribute]['attributes'] = $list; - $comb_array[$id_product_attribute]['name'] = $list; - - if ($product_attribute['default_on']) { - $comb_array[$id_product_attribute]['class'] = $default_class; - } - } - } - } - - foreach ($this->actions_available as $action) { - if (!in_array($action, $this->actions) && isset($this->$action) && $this->$action) { - $this->actions[] = $action; - } - } - - $helper = new HelperList(); - $helper->identifier = 'id_product_attribute'; - $helper->table_id = 'combinations-list'; - $helper->token = $this->token; - $helper->currentIndex = self::$currentIndex; - $helper->no_link = true; - $helper->simple_header = true; - $helper->show_toolbar = false; - $helper->shopLinkType = $this->shopLinkType; - $helper->actions = $this->actions; - $helper->list_skip_actions = $this->list_skip_actions; - $helper->colorOnBackground = true; - $helper->override_folder = $this->tpl_folder.'combination/'; - - return $helper->generateList($comb_array, $this->fields_list); - } - - /** - * @param Product $obj - * @throws Exception - * @throws SmartyException - */ - public function initFormQuantities($obj) - { - if (!$this->default_form_language) { - $this->getLanguages(); - } - - $data = $this->createTemplate($this->tpl_form); - $data->assign('default_form_language', $this->default_form_language); - - if ($obj->id) { - if ($this->product_exists_in_shop) { - // Get all id_product_attribute - $attributes = $obj->getAttributesResume($this->context->language->id); - if (empty($attributes)) { - $attributes[] = array( - 'id_product_attribute' => 0, - 'attribute_designation' => '' - ); - } - - // Get available quantities - $available_quantity = array(); - $product_designation = array(); - - foreach ($attributes as $attribute) { - // Get available quantity for the current product attribute in the current shop - $available_quantity[$attribute['id_product_attribute']] = isset($attribute['id_product_attribute']) && $attribute['id_product_attribute'] ? (int)$attribute['quantity'] : (int)$obj->quantity; - // Get all product designation - $product_designation[$attribute['id_product_attribute']] = rtrim( - $obj->name[$this->context->language->id].' - '.$attribute['attribute_designation'], - ' - ' - ); - } - - $show_quantities = true; - $shop_context = Shop::getContext(); - $shop_group = new ShopGroup((int)Shop::getContextShopGroupID()); - - // if we are in all shops context, it's not possible to manage quantities at this level - if (Shop::isFeatureActive() && $shop_context == Shop::CONTEXT_ALL) { - $show_quantities = false; - } - // if we are in group shop context - elseif (Shop::isFeatureActive() && $shop_context == Shop::CONTEXT_GROUP) { - // if quantities are not shared between shops of the group, it's not possible to manage them at group level - if (!$shop_group->share_stock) { - $show_quantities = false; - } - } - // if we are in shop context - elseif (Shop::isFeatureActive()) { - // if quantities are shared between shops of the group, it's not possible to manage them for a given shop - if ($shop_group->share_stock) { - $show_quantities = false; - } - } - - $data->assign('ps_stock_management', Configuration::get('PS_STOCK_MANAGEMENT')); - $data->assign('has_attribute', $obj->hasAttributes()); - // Check if product has combination, to display the available date only for the product or for each combination - if (Combination::isFeatureActive()) { - $data->assign('countAttributes', (int)Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.(int)$obj->id)); - } else { - $data->assign('countAttributes', false); - } - // if advanced stock management is active, checks associations - $advanced_stock_management_warning = false; - if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $obj->advanced_stock_management) { - $p_attributes = Product::getProductAttributesIds($obj->id); - $warehouses = array(); - - if (!$p_attributes) { - $warehouses[] = Warehouse::getProductWarehouseList($obj->id, 0); - } - - foreach ($p_attributes as $p_attribute) { - $ws = Warehouse::getProductWarehouseList($obj->id, $p_attribute['id_product_attribute']); - if ($ws) { - $warehouses[] = $ws; - } - } - $warehouses = Tools::arrayUnique($warehouses); - - if (empty($warehouses)) { - $advanced_stock_management_warning = true; - } - } - if ($advanced_stock_management_warning) { - $this->displayWarning($this->l('If you wish to use the advanced stock management, you must:')); - $this->displayWarning('- '.$this->l('associate your room types with warehouses.')); - $this->displayWarning('- '.$this->l('associate your warehouses with carriers.')); - $this->displayWarning('- '.$this->l('associate your warehouses with the appropriate shops.')); - } - - $pack_quantity = null; - // if product is a pack - if (Pack::isPack($obj->id)) { - $items = Pack::getItems((int)$obj->id, Configuration::get('PS_LANG_DEFAULT')); - - // gets an array of quantities (quantity for the product / quantity in pack) - $pack_quantities = array(); - foreach ($items as $item) { - /** @var Product $item */ - if (!$item->isAvailableWhenOutOfStock((int)$item->out_of_stock)) { - $pack_id_product_attribute = Product::getDefaultAttribute($item->id, 1); - $pack_quantities[] = Product::getQuantity($item->id, $pack_id_product_attribute) / ($item->pack_quantity !== 0 ? $item->pack_quantity : 1); - } - } - - // gets the minimum - if (count($pack_quantities)) { - $pack_quantity = $pack_quantities[0]; - foreach ($pack_quantities as $value) { - if ($pack_quantity > $value) { - $pack_quantity = $value; - } - } - } - - if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && !Warehouse::getPackWarehouses((int)$obj->id)) { - $this->displayWarning($this->l('You must have a common warehouse between this pack and its room type.')); - } - } - - $data->assign(array( - 'attributes' => $attributes, - 'available_quantity' => $available_quantity, - 'pack_quantity' => $pack_quantity, - 'stock_management_active' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'), - 'product_designation' => $product_designation, - 'product' => $obj, - 'show_quantities' => $show_quantities, - 'order_out_of_stock' => Configuration::get('PS_ORDER_OUT_OF_STOCK'), - 'pack_stock_type' => Configuration::get('PS_PACK_STOCK_TYPE'), - 'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'), - 'token' => $this->token, - 'languages' => $this->_languages, - 'id_lang' => $this->context->language->id - )); - } else { - $this->displayWarning($this->l('You must save the room type in this shop before managing quantities.')); - } - } else { - $this->displayWarning($this->l('You must save this room type before managing quantities.')); - } - - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - - /** - * @param Product $obj - * @throws Exception - * @throws SmartyException - */ - public function initFormSuppliers($obj) - { - $data = $this->createTemplate($this->tpl_form); - - if ($obj->id) { - if ($this->product_exists_in_shop) { - // Get all id_product_attribute - $attributes = $obj->getAttributesResume($this->context->language->id); - if (empty($attributes)) { - $attributes[] = array( - 'id_product' => $obj->id, - 'id_product_attribute' => 0, - 'attribute_designation' => '' - ); - } - - $product_designation = array(); - - foreach ($attributes as $attribute) { - $product_designation[$attribute['id_product_attribute']] = rtrim( - $obj->name[$this->context->language->id].' - '.$attribute['attribute_designation'], - ' - ' - ); - } - - // Get all available suppliers - $suppliers = Supplier::getSuppliers(); - - // Get already associated suppliers - $associated_suppliers = ProductSupplier::getSupplierCollection($obj->id); - - // Get already associated suppliers and force to retreive product declinaisons - $product_supplier_collection = ProductSupplier::getSupplierCollection($obj->id, false); - - $default_supplier = 0; - - foreach ($suppliers as &$supplier) { - $supplier['is_selected'] = false; - $supplier['is_default'] = false; - - foreach ($associated_suppliers as $associated_supplier) { - /** @var ProductSupplier $associated_supplier */ - if ($associated_supplier->id_supplier == $supplier['id_supplier']) { - $associated_supplier->name = $supplier['name']; - $supplier['is_selected'] = true; - - if ($obj->id_supplier == $supplier['id_supplier']) { - $supplier['is_default'] = true; - $default_supplier = $supplier['id_supplier']; - } - } - } - } - - $data->assign(array( - 'attributes' => $attributes, - 'suppliers' => $suppliers, - 'default_supplier' => $default_supplier, - 'associated_suppliers' => $associated_suppliers, - 'associated_suppliers_collection' => $product_supplier_collection, - 'product_designation' => $product_designation, - 'currencies' => Currency::getCurrencies(), - 'product' => $obj, - 'link' => $this->context->link, - 'token' => $this->token, - 'id_default_currency' => Configuration::get('PS_CURRENCY_DEFAULT'), - )); - } else { - $this->displayWarning($this->l('You must save the room type in this shop before managing suppliers.')); - } - } else { - $this->displayWarning($this->l('You must save this room type before managing suppliers.')); - } - - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - - /** - * @param Product $obj - * @throws Exception - * @throws SmartyException - */ - public function initFormWarehouses($obj) - { - $data = $this->createTemplate($this->tpl_form); - - if ($obj->id) { - if ($this->product_exists_in_shop) { - // Get all id_product_attribute - $attributes = $obj->getAttributesResume($this->context->language->id); - if (empty($attributes)) { - $attributes[] = array( - 'id_product' => $obj->id, - 'id_product_attribute' => 0, - 'attribute_designation' => '' - ); - } - - $product_designation = array(); - - foreach ($attributes as $attribute) { - $product_designation[$attribute['id_product_attribute']] = rtrim( - $obj->name[$this->context->language->id].' - '.$attribute['attribute_designation'], - ' - ' - ); - } - - // Get all available warehouses - $warehouses = Warehouse::getWarehouses(true); - - // Get already associated warehouses - $associated_warehouses_collection = WarehouseProductLocation::getCollection($obj->id); - - $data->assign(array( - 'attributes' => $attributes, - 'warehouses' => $warehouses, - 'associated_warehouses' => $associated_warehouses_collection, - 'product_designation' => $product_designation, - 'product' => $obj, - 'link' => $this->context->link, - 'token' => $this->token - )); - } else { - $this->displayWarning($this->l('You must save the room type in this shop before managing warehouses.')); - } - } else { - $this->displayWarning($this->l('You must save this room type before managing warehouses.')); - } - - $this->tpl_form_vars['custom_form'] = $data->fetch(); - } - /** * @param Product $obj * @throws Exception @@ -5628,7 +4348,7 @@ class AdminProductsControllerCore extends AdminController foreach ($idsHotel as $idHotel) { $objHotelBranchInfo = new HotelBranchInformation($idHotel, $this->context->language->id); if (Validate::isLoadedObject($objHotelBranchInfo)) { - $hotelAddressInfo = $objHotelBranchInfo->getAddress($idHotel); + $hotelAddressInfo = HotelBranchInformation::getAddress($idHotel); $hotelInfo = array( 'id_hotel' => $objHotelBranchInfo->id, 'hotel_name' => $objHotelBranchInfo->hotel_name, @@ -5790,42 +4510,6 @@ class AdminProductsControllerCore extends AdminController return $content; } - public function haveThisAccessory($accessory_id, $accessories) - { - foreach ($accessories as $accessory) { - if ((int)$accessory['id_product'] == (int)$accessory_id) { - return true; - } - } - return false; - } - - protected function initPack(Product $product) - { - $this->tpl_form_vars['is_pack'] = ($product->id && Pack::isPack($product->id)) || Tools::getValue('type_product') == Product::PTYPE_PACK; - $product->packItems = Pack::getItems($product->id, $this->context->language->id); - - $input_pack_items = ''; - if (Tools::getValue('inputPackItems')) { - $input_pack_items = Tools::getValue('inputPackItems'); - } else { - foreach ($product->packItems as $pack_item) { - $input_pack_items .= $pack_item->pack_quantity.'x'.$pack_item->id.'-'; - } - } - $this->tpl_form_vars['input_pack_items'] = $input_pack_items; - - $input_namepack_items = ''; - if (Tools::getValue('namePackItems')) { - $input_namepack_items = Tools::getValue('namePackItems'); - } else { - foreach ($product->packItems as $pack_item) { - $input_namepack_items .= $pack_item->pack_quantity.' x '.$pack_item->name.'¤'; - } - } - $this->tpl_form_vars['input_namepack_items'] = $input_namepack_items; - } - /** * AdminProducts display hook * @@ -5839,41 +4523,6 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['custom_form'] = Hook::exec('displayAdminProductsExtra', array(), (int)$id_module); } - /** - * delete all items in pack, then check if type_product value is 2. - * if yes, add the pack items from input "inputPackItems" - * - * @param Product $product - * @return bool - */ - public function updatePackItems($product) - { - Pack::deleteItems($product->id); - // lines format: QTY x ID-QTY x ID - if (Tools::getValue('type_product') == Product::PTYPE_PACK) { - $product->setDefaultAttribute(0);//reset cache_default_attribute - $items = Tools::getValue('inputPackItems'); - $lines = array_unique(explode('-', $items)); - - // lines is an array of string with format : QTYxIDxID_PRODUCT_ATTRIBUTE - if (count($lines)) { - foreach ($lines as $line) { - if (!empty($line)) { - $item_id_attribute = 0; - count($array = explode('x', $line)) == 3 ? list($qty, $item_id, $item_id_attribute) = $array : list($qty, $item_id) = $array; - if ($qty > 0 && isset($item_id)) { - if (Pack::isPack((int)$item_id || $product->id == (int)$item_id)) { - $this->errors[] = Tools::displayError('You can\'t add room type packs into a pack'); - } elseif (!Pack::addItem((int)$product->id, (int)$item_id, (int)$qty, (int)$item_id_attribute)) { - $this->errors[] = Tools::displayError('An error occurred while attempting to add room types to the pack.'); - } - } - } - } - } - } - } - public function getL($key) { $trad = array( @@ -5999,6 +4648,79 @@ class AdminProductsControllerCore extends AdminController die(json_encode($response)); } + public function ajaxProcessValidateDisableDates() + { + $response = array('status' => false); + + $idRoom = (int) Tools::getValue('id_room'); + $disableDates = Tools::getValue('disable_dates'); + + $rowsToHighlight = array(); + $bookedRows = array(); + if (is_array($disableDates) && count($disableDates)) { + foreach ($disableDates as $key => $dateRange) { + if (!Validate::isDate($dateRange['date_from']) || !Validate::isDate($dateRange['date_to'])) { + $this->errors[] = $this->l('Some dates are missing. Please select all the date ranges.'); + $rowsToHighlight[] = $key; + } + } + + if (!count($this->errors)) { + foreach ($disableDates as $keyOuter => $dateRangeOuter) { + foreach ($disableDates as $keyInner => $dateRangeInner) { + if ($keyInner != $keyOuter) { + if ((($dateRangeOuter['date_from'] >= $dateRangeInner['date_from']) && ($dateRangeOuter['date_from'] < $dateRangeInner['date_to'])) + || (($dateRangeInner['date_from'] >= $dateRangeOuter['date_from']) && ($dateRangeInner['date_from'] < $dateRangeOuter['date_to'])) + ) { + $this->errors[] = $this->l('Some dates are conflicting with each other. Please check and reselect the date ranges.'); + $rowsToHighlight[] = $keyOuter; + $rowsToHighlight[] = $keyInner; + } + } + } + } + } + + if (!count($this->errors)) { + if ($idRoom) { + $objHotelBookingDetail = new HotelBookingDetail(); + foreach ($disableDates as $key => $dateRange) { + if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) { + $bookedRows[] = new HotelBookingDetail($bookingRow['id']); + $rowsToHighlight[] = $key; + } + } + } + } + } + + if (count($bookedRows)) { + $this->context->smarty->assign(array( + 'link' => $this->context->link, + 'booked_rows_list' => $bookedRows, + )); + + $this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl'); + } + + $this->errors = array_unique($this->errors); + $rowsToHighlight = array_values(array_unique($rowsToHighlight)); + + if (!count($this->errors)) { + $response['status'] = true; + } else { + $this->context->smarty->assign(array( + 'errors' => $this->errors, + )); + + $response['errors'] = $this->context->smarty->fetch('alerts.tpl'); + $response['rows_to_highlight'] = $rowsToHighlight; + $response['status'] = false; + } + + $this->ajaxDie(json_encode($response)); + } + public function processImageLegends() { if (Tools::getValue('key_tab') == 'Images' && Tools::getValue('submitAddproductAndStay') == 'update_legends' && Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { diff --git a/controllers/admin/AdminSearchController.php b/controllers/admin/AdminSearchController.php index b8dc233dc..2b9e2b5eb 100644 --- a/controllers/admin/AdminSearchController.php +++ b/controllers/admin/AdminSearchController.php @@ -82,12 +82,16 @@ class AdminSearchControllerCore extends AdminController Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)$order->id.'&vieworder'.'&token='.Tools::getAdminTokenLite('AdminOrders')); } else { $row = get_object_vars($order); - $row['id_order'] = $row['id']; - $customer = $order->getCustomer(); - $row['customer'] = $customer->firstname.' '.$customer->lastname; - $order_state = $order->getCurrentOrderState(); - $row['osname'] = $order_state->name[$this->context->language->id]; - $this->_list['orders'] = array($row); + $idHotel = HotelBookingDetail::getIdHotelByIdOrder($row['id']); + if (in_array($idHotel, HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1))) { + $row['id_order'] = $row['id']; + $customer = $order->getCustomer(); + $row['customer'] = $customer->firstname.' '.$customer->lastname; + $order_state = $order->getCurrentOrderState(); + $row['osname'] = $order_state->name[$this->context->language->id]; + $this->_list['orders'] = array($row); + } + } } else { $orders = Order::getByReference($this->query); @@ -99,12 +103,15 @@ class AdminSearchControllerCore extends AdminController foreach ($orders as $order) { /** @var Order $order */ $row = get_object_vars($order); - $row['id_order'] = $row['id']; - $customer = $order->getCustomer(); - $row['customer'] = $customer->firstname.' '.$customer->lastname; - $order_state = $order->getCurrentOrderState(); - $row['osname'] = $order_state->name[$this->context->language->id]; - $this->_list['orders'][] = $row; + $idHotel = HotelBookingDetail::getIdHotelByIdOrder($row['id']); + if (in_array($idHotel, HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1))) { + $row['id_order'] = $row['id']; + $customer = $order->getCustomer(); + $row['customer'] = $customer->firstname.' '.$customer->lastname; + $order_state = $order->getCurrentOrderState(); + $row['osname'] = $order_state->name[$this->context->language->id]; + $this->_list['orders'][] = $row; + } } } elseif ($searchType == 3) { $this->errors[] = Tools::displayError('No order was found with this ID:').' '.Tools::htmlentitiesUTF8($this->query); @@ -162,7 +169,15 @@ class AdminSearchControllerCore extends AdminController public function searchCatalog() { $this->context = Context::getContext(); - $this->_list['products'] = Product::searchByName($this->context->language->id, $this->query); + if ($this->_list['products'] = Product::searchByName($this->context->language->id, $this->query)) { + $objRoomType = new HotelRoomType(); + foreach ($this->_list['products'] as $key => $product) { + $roomInfo = $objRoomType->getRoomTypeInfoByIdProduct($product['id_product']); + if (!in_array($roomInfo['id_hotel'], HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1))) { + unset($this->_list['products'][$key]); + } + } + } $this->_list['categories'] = Category::searchByName($this->context->language->id, $this->query); } @@ -299,9 +314,8 @@ class AdminSearchControllerCore extends AdminController $this->show_toolbar = false; $this->fields_list['products'] = array( 'id_product' => array('title' => $this->l('ID'), 'width' => 25), - 'manufacturer_name' => array('title' => $this->l('Manufacturer'), 'align' => 'center', 'width' => 200), - 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 150), 'name' => array('title' => $this->l('Name'), 'width' => 'auto'), + 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 150), 'price_tax_excl' => array('title' => $this->l('Price (tax excl.)'), 'align' => 'right', 'type' => 'price', 'width' => 60), 'price_tax_incl' => array('title' => $this->l('Price (tax incl.)'), 'align' => 'right', 'type' => 'price', 'width' => 60), 'active' => array('title' => $this->l('Active'), 'width' => 70, 'active' => 'status', 'align' => 'center', 'type' => 'bool') @@ -350,7 +364,7 @@ class AdminSearchControllerCore extends AdminController } $this->tpl_view_vars['categories'] = $categories; } - if (isset($this->_list['products']) && count($this->_list['products'])) { + if (isset($this->_list['products']) && $this->_list['products']&& count($this->_list['products'])) { $view = ''; $this->initProductList(); @@ -376,6 +390,7 @@ class AdminSearchControllerCore extends AdminController $view = $helper->generateList($this->_list['products'], $this->fields_list['products']); } + $this->tpl_view_vars['num_products'] = count($this->_list['products']); $this->tpl_view_vars['products'] = $view; } if (isset($this->_list['customers']) && count($this->_list['customers'])) { @@ -398,6 +413,7 @@ class AdminSearchControllerCore extends AdminController } $view = $helper->generateList($this->_list['customers'], $this->fields_list['customers']); } + $this->tpl_view_vars['num_customers'] = count($this->_list['customers']); $this->tpl_view_vars['customers'] = $view; } if (isset($this->_list['orders']) && count($this->_list['orders'])) { @@ -417,6 +433,7 @@ class AdminSearchControllerCore extends AdminController if ($this->_list['orders']) { $view = $helper->generateList($this->_list['orders'], $this->fields_list['orders']); } + $this->tpl_view_vars['num_orders'] = count($this->_list['orders']); $this->tpl_view_vars['orders'] = $view; } diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 693b8ce0f..b6d755db9 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -176,13 +176,31 @@ class AdminStatsControllerCore extends AdminStatsTabController '.Shop::addSqlAssociation('category', 'c')); } + public static function getDisabledRoomTypes() + { + return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT COUNT(*) + FROM `'._DB_PREFIX_.'product` p + '.Shop::addSqlAssociation('product', 'p').' + WHERE product_shop.active = 0 AND p.`booking_product` = 1'); + } + + public static function getTotalRoomTypes() + { + return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT COUNT(*) + FROM `'._DB_PREFIX_.'product` p + '.Shop::addSqlAssociation('product', 'p').' + WHERE p.`booking_product` = 1'); + } + public static function getDisabledProducts() { return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT COUNT(*) FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p').' - WHERE product_shop.active = 0'); + WHERE product_shop.active = 0 AND p.`booking_product` = 0'); } public static function getTotalProducts() @@ -190,7 +208,8 @@ class AdminStatsControllerCore extends AdminStatsTabController return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT COUNT(*) FROM `'._DB_PREFIX_.'product` p - '.Shop::addSqlAssociation('product', 'p')); + '.Shop::addSqlAssociation('product', 'p').' + WHERE p.`booking_product` = 0'); } public static function getTotalSales($date_from, $date_to, $granularity = false, $id_hotel = false) @@ -265,7 +284,7 @@ class AdminStatsControllerCore extends AdminStatsTabController if (!$distinct_products) { return '0%'; } - return round(100 * $distinct_products / AdminStatsController::getTotalProducts()).'%'; + return round(100 * $distinct_products / AdminStatsController::getTotalRoomTypes()).'%'; } public static function getOrders($date_from, $date_to, $granularity = false, $id_hotel = false) @@ -335,7 +354,7 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getCustomerMainGender() { $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT SUM(IF(g.id_gender IS NOT NULL, 1, 0)) as total, SUM(IF(type = 0, 1, 0)) as male, SUM(IF(type = 1, 1, 0)) as female, SUM(IF(type = 2, 1, 0)) as neutral + SELECT SUM(IF(c.id_gender IS NOT NULL, 1, 0)) as total, SUM(IF(type = 0, 1, 0)) as male, SUM(IF(type = 1, 1, 0)) as female, SUM(IF(type = 2, 1, 0)) as neutral FROM `'._DB_PREFIX_.'customer` c LEFT JOIN `'._DB_PREFIX_.'gender` g ON c.id_gender = g.id_gender WHERE c.active = 1 '.Shop::addSqlRestriction()); @@ -370,6 +389,8 @@ class AdminStatsControllerCore extends AdminStatsTabController GROUP BY pr.`id_product` ) t ON t.`id_product` = pr.`id_product` ) t ON t.`id_product` = capr.`id_product` + RIGHT JOIN `'._DB_PREFIX_.'category` c2 + ON c2.`id_category` = '.(int)Configuration::get('PS_SERVICE_CATEGORY').' AND ca.`nleft` >= c2.`nleft` AND ca.`nright` <= c2.`nright` WHERE ca.`level_depth` > 1 GROUP BY ca.`id_category` ORDER BY SUM(t.`totalPriceSold`) DESC'); @@ -618,8 +639,22 @@ class AdminStatsControllerCore extends AdminStatsTabController $value = AdminStatsController::getDisabledCategories(); break; + case 'disabled_room_types': + if (AdminStatsController::getTotalRoomTypes()) { + $value = round(100 * AdminStatsController::getDisabledRoomTypes() / AdminStatsController::getTotalRoomTypes(), 2).'%'; + } else { + $value = '0%'; + } + ConfigurationKPI::updateValue('DISABLED_ROOM_TYPES', $value); + ConfigurationKPI::updateValue('DISABLED_ROOM_TYPES_EXPIRE', strtotime('+2 hour')); + break; + case 'disabled_products': - $value = round(100 * AdminStatsController::getDisabledProducts() / AdminStatsController::getTotalProducts(), 2).'%'; + if (AdminStatsController::getTotalProducts()) { + $value = round(100 * AdminStatsController::getDisabledProducts() / AdminStatsController::getTotalProducts(), 2).'%'; + } else { + $value = '0%'; + } break; case '8020_sales_catalog': @@ -1141,9 +1176,10 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getArrivalsInfoByDate($date, $idHotel = null) { - $sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, + $sql = 'SELECT hbd.*, o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`) WHERE hbd.`is_refunded` = 0 AND hbd.`date_from` = "'.pSQL($date).' 00:00:00" AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_IN.' @@ -1156,9 +1192,10 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getDeparturesInfoByDate($date, $idHotel = null) { - $sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, + $sql = 'SELECT hbd.*, o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`) WHERE hbd.`is_refunded` = 0 AND hbd.`date_to` = "'.pSQL($date).' 00:00:00" AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN. @@ -1170,9 +1207,10 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getInHousesInfo($idHotel = null) { - $sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, + $sql = 'SELECT hbd.*, o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`) WHERE hbd.`is_refunded` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); @@ -1184,8 +1222,8 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getNewBookingsInfoByDate($date, $idHotel = null) { $sql = 'SELECT hbd.`id_customer`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, - COUNT(hbd.`id`) AS total_rooms, SUM(hbd.`adult` + hbd.`children`) AS total_guests, - hbd.`id_hotel`, hbd.`hotel_name`, hbd.`id_order`, o.`total_paid_tax_excl`, o.`id_currency`, osl.`name` AS `state_name` + COUNT(hbd.`id`) AS total_rooms, SUM(hbd.`adults` + hbd.`children`) AS total_guests, + hbd.`id_hotel`, hbd.`hotel_name`, hbd.`id_order`, o.`with_occupancy`, o.`total_paid_tax_excl`, o.`id_currency`, osl.`name` AS `state_name` FROM `'._DB_PREFIX_.'htl_booking_detail` hbd LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl @@ -1202,8 +1240,8 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getCancellationsInfoByDate($date, $idHotel = null) { $sql = 'SELECT orr.`id_order_return`, orr.`id_customer`, hbd.`room_num`, hbd.`id_product`, hbd.`room_type_name`, - CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, - hbd.`id_hotel`, hbd.`hotel_name`, SUM(hbd.`adult` + hbd.`children`) AS total_guests, + o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, hbd.`id_hotel`, + hbd.`hotel_name`, SUM(hbd.`adults` + hbd.`children`) AS total_guests, hbd.`date_from`, hbd.`date_to`, orr.`id_order` FROM `'._DB_PREFIX_.'order_return` orr LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (ord.`id_order_return` = orr.`id_order_return`) @@ -1630,9 +1668,10 @@ class AdminStatsControllerCore extends AdminStatsTabController $dateTo = date('Y-m-d', strtotime('+1 day', strtotime($dateTo))); } - $sql = 'SELECT SUM(total_paid_tax_excl) + $sql = 'SELECT SUM(total_paid_tax_excl - refunded_amount) FROM ( SELECT o.`id_order`, o.`total_paid_tax_excl` / o.`conversion_rate` AS total_paid_tax_excl, + IFNULL(orr.`refunded_amount`, 0) AS refunded_amount, (SELECT hbd.`id_hotel` FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = o.`id_order` LIMIT 1 @@ -1642,6 +1681,8 @@ class AdminStatsControllerCore extends AdminStatsTabController ON (hbd.`id_order` = o.`id_order`) INNER JOIN `'._DB_PREFIX_.'htl_branch_info` hbi ON (hbi.`id` = hbd.`id_hotel`) + LEFT JOIN `' ._DB_PREFIX_.'order_return` orr + ON (orr.`id_order` = o.`id_order`) WHERE o.`valid` = 1 AND hbi.`active` = 1 AND hbd.`is_refunded` = 0 AND o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59" AND o.`source` = "'.pSQL(Configuration::get('PS_SHOP_DOMAIN')).'"'. @@ -1756,4 +1797,240 @@ class AdminStatsControllerCore extends AdminStatsTabController return $countGrossOpProfitPars ? $sumGrossOpProfitPars / $countGrossOpProfitPars : 0; } + + public static function getRoomNightsData($dateFrom, $dateTo = null, $idHotel = null, $useCache = true, $average = false) + { + $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; + + $idsHotel = array(); + if (is_int($idHotel)) { + $idsHotel[] = $idHotel; + } else { + $idsHotel = $idHotel; + } + + // collect data + $hotelsData = array(); + foreach ($idsHotel as $idHotel) { + $hotelsData[$idHotel] = self::getOccupiedRoomsForDiscreteDates( + $dateFrom, + $dateTo, + $idHotel, + $useCache + ); + } + + // calculate sums + $result = array(); + foreach ($hotelsData as $hotelData) { + foreach ($hotelData as $timestamp => $value) { + if (!array_key_exists($timestamp, $result)) { + $result[$timestamp] = $value; + } else { + $result[$timestamp] += $value; + } + } + } + + // calculate averages + if ($average) { + $totalHotels = count($idsHotel); + if ($totalHotels > 1) { + foreach ($result as $timestamp => &$value) { + $value = $value / $totalHotels; + } + } + } + + return $result; + } + + /** + * $dow: day of week, 1 = SUN + */ + public static function getOccupiedRoomsForDayOfTheWeek($dow, $dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + { + $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; + + $result = 0; + $cacheKey = 'AdminStats::getOccupiedRoomsForDayOfTheWeek'.'_'.(int) $dow.(int) strtotime($dateFrom). + (int) strtotime($dateTo).(!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); + if (!Cache::isStored($cacheKey) || !$useCache) { + // (los/7) + {if(los%7 has $dow) + 1 else + 0)} + // dow(start_of(remaining_days)) = dow_date_from && dow(end_of(remaining_days)) = dow_date_to + $sql = 'SELECT SUM((full_weeks + IF(('.(int) $dow.' >= dow_date_from AND '.(int) $dow.' < dow_date_to), 1, 0))) + AS total_occupied + FROM ( + SELECT hbd.`id`, hbd.`date_from`, hbd.`date_to`, DAYOFWEEK(hbd.`date_from`) AS dow_date_from, + DAYOFWEEK(hbd.`date_to`) AS dow_date_to, + DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los, + ROUND(DATEDIFF(hbd.`date_to`, hbd.`date_from`) / 7) AS full_weeks, + DATEDIFF(hbd.`date_to`, hbd.`date_from`) % 7 AS remaining_days + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($dateTo).' 00:00:00" AND hbd.`date_to` > "'.pSQL($dateFrom).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').' + ) AS t'; + + $value = (int) Db::getInstance()->getValue($sql); + Cache::store($cacheKey, $value); + + $result = Cache::retrieve($cacheKey); + } + + return $result; + } + + public static function getOccupiedRoomsForDaysOfTheWeek($dateFrom, $dateTo = null, $idHotel = null, $useCache = true, $average = false) + { + $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; + + $idsHotel = array(); + if (is_int($idHotel)) { + $idsHotel[] = $idHotel; + } else { + $idsHotel = $idHotel; + } + + // collect data + $hotelsData = array(); + foreach ($idsHotel as $idHotel) { + $hotelsData[$idHotel] = array(); + // 1 = SUN + for ($i = 1; $i <= 7; $i++) { + $hotelsData[$idHotel][$i] = self::getOccupiedRoomsForDayOfTheWeek( + $i, + $dateFrom, + $dateTo, + $idHotel, + $useCache + ); + } + } + + // calculate sums + $result = array(); + foreach ($hotelsData as $hotelData) { + foreach ($hotelData as $dayOfWeek => $value) { + if (!array_key_exists($dayOfWeek, $result)) { + $result[$dayOfWeek] = $value; + } else { + $result[$dayOfWeek] += $value; + } + } + } + + // calculate averages + if ($average) { + $totalHotels = count($idsHotel); + if ($totalHotels > 1) { + foreach ($result as $timestamp => &$value) { + $value = $value / $totalHotels; + } + } + } + + return $result; + } + + public static function getLengthOfStayRatio($losMinimum, $dateFrom, $dateTo, $idHotel = null, $useCache = true, $losMaximum = false) + { + $result = 0; + $cacheKey = 'AdminStats::getLengthOfStayRatio'.'_'.(int) $losMinimum.(int) $losMaximum. + (int) strtotime($dateFrom).(int) strtotime($dateTo).(!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); + if (!Cache::isStored($cacheKey) || !$useCache) { + if ($dateFrom == $dateTo) { + $dateTo = date('Y-m-d', strtotime('+1 day', strtotime($dateTo))); + } + + $sql = 'SELECT COUNT(hbd.`id`) AS total + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hbd.`id_product`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($dateTo).' 00:00:00" AND hbd.`date_to` > "'.pSQL($dateFrom).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); + + $total = Db::getInstance()->getValue($sql); + + $sql = 'SELECT COUNT(los) + FROM ( + SELECT DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hbd.`id_product`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($dateTo).' 00:00:00" AND hbd.`date_to` > "'.pSQL($dateFrom).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').' + ) AS t + WHERE los >= '.(int) $losMinimum.' AND los <= '.(int) ($losMaximum ? $losMaximum : $losMinimum); + + $fraction = Db::getInstance()->getValue($sql); + + $ratio = array('fraction' => $fraction, 'total' => $total); + Cache::store($cacheKey, $ratio); + + $result = Cache::retrieve($cacheKey); + } + + return $result; + } + + public static function getLengthOfStayPercentages($days, $dateFrom, $dateTo, $idHotel = null, $useCache = true, $average = false) + { + $idsHotel = array(); + if (is_int($idHotel)) { + $idsHotel[] = $idHotel; + } else { + $idsHotel = $idHotel; + } + + // collect data + $hotelsData = array(); + foreach ($idsHotel as $idHotel) { + $hotelsData[$idHotel] = array(); + foreach ($days as $key => $day) { + $hotelsData[$idHotel][$key] = self::getLengthOfStayRatio( + $day[0], + $dateFrom, + $dateTo, + $idHotel, + $useCache, + $day[1] + ); + } + } + + // calculate sums + $result = array(); + foreach ($hotelsData as $hotelData) { + foreach ($days as $key => $day) { + if (!array_key_exists($key, $result)) { + $result[$key]['fraction'] = $hotelData[$key]['fraction']; + $result[$key]['total'] = $hotelData[$key]['total']; + } else { + $result[$key]['fraction'] += $hotelData[$key]['fraction']; + $result[$key]['total'] += $hotelData[$key]['total']; + } + } + } + + // calculate averages + if ($average) { + $totalHotels = count($idsHotel); + if ($totalHotels > 1) { + foreach ($result as $key => $ratio) { + $result[$key] = $ratio['total'] ? ($ratio['fraction'] / $ratio['total']) : 0; + } + } + } else { + foreach ($result as $key => $ratio) { + $result[$key] = $ratio['total'] ? ($ratio['fraction'] / $ratio['total']) : 0; + } + } + + return $result; + } } diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index eaf7f4c8a..7dbd73476 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -716,8 +716,6 @@ class AdminThemesControllerCore extends AdminController public function initPageHeaderToolbar() { - parent::initPageHeaderToolbar(); - if (empty($this->display)) { $this->page_header_toolbar_btn['import_theme'] = array( 'href' => self::$currentIndex.'&action=importtheme&token='.$this->token, @@ -746,6 +744,8 @@ class AdminThemesControllerCore extends AdminController $title = implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $this->toolbar_title); $this->page_header_toolbar_title = $title; + + parent::initPageHeaderToolbar(); } private function checkParentClass($name) @@ -2109,6 +2109,7 @@ class AdminThemesControllerCore extends AdminController 'dashgoals', 'dashproducts', 'dashtrends', + 'dashinsights', 'dateofdelivery', 'editorial', 'favoriteproducts', diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php index b80f6ca1b..20c9a2869 100644 --- a/controllers/front/AddressController.php +++ b/controllers/front/AddressController.php @@ -45,6 +45,7 @@ class AddressControllerCore extends FrontController { parent::setMedia(); $this->addJS(array( + _THEME_JS_DIR_.'tools/vatManagement.js', _THEME_JS_DIR_.'tools/statesManagement.js', _PS_JS_DIR_.'validate.js' )); @@ -58,41 +59,8 @@ class AddressControllerCore extends FrontController { parent::init(); - // Get address ID - $id_address = 0; - if ($this->ajax && Tools::isSubmit('type')) { - if (Tools::getValue('type') == 'delivery' && isset($this->context->cart->id_address_delivery)) { - $id_address = (int)$this->context->cart->id_address_delivery; - } elseif (Tools::getValue('type') == 'invoice' && isset($this->context->cart->id_address_invoice) - && $this->context->cart->id_address_invoice != $this->context->cart->id_address_delivery) { - $id_address = (int)$this->context->cart->id_address_invoice; - } - } else { - $id_address = Customer::getCustomerIdAddress($this->context->customer->id); - } - - // Initialize address - if ($id_address) { - $this->_address = new Address($id_address); - if (Validate::isLoadedObject($this->_address) && Customer::customerHasAddress($this->context->customer->id, $id_address)) { - if (Tools::isSubmit('delete')) { - if ($this->_address->delete()) { - if ($this->context->cart->id_address_invoice == $this->_address->id) { - unset($this->context->cart->id_address_invoice); - } - if ($this->context->cart->id_address_delivery == $this->_address->id) { - unset($this->context->cart->id_address_delivery); - $this->context->cart->updateAddressId($this->_address->id, (int)Address::getFirstCustomerAddressId(Context::getContext()->customer->id)); - } - Tools::redirect('index.php?controller=addresses'); - } - $this->errors[] = Tools::displayError('This address cannot be deleted.'); - } - } elseif ($this->ajax) { - exit; - } else { - // Tools::redirect('index.php?controller=addresses'); - } + if ($this->context->customer->id) { + $this->_address = new Address(Customer::getCustomerIdAddress($this->context->customer->id)); } } diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 32ab62ac7..5e1cdc661 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -47,6 +47,7 @@ class AuthControllerCore extends FrontController $this->confirmations = array(); $this->informations = array(); $this->errors = array(); + $this->ajaxExtraData = array(); if (!Tools::getIsset('step') && $this->context->customer->isLogged() && !$this->ajax) { Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); @@ -170,6 +171,8 @@ class AuthControllerCore extends FrontController 'informations' => $this->informations, 'hasError' => !empty($this->errors), 'errors' => $this->errors, + 'hasAjaxExtraData' => !empty($this->ajaxExtraData), + 'ajaxExtraData' => $this->ajaxExtraData, 'page' => $this->context->smarty->fetch($this->template), 'token' => Tools::getToken(false) ); @@ -416,51 +419,54 @@ class AuthControllerCore extends FrontController if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email)) { if (Customer::customerExists($email)) { $this->errors[] = Tools::displayError('An account using this email address has already been registered.', false); + } elseif (Customer::customerExists($email, false, false)) { + $this->errors[] = Tools::displayError('You are already registered as a guest with this email address.').' '.Tools::displayError('').' to generate a password for your account.'; } } - // Preparing customer - $customer = new Customer(); - $lastnameAddress = Tools::getValue('lastname'); - $firstnameAddress = Tools::getValue('firstname'); - $_POST['lastname'] = Tools::getValue('customer_lastname', $lastnameAddress); - $_POST['firstname'] = Tools::getValue('customer_firstname', $firstnameAddress); - $addresses_types = array('address'); - if (!Configuration::get('PS_ORDER_PROCESS_TYPE') && Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('invoice_address')) { - $addresses_types[] = 'address_invoice'; - } + if (!count($this->errors)) { + // Preparing customer + $customer = new Customer(); + $lastnameAddress = Tools::getValue('lastname'); + $firstnameAddress = Tools::getValue('firstname'); + $_POST['lastname'] = Tools::getValue('customer_lastname', $lastnameAddress); + $_POST['firstname'] = Tools::getValue('customer_firstname', $firstnameAddress); + $addresses_types = array('address'); - $error_phone = false; - if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { - if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) { - if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) { + if (!Configuration::get('PS_ORDER_PROCESS_TYPE') && Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('invoice_address')) { + $addresses_types[] = 'address_invoice'; + } + + $error_phone = false; + if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { + if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) { + if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) { + $error_phone = true; + } + } elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE')) + || (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create')) + || (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Tools::getValue('email_create'))) + && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) { $error_phone = true; } - } elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE')) - || (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create')) - || (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Tools::getValue('email_create'))) - && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) { - $error_phone = true; } - } - if ($error_phone) { - $this->errors[] = Tools::displayError('You must register at least one phone number.'); - } + if ($error_phone) { + $this->errors[] = Tools::displayError('You must register at least one phone number.'); + } - // if PS_CUSTOMER_ADDRESS_CREATION is disabled And customer has no addresses then create customer address - // with the details of first hotel which rooms he has in cart - if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION') - && isset($this->context->cart->id) - && $this->context->cart->id - ) { - if (Module::isInstalled('hotelreservationsystem')) { - include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; - $objHtlCart = new HotelCartBookingData(); - if ($htlCartInfo = $objHtlCart->getCartCurrentDataByCartId($this->context->cart->id)) { - if (isset($htlCartInfo[0]['id_hotel']) && ($idHotel = $htlCartInfo[0]['id_hotel'])) { - if ($objHotel = new HotelBranchInformation()) { - if ($address_info = $objHotel->getAddress($idHotel)) { + // if PS_CUSTOMER_ADDRESS_CREATION is disabled And customer has no addresses then create customer address + // with the details of first hotel which rooms he has in cart + if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION') + && isset($this->context->cart->id) + && $this->context->cart->id + ) { + if (Module::isInstalled('hotelreservationsystem')) { + include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; + $objHtlCart = new HotelCartBookingData(); + if ($htlCartInfo = $objHtlCart->getCartCurrentDataByCartId($this->context->cart->id)) { + if (isset($htlCartInfo[0]['id_hotel']) && ($idHotel = $htlCartInfo[0]['id_hotel'])) { + if ($address_info = HotelBranchInformation::getAddress($idHotel)) { $_POST['lastname'] = Tools::getValue('customer_lastname'); $_POST['firstname'] = Tools::getValue('customer_firstname'); $_POST['address1'] = $address_info['address1']; @@ -478,249 +484,249 @@ class AuthControllerCore extends FrontController } } } - } - // End - $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); + // End + $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); - // Check the requires fields which are settings in the BO - $this->errors = $this->errors + $customer->validateFieldsRequiredDatabase(); - - if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) { - if (!count($this->errors)) { - - $this->processCustomerNewsletter($customer); - - $customer->firstname = Tools::ucwords($customer->firstname); - $customer->birthday = (empty($_POST['years']) ? '' : (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days')); - if (!Validate::isBirthDate($customer->birthday)) { - $this->errors[] = Tools::displayError('Invalid date of birth.'); - } - - // New Guest customer - $customer->is_guest = (Tools::isSubmit('is_new_customer') ? !Tools::getValue('is_new_customer', 1) : 0); - $customer->active = 1; + // Check the requires fields which are settings in the BO + $this->errors = $this->errors + $customer->validateFieldsRequiredDatabase(); + if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) { if (!count($this->errors)) { - if ($customer->add()) { - if (!$customer->is_guest) { - if (!$this->sendConfirmationMail($customer)) { - $this->errors[] = Tools::displayError('The email cannot be sent.'); + + $this->processCustomerNewsletter($customer); + + $customer->firstname = Tools::ucwords($customer->firstname); + $customer->birthday = (empty($_POST['years']) ? '' : (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days')); + if (!Validate::isBirthDate($customer->birthday)) { + $this->errors[] = Tools::displayError('Invalid date of birth.'); + } + + // New Guest customer + $customer->is_guest = (Tools::isSubmit('is_new_customer') ? !Tools::getValue('is_new_customer', 1) : 0); + $customer->active = 1; + + if (!count($this->errors)) { + if ($customer->add()) { + if (!$customer->is_guest) { + if (!$this->sendConfirmationMail($customer)) { + $this->errors[] = Tools::displayError('The email cannot be sent.'); + } + } + + $this->updateContext($customer); + + $this->context->cart->update(); + Hook::exec('actionCustomerAccountAdd', array( + '_POST' => $_POST, + 'newCustomer' => $customer + )); + if ($this->ajax) { + $return = array( + 'hasError' => !empty($this->errors), + 'errors' => $this->errors, + 'isSaved' => true, + 'id_customer' => (int)$this->context->cookie->id_customer, + 'id_address_delivery' => $this->context->cart->id_address_delivery, + 'id_address_invoice' => $this->context->cart->id_address_invoice, + 'token' => Tools::getToken(false) + ); + $this->ajaxDie(json_encode($return)); + } + + if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) { + Tools::redirect(html_entity_decode($back)); + } + + // redirection: if cart is not empty : redirection to the cart + if (count($this->context->cart->getProducts(true)) > 0) { + $multi = (int)Tools::getValue('multi-shipping'); + Tools::redirect('index.php?controller=order'.($multi ? '&multi-shipping='.$multi : '')); + } + // else : redirection to the account + else { + Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); + } + } else { + $this->errors[] = Tools::displayError('An error occurred while creating your account.'); + } + } + } + } else { + // if registration type is in one step, we save the address + + $_POST['lastname'] = $lastnameAddress; + $_POST['firstname'] = $firstnameAddress; + $post_back = $_POST; + // Preparing addresses + foreach ($addresses_types as $addresses_type) { + $$addresses_type = new Address(); + $$addresses_type->id_customer = 1; + + if ($addresses_type == 'address_invoice') { + foreach ($_POST as $key => &$post) { + if ($tmp = Tools::getValue($key.'_invoice')) { + $post = $tmp; } } - - $this->updateContext($customer); - - $this->context->cart->update(); - Hook::exec('actionCustomerAccountAdd', array( - '_POST' => $_POST, - 'newCustomer' => $customer - )); - if ($this->ajax) { - $return = array( - 'hasError' => !empty($this->errors), - 'errors' => $this->errors, - 'isSaved' => true, - 'id_customer' => (int)$this->context->cookie->id_customer, - 'id_address_delivery' => $this->context->cart->id_address_delivery, - 'id_address_invoice' => $this->context->cart->id_address_invoice, - 'token' => Tools::getToken(false) - ); - $this->ajaxDie(json_encode($return)); - } - - if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) { - Tools::redirect(html_entity_decode($back)); - } - - // redirection: if cart is not empty : redirection to the cart - if (count($this->context->cart->getProducts(true)) > 0) { - $multi = (int)Tools::getValue('multi-shipping'); - Tools::redirect('index.php?controller=order'.($multi ? '&multi-shipping='.$multi : '')); - } - // else : redirection to the account - else { - Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); - } - } else { - $this->errors[] = Tools::displayError('An error occurred while creating your account.'); } - } - } - } else { - // if registration type is in one step, we save the address - $_POST['lastname'] = $lastnameAddress; - $_POST['firstname'] = $firstnameAddress; - $post_back = $_POST; - // Preparing addresses - foreach ($addresses_types as $addresses_type) { - $$addresses_type = new Address(); - $$addresses_type->id_customer = 1; - - if ($addresses_type == 'address_invoice') { - foreach ($_POST as $key => &$post) { - if ($tmp = Tools::getValue($key.'_invoice')) { - $post = $tmp; - } + $this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController())); + if ($addresses_type == 'address_invoice') { + $_POST = $post_back; } - } - $this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController())); - if ($addresses_type == 'address_invoice') { - $_POST = $post_back; - } + if (!($country = new Country($$addresses_type->id_country)) || !Validate::isLoadedObject($country)) { + $this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country'); + } - if (!($country = new Country($$addresses_type->id_country)) || !Validate::isLoadedObject($country)) { - $this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country'); - } + if (!$country->active) { + $this->errors[] = Tools::displayError('This country is not active.'); + } - if (!$country->active) { - $this->errors[] = Tools::displayError('This country is not active.'); - } + $postcode = $$addresses_type->postcode; + /* Check zip code format */ + if ($country->zip_code_format && !$country->checkZipCode($postcode)) { + $this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))); + } elseif (empty($postcode) && $country->need_zip_code) { + $this->errors[] = Tools::displayError('A Zip / Postal code is required.'); + } elseif ($postcode && !Validate::isPostCode($postcode)) { + $this->errors[] = Tools::displayError('The Zip / Postal code is invalid.'); + } - $postcode = $$addresses_type->postcode; - /* Check zip code format */ - if ($country->zip_code_format && !$country->checkZipCode($postcode)) { - $this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))); - } elseif (empty($postcode) && $country->need_zip_code) { - $this->errors[] = Tools::displayError('A Zip / Postal code is required.'); - } elseif ($postcode && !Validate::isPostCode($postcode)) { - $this->errors[] = Tools::displayError('The Zip / Postal code is invalid.'); - } - - if ($country->need_identification_number) { - if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')) { + if ($country->need_identification_number) { + if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')) { + $$addresses_type->dni = null; + } elseif (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))) { + $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.'); + } + } elseif (!$country->need_identification_number) { $$addresses_type->dni = null; - } elseif (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))) { - $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.'); } - } elseif (!$country->need_identification_number) { - $$addresses_type->dni = null; - } - if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) { - if (!($country = new Country($$addresses_type->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country)) { - $this->errors[] = Tools::displayError('Country is invalid'); + if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) { + if (!($country = new Country($$addresses_type->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country)) { + $this->errors[] = Tools::displayError('Country is invalid'); + } + } + $contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0; + $id_state = isset($$addresses_type) && is_object($$addresses_type) ? (int)$$addresses_type->id_state: 0; + if ((Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) && $contains_state && !$id_state) { + $this->errors[] = Tools::displayError('This country requires you to choose a State.'); } } - $contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0; - $id_state = isset($$addresses_type) && is_object($$addresses_type) ? (int)$$addresses_type->id_state: 0; - if ((Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) && $contains_state && !$id_state) { - $this->errors[] = Tools::displayError('This country requires you to choose a State.'); - } - } - } - - if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) { - $this->errors[] = Tools::displayError('Invalid date of birth'); - } - - if (!count($this->errors)) { - if (Customer::customerExists(Tools::getValue('email'))) { - $this->errors[] = Tools::displayError('An account using this email address has already been registered. Please enter a valid password or request a new one. ', false); } - $this->processCustomerNewsletter($customer); - - $customer->birthday = (empty($_POST['years']) ? '' : (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days')); - if (!Validate::isBirthDate($customer->birthday)) { + if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) { $this->errors[] = Tools::displayError('Invalid date of birth'); } if (!count($this->errors)) { - $customer->active = 1; - // New Guest customer - if (Tools::isSubmit('is_new_customer')) { - $customer->is_guest = !Tools::getValue('is_new_customer', 1); - } else { - $customer->is_guest = 0; + if (Customer::customerExists(Tools::getValue('email'))) { + $this->errors[] = Tools::displayError('An account using this email address has already been registered. Please enter a valid password or request a new one. ', false); } - if (!$customer->add()) { - $this->errors[] = Tools::displayError('An error occurred while creating your account.'); - } else { - foreach ($addresses_types as $addresses_type) { - $$addresses_type->id_customer = (int)$customer->id; - if ($addresses_type == 'address_invoice') { - foreach ($_POST as $key => &$post) { - if ($tmp = Tools::getValue($key.'_invoice')) { - $post = $tmp; + + $this->processCustomerNewsletter($customer); + + $customer->birthday = (empty($_POST['years']) ? '' : (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days')); + if (!Validate::isBirthDate($customer->birthday)) { + $this->errors[] = Tools::displayError('Invalid date of birth'); + } + + if (!count($this->errors)) { + $customer->active = 1; + // New Guest customer + if (Tools::isSubmit('is_new_customer')) { + $customer->is_guest = !Tools::getValue('is_new_customer', 1); + } else { + $customer->is_guest = 0; + } + if (!$customer->add()) { + $this->errors[] = Tools::displayError('An error occurred while creating your account.'); + } else { + foreach ($addresses_types as $addresses_type) { + $$addresses_type->id_customer = (int)$customer->id; + if ($addresses_type == 'address_invoice') { + foreach ($_POST as $key => &$post) { + if ($tmp = Tools::getValue($key.'_invoice')) { + $post = $tmp; + } } } - } - $this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController())); - if ($addresses_type == 'address_invoice') { - $_POST = $post_back; - } - if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$$addresses_type->add()) { - $this->errors[] = Tools::displayError('An error occurred while creating your address.'); - } - } - if (!count($this->errors)) { - if (!$customer->is_guest) { - $this->context->customer = $customer; - $customer->cleanGroups(); - // we add the guest customer in the default customer group - $customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP'))); - if (!$this->sendConfirmationMail($customer)) { - // webkul - we will not stop process on email delivery fails - //$this->errors[] = Tools::displayError('The email cannot be sent.'); + $this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController())); + if ($addresses_type == 'address_invoice') { + $_POST = $post_back; + } + if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$$addresses_type->add()) { + $this->errors[] = Tools::displayError('An error occurred while creating your address.'); } - } else { - $customer->cleanGroups(); - // we add the guest customer in the guest customer group - $customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP'))); - } - $this->updateContext($customer); - $this->context->cart->id_address_delivery = (int)Address::getFirstCustomerAddressId((int)$customer->id); - $this->context->cart->id_address_invoice = (int)Address::getFirstCustomerAddressId((int)$customer->id); - if (isset($address_invoice) && Validate::isLoadedObject($address_invoice)) { - $this->context->cart->id_address_invoice = (int)$address_invoice->id; } + if (!count($this->errors)) { + if (!$customer->is_guest) { + $this->context->customer = $customer; + $customer->cleanGroups(); + // we add the guest customer in the default customer group + $customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP'))); + if (!$this->sendConfirmationMail($customer)) { + // webkul - we will not stop process on email delivery fails + //$this->errors[] = Tools::displayError('The email cannot be sent.'); + } + } else { + $customer->cleanGroups(); + // we add the guest customer in the guest customer group + $customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP'))); + } + $this->updateContext($customer); + $this->context->cart->id_address_delivery = (int)Address::getFirstCustomerAddressId((int)$customer->id); + $this->context->cart->id_address_invoice = (int)Address::getFirstCustomerAddressId((int)$customer->id); + if (isset($address_invoice) && Validate::isLoadedObject($address_invoice)) { + $this->context->cart->id_address_invoice = (int)$address_invoice->id; + } - if ($this->ajax && Configuration::get('PS_ORDER_PROCESS_TYPE')) { - $delivery_option = array((int)$this->context->cart->id_address_delivery => (int)$this->context->cart->id_carrier.','); - $this->context->cart->setDeliveryOption($delivery_option); - } + if ($this->ajax && Configuration::get('PS_ORDER_PROCESS_TYPE')) { + $delivery_option = array((int)$this->context->cart->id_address_delivery => (int)$this->context->cart->id_carrier.','); + $this->context->cart->setDeliveryOption($delivery_option); + } - // If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated - $this->context->cart->update(); + // If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated + $this->context->cart->update(); - // Avoid articles without delivery address on the cart - $this->context->cart->autosetProductAddress(); + // Avoid articles without delivery address on the cart + $this->context->cart->autosetProductAddress(); - Hook::exec('actionCustomerAccountAdd', array( - '_POST' => $_POST, - 'newCustomer' => $customer - )); - if ($this->ajax) { - $return = array( - 'hasError' => !empty($this->errors), - 'errors' => $this->errors, - 'isSaved' => true, - 'id_customer' => (int)$this->context->cookie->id_customer, - 'id_address_delivery' => $this->context->cart->id_address_delivery, - 'id_address_invoice' => $this->context->cart->id_address_invoice, - 'token' => Tools::getToken(false) - ); - $this->ajaxDie(json_encode($return)); - } - // if registration type is in two steps, we redirect to register address - if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) { - Tools::redirect('index.php?controller=address'); - } + Hook::exec('actionCustomerAccountAdd', array( + '_POST' => $_POST, + 'newCustomer' => $customer + )); + if ($this->ajax) { + $return = array( + 'hasError' => !empty($this->errors), + 'errors' => $this->errors, + 'isSaved' => true, + 'id_customer' => (int)$this->context->cookie->id_customer, + 'id_address_delivery' => $this->context->cart->id_address_delivery, + 'id_address_invoice' => $this->context->cart->id_address_invoice, + 'token' => Tools::getToken(false) + ); + $this->ajaxDie(json_encode($return)); + } + // if registration type is in two steps, we redirect to register address + if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) { + Tools::redirect('index.php?controller=address'); + } - if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) { - Tools::redirect(html_entity_decode($back)); - } + if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) { + Tools::redirect(html_entity_decode($back)); + } - // redirection: if cart is not empty : redirection to the cart - if (count($this->context->cart->getProducts(true)) > 0) { - Tools::redirect('index.php?controller=order'.($multi = (int)Tools::getValue('multi-shipping') ? '&multi-shipping='.$multi : '')); - } - // else : redirection to the account - else { - Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); + // redirection: if cart is not empty : redirection to the cart + if (count($this->context->cart->getProducts(true)) > 0) { + Tools::redirect('index.php?controller=order'.($multi = (int)Tools::getValue('multi-shipping') ? '&multi-shipping='.$multi : '')); + } + // else : redirection to the account + else { + Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); + } } } } @@ -774,12 +780,21 @@ class AuthControllerCore extends FrontController */ protected function processTransformAccount() { - if (!Validate::isEmail($email = trim(Tools::getValue('email_create'))) || empty($email)) { + if (!Validate::isEmail($email = trim(Tools::getValue('email_create', Tools::getValue('email')))) || empty($email)) { $this->errors[] = Tools::displayError('Invalid email address.'); } elseif ($id_customer = Customer::customerExists($email, true, false)) { $customer = new Customer($id_customer); if ($customer->transformToCustomer($this->context->language->id)) { $this->confirmations[] = 'TRANSFORM_OK'; + + $back = ''; + if ($back == Tools::secureReferrer(Tools::getValue('back'))) { + $back = html_entity_decode($back); + } else { + $back = Tools::safeOutput($back); + } + $this->ajaxExtraData['redirect_link'] = $this->context->link->getPageLink('authentication'). + ($back ? '?back='.$back.'&' : '?').'guest_transform_success=1'; } else { $this->errors[] = Tools::displayError('Your guest account could not be transformed to a customer account.'); } diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php index 76b647759..e3a37df06 100644 --- a/controllers/front/CartController.php +++ b/controllers/front/CartController.php @@ -84,6 +84,9 @@ class CartControllerCore extends FrontController } elseif (Tools::getIsset('duplicate')) { $this->processDuplicateProduct(); CheckoutProcess::refreshCheckoutProcess(); + } elseif (Tools::getIsset('updateServiceProduct')) { + $this->processUpdateServiceProduct(); + CheckoutProcess::refreshCheckoutProcess(); } // Make redirection if (!$this->errors && !$this->ajax) { @@ -123,8 +126,8 @@ class CartControllerCore extends FrontController $customization_product = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)$this->context->cart->id.' AND `id_product` = '.(int)$this->id_product.' AND `id_customization` != '.(int)$this->customization_id); + $product = new Product((int)$this->id_product); if (count($customization_product)) { - $product = new Product((int)$this->id_product); if ($this->id_product_attribute > 0) { $minimal_quantity = (int)Attribute::getAttributeMinimalQty($this->id_product_attribute); } else { @@ -144,7 +147,41 @@ class CartControllerCore extends FrontController } } - if ($this->context->cart->deleteProduct($this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery)) { + if ($product->booking_product) { + // delete booking data from hotel booking table(do not delete from ps cart here) + $objCartBooking = new HotelCartBookingData(); + $objCartBooking->deleteCartBookingData($this->context->cart->id, $this->id_product, 0, 0, 0, 1); + $result = $this->context->cart->deleteProduct($this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery); + + // now get updated available rooms + $date_from = Tools::getValue('dateFrom'); + $date_to = Tools::getValue('dateTo'); + $date_from = date("Y-m-d", strtotime($date_from)); + $date_to = date("Y-m-d", strtotime($date_to)); + $objRoomType = new HotelRoomType(); + if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) { + if ($id_hotel = $roomTypeInfo['id_hotel']) { + $objBookingDetail = new HotelBookingDetail(); + $bookingParams = array( + 'date_from' => $date_from, + 'date_to' => $date_to, + 'hotel_id' => $id_hotel, + 'id_room_type' => $this->id_product, + 'only_search_data' => 1, + ); + if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) { + $total_available_rooms = $hotelRoomData['stats']['num_avail']; + } + } + } + if ($result) { + $this->context->cookie->avail_rooms = $total_available_rooms; + } + } else { + $result = $this->context->cart->deleteProduct($this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery); + } + + if ($result) { Hook::exec('actionAfterDeleteProductInCart', array( 'id_cart' => (int)$this->context->cart->id, 'id_product' => (int)$this->id_product, @@ -161,39 +198,6 @@ class CartControllerCore extends FrontController } } - if (Module::isInstalled('hotelreservationsystem')) { - require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; - - $id_cart = $this->context->cart->id; - $id_product = (int) $this->id_product; - $date_from = Tools::getValue('dateFrom'); - $date_to = Tools::getValue('dateTo'); - $date_from = date("Y-m-d", strtotime($date_from)); - $date_to = date("Y-m-d", strtotime($date_to)); - $objRoomType = new HotelRoomType(); - $objCartBooking = new HotelCartBookingData(); - // delete booking data from hotel booking table(do not delete from ps cart here) - $result = $objCartBooking->deleteCartBookingData($id_cart, $id_product, 0, 0, 0, 0); - if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($id_product)) { - if ($id_hotel = $roomTypeInfo['id_hotel']) { - $objBookingDetail = new HotelBookingDetail(); - $bookingParams = array( - 'date_from' => $date_from, - 'date_to' => $date_to, - 'hotel_id' => $id_hotel, - 'id_room_type' => $id_product, - 'only_search_data' => 1, - ); - if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) { - $total_available_rooms = $hotelRoomData['stats']['num_avail']; - } - } - } - if ($result) { - $this->context->cookie->avail_rooms = $total_available_rooms; - } - } - $removed = CartRule::autoRemoveFromCart(); CartRule::autoAddToCart(); if (count($removed) && (int)Tools::getValue('allow_refresh')) { @@ -264,34 +268,12 @@ class CartControllerCore extends FrontController protected function processChangeProductInCart() { $mode = (Tools::getIsset('update') && $this->id_product) ? 'update' : 'add'; - $date_from = Tools::getValue('dateFrom'); - $date_to = Tools::getValue('dateTo'); - $date_from = date("Y-m-d", strtotime($date_from)); - $date_to = date("Y-m-d", strtotime($date_to)); $operator = Tools::getValue('op', 'up'); - $occupancyRequiredForBooking = false; - if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) { - $occupancyRequiredForBooking = true; - } - - if ($occupancyRequiredForBooking) { - if ($occupancy = json_decode(Tools::getValue('occupancy'), true)) { - $this->qty = count($occupancy); - } else { - $this->errors[] = Tools::displayError('Invalid occupnacy.'); - } - } else { - $occupancy = Tools::getValue('qty'); - $this->qty = $occupancy; - } - $id_cart = $this->context->cart->id; $id_guest = $this->context->cart->id_guest; - if ($this->qty == 0) { - $this->errors[] = Tools::displayError('Null quantity.', !Tools::getValue('ajax')); - } elseif (!$this->id_product) { + if (!$this->id_product) { $this->errors[] = Tools::displayError('Product not found', !Tools::getValue('ajax')); } @@ -301,101 +283,168 @@ class CartControllerCore extends FrontController return; } - // valdiate occupancy if providede - if ($operator == 'up') { - if ($occupancyRequiredForBooking) { - foreach($occupancy as $key => $roomOccupancy) { - if (!isset($roomOccupancy['adults']) || !$roomOccupancy['adults'] || !Validate::isUnsignedInt($roomOccupancy['adults'])) { - $this->errors[] = sprintf(Tools::displayError('Invalid number of adults for Room %s.'), ($key + 1)); - } - if (isset($roomOccupancy['children'])) { - if (!Validate::isUnsignedInt($roomOccupancy['children'])) { - $this->errors[] = sprintf(Tools::displayError('Invalid number of children for Room %s.'), ($key + 1)); - } - if ($roomOccupancy['children'] > 0) { - if (!isset($roomOccupancy['child_ages']) || ($roomOccupancy['children'] != count($roomOccupancy['child_ages'])) || !is_array($roomOccupancy['child_ages'])) { - $this->errors[] = sprintf(Tools::displayError('Please provide all children age for Room %s.'), ($key + 1)); - } else { - if (is_array($roomOccupancy['child_ages'])) { - foreach($roomOccupancy['child_ages'] as $childAge) { - if (!Validate::isUnsignedInt($childAge)) { - $this->errors[] = sprintf(Tools::displayError('Invalid children age for Room %s.'), ($key + 1)); + if ($product->booking_product) { + $occupancyRequiredForBooking = false; + if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) { + $occupancyRequiredForBooking = true; + } + + if ($occupancyRequiredForBooking && $operator == 'up') { + if ($occupancy = json_decode(Tools::getValue('occupancy'), true)) { + $this->qty = count($occupancy); + } else { + $this->errors[] = Tools::displayError('Invalid occupnacy.'); + } + } else { + $occupancy = Tools::getValue('qty'); + $this->qty = $occupancy; + } + } + + if ($this->qty == 0) { + $this->errors[] = Tools::displayError('Null quantity.', !Tools::getValue('ajax')); + } + + // check if the product is booking product, if booking product will check room availability + if ($product->booking_product) { + // By Webkul : This code is to check available quantity of Room before adding it to cart. + // only check availability if qty is increasing + if (!$this->errors) { + $objRoomType = new HotelRoomType(); + if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) { + $date_from = Tools::getValue('dateFrom'); + $date_to = Tools::getValue('dateTo'); + $date_from = date("Y-m-d", strtotime($date_from)); + $date_to = date("Y-m-d", strtotime($date_to)); + $serviceProducts = json_decode(Tools::getValue('serviceProducts'),true); + + // valdiate occupancy if providede + if ($operator == 'up') { + if ($occupancyRequiredForBooking) { + foreach($occupancy as $key => $roomOccupancy) { + if (!isset($roomOccupancy['adults']) || !$roomOccupancy['adults'] || !Validate::isUnsignedInt($roomOccupancy['adults'])) { + $this->errors[] = sprintf(Tools::displayError('Invalid number of adults for Room %s.'), ($key + 1)); + } + if (isset($roomOccupancy['children'])) { + if (!Validate::isUnsignedInt($roomOccupancy['children'])) { + $this->errors[] = sprintf(Tools::displayError('Invalid number of children for Room %s.'), ($key + 1)); + } + if ($roomOccupancy['children'] > 0) { + if (!isset($roomOccupancy['child_ages']) || ($roomOccupancy['children'] != count($roomOccupancy['child_ages'])) || !is_array($roomOccupancy['child_ages'])) { + $this->errors[] = sprintf(Tools::displayError('Please provide all children age for Room %s.'), ($key + 1)); + } else { + if (is_array($roomOccupancy['child_ages'])) { + foreach($roomOccupancy['child_ages'] as $childAge) { + if (!Validate::isUnsignedInt($childAge)) { + $this->errors[] = sprintf(Tools::displayError('Invalid children age for Room %s.'), ($key + 1)); + } + } + } } } } } } } - } - } - } - // By Webkul : This code is to check available quantity of Room before adding it to cart. - // only check availability if qty is increasing - if (!$this->errors) { - $objRoomType = new HotelRoomType(); - if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) { - if ($id_hotel = $roomTypeInfo['id_hotel']) { - if (strtotime($date_from) < strtotime(date('Y-m-d'))) { - $this->errors[] = Tools::displayError('You can\'t book room before current date'); - } elseif (strtotime($date_from) >= strtotime($date_to)) { - $this->errors[] = Tools::displayError('Check-out date must be after check-in date'); - } elseif ($maxOrdDate = HotelOrderRestrictDate::getMaxOrderDate($id_hotel)) { - // Check Order restrict condition before adding in to cart - if (strtotime('-1 day', strtotime($maxOrdDate)) < strtotime($date_from) - || strtotime($maxOrdDate) < strtotime($date_to) - ) { - $maxOrdDate = date('d-m-Y', strtotime($maxOrdDate)); - $this->errors[] = Tools::displayError('You can\'t book room after date '.$maxOrdDate); - } - } - if ($occupancyRequiredForBooking) { - foreach($occupancy as $key => $roomOccupancy) { - if ($roomOccupancy['adults'] > $roomTypeInfo['max_adults']) { - $this->errors[] = sprintf(Tools::displayError('Room %s cannot have adults more than %s'), $key + 1, $roomTypeInfo['max_adults']); - } - if ($roomOccupancy['children'] > $roomTypeInfo['max_children']) { - $this->errors[] = sprintf(Tools::displayError('Room %s cannot have children more than %s'), $key + 1, $roomTypeInfo['max_children']); - } - if ($roomOccupancy['adults'] + $roomOccupancy['children'] > $roomTypeInfo['max_guests']) { - $this->errors[] = sprintf(Tools::displayError('Room %s cannot have total guests more than %s'), $key + 1, $roomTypeInfo['max_guests']); + + if ($id_hotel = $roomTypeInfo['id_hotel']) { + if (strtotime($date_from) < strtotime(date('Y-m-d'))) { + $this->errors[] = Tools::displayError('You can\'t book room before current date'); + } elseif (strtotime($date_from) >= strtotime($date_to)) { + $this->errors[] = Tools::displayError('Check-out date must be after check-in date'); + } elseif ($maxOrdDate = HotelOrderRestrictDate::getMaxOrderDate($id_hotel)) { + // Check Order restrict condition before adding in to cart + if (strtotime('-1 day', strtotime($maxOrdDate)) < strtotime($date_from) + || strtotime($maxOrdDate) < strtotime($date_to) + ) { + $maxOrdDate = date('d-m-Y', strtotime($maxOrdDate)); + $this->errors[] = Tools::displayError('You can\'t book room after date '.$maxOrdDate); } } - } - if (!$this->errors) { - $objBookingDetail = new HotelBookingDetail(); - $num_days = $objBookingDetail->getNumberOfDays($date_from, $date_to); - $req_rm = $this->qty; - $this->qty = $this->qty * (int) $num_days; - $objBookingDetail = new HotelBookingDetail(); - $bookingParams = array( - 'date_from' => $date_from, - 'date_to' => $date_to, - 'hotel_id' => $id_hotel, - 'id_room_type' => $this->id_product, - 'only_search_data' => 1, - 'id_cart' => $id_cart, - 'id_guest' => $id_guest, - ); - if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) { - if (isset($hotelRoomData['stats']['num_avail'])) { - $total_available_rooms = $hotelRoomData['stats']['num_avail']; - if (Tools::getValue('op', 'up') == 'up') { - if ($total_available_rooms < $req_rm) { - die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms))); + if ($occupancyRequiredForBooking) { + foreach($occupancy as $key => $roomOccupancy) { + if ($roomOccupancy['adults'] > $roomTypeInfo['max_adults']) { + $this->errors[] = sprintf(Tools::displayError('Room %s cannot have adults more than %s'), $key + 1, $roomTypeInfo['max_adults']); + } + if ($roomOccupancy['children'] > $roomTypeInfo['max_children']) { + $this->errors[] = sprintf(Tools::displayError('Room %s cannot have children more than %s'), $key + 1, $roomTypeInfo['max_children']); + } + if ($roomOccupancy['adults'] + $roomOccupancy['children'] > $roomTypeInfo['max_guests']) { + $this->errors[] = sprintf(Tools::displayError('Room %s cannot have total guests more than %s'), $key + 1, $roomTypeInfo['max_guests']); + } + } + } + if (!$this->errors) { + $objBookingDetail = new HotelBookingDetail(); + $num_days = $objBookingDetail->getNumberOfDays($date_from, $date_to); + $req_rm = $this->qty; + $this->qty = $this->qty * (int) $num_days; + $objBookingDetail = new HotelBookingDetail(); + $bookingParams = array( + 'date_from' => $date_from, + 'date_to' => $date_to, + 'hotel_id' => $id_hotel, + 'id_room_type' => $this->id_product, + 'only_search_data' => 1, + 'id_cart' => $id_cart, + 'id_guest' => $id_guest, + ); + if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) { + if (isset($hotelRoomData['stats']['num_avail'])) { + $total_available_rooms = $hotelRoomData['stats']['num_avail']; + if (Tools::getValue('op', 'up') == 'up') { + if ($total_available_rooms < $req_rm) { + die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms))); + } else { + // validate service products if available + if ($serviceProducts) { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + foreach ($serviceProducts as $key => $serviceProduct) { + if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($this->id_product, $serviceProduct['id_product'])) { + unset($serviceProducts[$key]); + } else { + if (Validate::isLoadedObject($objServiceProduct = new Product($serviceProduct['id_product']))) { + if (!$objServiceProduct->allow_multiple_quantity && $serviceProduct['quantity'] > 1) { + $serviceProducts[$key]['quantity'] = 1; + } else if ($objServiceProduct->max_quantity && $objServiceProduct->max_quantity < $serviceProduct['quantity'] ) { + $serviceProducts[$key]['quantity'] = $objServiceProduct->max_quantity; + } + } else { + $response['error'] = Tools::displayError('Service not Found'); + } + } + } + } + } } + } else { + $this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates'); } } else { $this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates'); } - } else { - $this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates'); } + } else { + die(json_encode(array('status' => 'failed3'))); } } else { - die(json_encode(array('status' => 'failed3'))); + die(json_encode(array('status' => 'failed4'))); + } + } + } else { + $obj_htl_cart_booking_data = new HotelCartBookingData(); + if ($product->service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) { + // if can be added without room type then we can directly add product in cart. + if (!$product->allow_multiple_quantity) { + // check if product already exists in cart. + if ($id_cart) { + if (cart::getProductQtyInCart($id_cart, $product->id)) { + $this->errors[] = Tools::displayError('You can only order one quantity for this product.'); + } + } } } else { - die(json_encode(array('status' => 'failed4'))); + $this->errors[] = Tools::displayError('cannot add product without room in cart'); } } @@ -454,7 +503,6 @@ class CartControllerCore extends FrontController if (!$product->hasAllRequiredCustomizableFields() && !$this->customization_id) { $this->errors[] = Tools::displayError('Please fill in all of the required fields, and then save your customizations.', !Tools::getValue('ajax')); } - if (!$this->errors) { $cart_rules = $this->context->cart->getCartRules(); $available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, (isset($this->context->customer->id) ? $this->context->customer->id : 0), true, true, true, $this->context->cart, false, true); @@ -464,35 +512,54 @@ class CartControllerCore extends FrontController * To add Rooms in hotel cart */ - $objHotelCartBookingData = new HotelCartBookingData(); - $roomDemand = json_decode(Tools::getValue('roomDemands'), true); - $roomDemand = json_encode($roomDemand); - $this->availQty = $total_available_rooms; - $update_quantity = $objHotelCartBookingData->updateRoomCartBookingData( - $this->id_product, - $occupancy, - $operator, - $id_hotel, - $date_from, - $date_to, - $roomDemand, - $id_cart, - $id_guest - ); - if ($operator == 'up') { - $this->availQty = $total_available_rooms - $req_rm; - $this->context->cookie->currentAddedProduct = json_encode(array( - 'date_from' => $date_from, - 'date_to' => $date_to, - 'id_product' => $this->id_product, - 'occupancy' => $occupancy, - 'room_demand' => $roomDemand, - 'req_rm' => $req_rm - )); + if ($product->booking_product) { + $objHotelCartBookingData = new HotelCartBookingData(); + $roomDemand = json_decode(Tools::getValue('roomDemands'), true); + $roomDemand = json_encode($roomDemand); + $this->availQty = $total_available_rooms; + $update_quantity = $objHotelCartBookingData->updateCartBooking( + $this->id_product, + $occupancy, + $operator, + $id_hotel, + 0, + $date_from, + $date_to, + $roomDemand, + $serviceProducts, + $id_cart, + $id_guest + ); + if ($operator == 'up') { + $this->availQty = $total_available_rooms - $req_rm; + $this->context->cookie->currentAddedProduct = json_encode(array( + 'date_from' => $date_from, + 'date_to' => $date_to, + 'id_product' => $this->id_product, + 'occupancy' => $occupancy, + 'room_demand' => $roomDemand, + 'req_rm' => $req_rm + )); + } else { + $this->availQty = $total_available_rooms + $req_rm; + } + $this->context->cookie->avail_rooms = $this->availQty; } else { - $this->availQty = $total_available_rooms + $req_rm; + $update_quantity = $this->context->cart->updateQty( + $this->qty, + $this->id_product, + $this->id_product_attribute, + $this->customization_id, + $operator, + $this->id_address_delivery + ); + if ($operator == 'up') { + $this->context->cookie->currentAddedProduct = json_encode(array( + 'id_product' => $this->id_product, + 'qty' => $this->qty + )); + } } - $this->context->cookie->avail_rooms = $this->availQty; /*------ BY Webkul ------*/ @@ -546,6 +613,67 @@ class CartControllerCore extends FrontController } } + protected function processUpdateServiceProduct() + { + $operator = Tools::getValue('operator', 'up'); + $idServiceProduct = Tools::getValue('id_product'); + $idCartBooking = Tools::getValue('id_cart_booking'); + $qty = Tools::getValue('qty'); + + if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { + + if ($operator == 'up') { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelCartBookingData->id_product, $idServiceProduct)) { + // validate quanitity + if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) { + if ($objProduct->available_for_order) { + if ($objProduct->allow_multiple_quantity) { + if (!Validate::isUnsignedInt($qty)) { + $this->errors[] = Tools::displayError('The quantity you\'ve entered is invalid.'); + } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) { + $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); + } + } else { + $qty = 1; + } + } else { + $this->errors[] = Tools::displayError('This Service is not available.'); + } + } else { + $this->errors[] = Tools::displayError('This Service is not available.'); + } + } else { + $this->errors[] = Tools::displayError('This Service is not available with selected room.'); + } + } + + if (empty($this->errors)) { + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct( + $idCartBooking, + $idServiceProduct, + $qty, + $this->context->cart->id, + $operator + )) { + $this->ajaxDie(json_encode(array( + 'hasError' => false + ))); + } else { + $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); + } + + } + } else { + $this->errors[] = Tools::displayError('Room not found. Please try reloading the page.'); + } + $this->ajaxDie(json_encode(array( + 'hasError' => true, + 'errors' => $this->errors + ))); + } + /** * Remove discounts on cart * diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 56512a942..79a61fbd3 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -53,7 +53,7 @@ class CategoryControllerCore extends FrontController $this->addCSS(array( // _THEME_CSS_DIR_.'scenes.css' => 'all', _THEME_CSS_DIR_.'category.css' => 'all', - // _THEME_CSS_DIR_.'product_list.css' => 'all', + _THEME_CSS_DIR_.'product_list.css' => 'all', )); } @@ -147,7 +147,7 @@ class CategoryControllerCore extends FrontController return; } - $htl_id_category = Tools::getValue('id_category'); + $id_category = Tools::getValue('id_category'); if (!($date_from = Tools::getValue('date_from'))) { $date_from = date('Y-m-d'); @@ -162,11 +162,7 @@ class CategoryControllerCore extends FrontController $currency = new Currency($this->context->currency->id); - if (Module::isInstalled('hotelreservationsystem')) { - require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; - - $id_hotel = HotelBranchInformation::getHotelIdByIdCategory($htl_id_category); - + if ($id_hotel = HotelBranchInformation::getHotelIdByIdCategory($id_category)) { $id_cart = $this->context->cart->id; $id_guest = $this->context->cookie->id_guest; @@ -183,8 +179,7 @@ class CategoryControllerCore extends FrontController $booking_data = $objBookingDetail->dataForFrontSearch($bookingParams); - $feat_img_dir = _PS_IMG_.'rf/'; - $ratting_img = _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png'; + $obj_booking_detail = new HotelBookingDetail(); $num_days = $obj_booking_detail->getNumberOfDays($date_from, $date_to); @@ -210,14 +205,25 @@ class CategoryControllerCore extends FrontController 'booking_date_from' => $date_from, 'booking_date_to' => $date_to, 'booking_data' => $booking_data, - 'feat_img_dir' => $feat_img_dir, - 'ratting_img' => $ratting_img, - 'currency' => $currency, 'max_order_date' => $max_order_date, 'order_date_restrict' => $order_date_restrict )); + } else { + Tools::redirect($this->context->link->getPageLink('index')); } + $feat_img_dir = _PS_IMG_.'rf/'; + $ratting_img = _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png'; + + $this->context->smarty->assign(array( + 'id_hotel' => $id_hotel, + 'currency' => $currency, + 'feat_img_dir' => $feat_img_dir, + 'ratting_img' => $ratting_img, + )); + + + /*if (isset($this->context->cookie->id_compare)) $this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare)); diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index e227fe592..dca2c4266 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -49,16 +49,16 @@ class GuestTrackingControllerCore extends FrontController { if (Tools::isSubmit('submitGuestTracking') || Tools::isSubmit('submitTransformGuestToCustomer')) { // These lines are here for retrocompatibility with old theme - $id_order = Tools::getValue('id_order'); + $idOrder = Tools::getValue('id_order'); $order_collection = array(); - if ($id_order) { - if (is_numeric($id_order)) { - $order = new Order((int)$id_order); + if ($idOrder) { + if (is_numeric($idOrder)) { + $order = new Order((int)$idOrder); if (Validate::isLoadedObject($order)) { $order_collection = Order::getByReference($order->reference); } } else { - $order_collection = Order::getByReference($id_order); + $order_collection = Order::getByReference($idOrder); } } @@ -71,7 +71,7 @@ class GuestTrackingControllerCore extends FrontController $email = Tools::getValue('email'); - if (empty($order_reference) && empty($id_order)) { + if (empty($order_reference) && empty($idOrder)) { $this->errors[] = Tools::displayError('Please provide your order\'s reference number.'); } elseif (empty($email)) { $this->errors[] = Tools::displayError('Please provide a valid email address.'); @@ -185,6 +185,7 @@ class GuestTrackingControllerCore extends FrontController include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; $objHtlBranchInfo = new HotelBranchInformation(); $objBookingDetail = new HotelBookingDetail(); + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); $objRoomType = new HotelRoomType(); $nonRequestedRooms = 0; @@ -225,130 +226,252 @@ class GuestTrackingControllerCore extends FrontController if ($orderProducts = $order->getProducts()) { $total_demands_price_te = 0; $total_demands_price_ti = 0; + $total_convenience_fee_te = 0; + $total_convenience_fee_ti = 0; foreach ($orderProducts as $type_key => $type_value) { if (in_array($type_value['product_id'], $processedProducts)) { continue; } - $processedProducts[] = $type_value['product_id']; + if ($type_value['is_booking_product']) { + $processedProducts[] = $type_value['product_id']; - $product = new Product($type_value['product_id'], false, $this->context->language->id); - $cover_image_arr = $product->getCover($type_value['product_id']); + $product = new Product($type_value['product_id'], false, $this->context->language->id); + $cover_image_arr = $product->getCover($type_value['product_id']); - if (!empty($cover_image_arr)) { - $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); - } else { - $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); - } - - if (isset($customer->id)) { - $obj_cart = new Cart($order->id_cart); - $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id); - } else { - $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']); - } - $rm_dtl = $objRoomType->getRoomTypeInfoByIdProduct($type_value['product_id']); - - $cartHotelData[$type_key]['id_product'] = $type_value['product_id']; - $cartHotelData[$type_key]['cover_img'] = $cover_img; - $cartHotelData[$type_key]['adults'] = $rm_dtl['adults']; - $cartHotelData[$type_key]['children'] = $rm_dtl['children']; - - $objBookingDemand = new HotelBookingDemands(); - foreach ($order_bk_data as $data_k => $data_v) { - $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); - - /*Product price when order was created*/ - $order_details_obj = new OrderDetail($data_v['id_order_detail']); - $prod_ord_dtl_name = $order_details_obj->product_name; - $cartHotelData[$type_key]['name'] = $prod_ord_dtl_name; - - $cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity; - $cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity; - - if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1; - - $num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days']; - $var_quant = (int) $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm']; - - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']*$var_quant; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']*$var_quant; - $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; - if ($data_v['is_back_order']) { - $anyBackOrder = 1; - } + if (!empty($cover_image_arr)) { + $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); } else { - $num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']); + $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); + } - $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1; - $cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; - $cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; - $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; + if (isset($customer->id)) { + $obj_cart = new Cart($order->id_cart); + $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id); + } else { + $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']); + } + $cartHotelData[$type_key]['id_product'] = $type_value['product_id']; + $cartHotelData[$type_key]['cover_img'] = $cover_img; - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; - if ($data_v['is_back_order']) { - $anyBackOrder = 1; + + $objBookingDemand = new HotelBookingDemands(); + foreach ($order_bk_data as $data_k => $data_v) { + $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); + + $cartHotelData[$type_key]['adults'] = $data_v['adults']; + $cartHotelData[$type_key]['children'] = $data_v['children']; + /*Product price when order was created*/ + $order_details_obj = new OrderDetail($data_v['id_order_detail']); + $cartHotelData[$type_key]['name'] = $order_details_obj->product_name; + $cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity; + $cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity; + + if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1; + + $num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days']; + $var_quant = (int) $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults']; + $cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += $data_v['total_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; + if ($data_v['is_back_order']) { + $anyBackOrder = 1; + } + } else { + $num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']); + $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1; + $cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; + $cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; + $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; + $cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; + if ($data_v['is_back_order']) { + $anyBackOrder = 1; + } } + + $cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + 0, + $data_v['date_from'], + $data_v['date_to'] + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + $data_v['id_room'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 1, + 1 + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + $data_v['id_room'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 1, + 0 + ); + $total_demands_price_ti += $extraDemandPriceTI; + $total_demands_price_te += $extraDemandPriceTE; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl; + + $feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']); + $cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff; + + $cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name']; + // add additional services products in hotel detail. + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'] + ); + + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 1 + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 0 + ); } - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( - $idOrder, - $type_value['product_id'], - 0, - $data_v['date_from'], - $data_v['date_to'] - ); - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0; + // get auto added price to be displayed with room price + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0; } - $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands( + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( $idOrder, - $type_value['product_id'], 0, + 0, + $type_value['product_id'], $data_v['date_from'], $data_v['date_to'], - 0, + $data_v['id_room'], 1, - 1 + 1, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM ); - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI; - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0; + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0; } - $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands( + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( $idOrder, - $type_value['product_id'], 0, + 0, + $type_value['product_id'], $data_v['date_from'], $data_v['date_to'], + $data_v['id_room'], + 1, 0, 1, - 0 + Product::PRICE_ADDITION_TYPE_WITH_ROOM ); - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE; - $total_demands_price_ti += $extraDemandPriceTI; - $total_demands_price_te += $extraDemandPriceTE; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl; + // calculate averages now + foreach ($cartHotelData[$type_key]['date_diff'] as $key => &$value) { + $value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6); + $value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6); - $feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']); - $cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff; + $value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6)); + $value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6)); + } + } else if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) { + if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) { + $total_convenience_fee_ti += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + $type_value['product_id'], + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1 + ); + $total_convenience_fee_te += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + $type_value['product_id'], + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1 + ); + } + } else { + // get all products that are independent. + if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) { + $product = new Product($type_value['product_id'], false, $this->context->language->id); + $cover_image_arr = $product->getCover($type_value['product_id']); - //enter hotel name - $hotelInfo = $objHtlBranchInfo->hotelBranchesInfo( - Configuration::get('PS_LANG_DEFAULT'), - 2, - 0, - $data_v['id_hotel'] - ); - $cartHotelData[$type_key]['hotel_name'] = $hotelInfo['hotel_name']; + if (!empty($cover_image_arr)) { + $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); + } else { + $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); + } + $cartServiceProducts[] = $type_value; + } } } } @@ -359,8 +482,15 @@ class GuestTrackingControllerCore extends FrontController null, $this->context->language->id ); + $customerGuestDetail = false; + if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) { + $customerGuestDetail = new OrderCustomerGuestDetail($id_customer_guest_detail); + } + $this->context->smarty->assign( array( + 'total_convenience_fee_ti' => $total_convenience_fee_ti, + 'total_convenience_fee_te' => $total_convenience_fee_te, 'total_demands_price_ti' => $total_demands_price_ti, 'total_demands_price_te' => $total_demands_price_te, 'any_back_order' => $anyBackOrder, @@ -369,6 +499,7 @@ class GuestTrackingControllerCore extends FrontController 'order_has_invoice' => $order->hasInvoice(), 'cart_htl_data' => $cartHotelData, 'non_requested_rooms' => $nonRequestedRooms, + 'customerGuestDetail' => $customerGuestDetail, ) ); //end diff --git a/controllers/front/HistoryController.php b/controllers/front/HistoryController.php index a28cc7567..397325c41 100644 --- a/controllers/front/HistoryController.php +++ b/controllers/front/HistoryController.php @@ -44,6 +44,7 @@ class HistoryControllerCore extends FrontController )); $this->addJqueryPlugin(array('fancybox')); //fancybox not found for some client theme $this->addJqueryPlugin(array('scrollTo', 'footable', 'footable-sort')); + $this->addJqueryUI('ui.tooltip', 'base', true); } /** diff --git a/controllers/front/OrderConfirmationController.php b/controllers/front/OrderConfirmationController.php index 228dde274..f86bbb14e 100644 --- a/controllers/front/OrderConfirmationController.php +++ b/controllers/front/OrderConfirmationController.php @@ -111,7 +111,17 @@ class OrderConfirmationControllerCore extends FrontController $orderTotalInfo['total_demands_price_ti'] = 0; $orderTotalInfo['total_products_te'] = 0; $orderTotalInfo['total_products_ti'] = 0; + $orderTotalInfo['total_rooms_te'] = 0; + $orderTotalInfo['total_rooms_ti'] = 0; + $orderTotalInfo['total_service_products_te'] = 0; + $orderTotalInfo['total_service_products_ti'] = 0; + $orderTotalInfo['total_services_te'] = 0; + $orderTotalInfo['total_services_ti'] = 0; + $orderTotalInfo['total_convenience_fee_te'] = 0; + $orderTotalInfo['total_convenience_fee_ti'] = 0; $orderTotalInfo['total_discounts'] = 0; + $orderTotalInfo['total_discounts_te'] = 0; + $orderTotalInfo['total_tax'] = 0; $orderTotalInfo['total_paid'] = 0; $orderTotalInfo['total_paid_real'] = 0; $orderTotalInfo['total_wrapping'] = 0; @@ -126,10 +136,14 @@ class OrderConfirmationControllerCore extends FrontController $orderTotalInfo['total_order_amount'] = 0; $hotelCartBookingData = new HotelCartBookingData(); $objBookingDemand = new HotelBookingDemands(); + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); foreach ($cartOrders as $cartOrder) { $idOrder = $cartOrder['id_order']; $objCartOrder = new Order($idOrder); $orderProducts = $objCartOrder->getProducts(); + + $cart_service_products = array(); + $cart_htl_data = array(); if (!empty($orderProducts)) { foreach ($orderProducts as $type_key => $type_value) { if (in_array($type_value['product_id'], $processed_product)) { @@ -138,6 +152,7 @@ class OrderConfirmationControllerCore extends FrontController $processed_product[] = $type_value['product_id']; $product = new Product($type_value['product_id'], false, $this->context->language->id); + $cover_image_arr = $product->getCover($type_value['product_id']); if (!empty($cover_image_arr)) { @@ -151,133 +166,254 @@ class OrderConfirmationControllerCore extends FrontController } else { $order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($idOrder, $customer->id_guest, $type_value['product_id']); } - $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']); + if ($rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id'])) { + $cart_htl_data[$type_key]['id_product'] = $type_value['product_id']; + $cart_htl_data[$type_key]['cover_img'] = $cover_img; + $cart_htl_data[$type_key]['adults'] = $rm_dtl['adults']; + $cart_htl_data[$type_key]['children'] = $rm_dtl['children']; - $cart_htl_data[$type_key]['id_product'] = $type_value['product_id']; - $cart_htl_data[$type_key]['cover_img'] = $cover_img; - $cart_htl_data[$type_key]['adults'] = $rm_dtl['adults']; - $cart_htl_data[$type_key]['children'] = $rm_dtl['children']; + foreach ($order_bk_data as $data_k => $data_v) { + $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); + /*Product price when order was created*/ + $order_details_obj = new OrderDetail($data_v['id_order_detail']); + $cart_htl_data[$type_key]['name'] = $order_details_obj->product_name; + // $ord_refnd_info = $obj_ord_ref_info->getOderRefundInfoByIdOrderIdProductByDate($this->id_order, $type_value['product_id'], $data_v['date_from'], $data_v['date_to']); + // if ($ord_refnd_info) { + // $stage_name = $obj_refund_stages->getNameById($ord_refnd_info['refund_stage_id']); + // } else { + // $non_requested_rooms = 1; + // } + $stage_name = ''; + if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) { + $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1; - foreach ($order_bk_data as $data_k => $data_v) { - $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); - /*Product price when order was created*/ - $order_details_obj = new OrderDetail($data_v['id_order_detail']); - $cart_htl_data[$type_key]['name'] = $order_details_obj->product_name; - //work on entring refund data - // $ord_refnd_info = $obj_ord_ref_info->getOderRefundInfoByIdOrderIdProductByDate($this->id_order, $type_value['product_id'], $data_v['date_from'], $data_v['date_to']); - // if ($ord_refnd_info) { - // $stage_name = $obj_refund_stages->getNameById($ord_refnd_info['refund_stage_id']); - // } else { - // $non_requested_rooms = 1; - // } - $stage_name = ''; - if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) { - $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1; + $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days']; + $var_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm']; - $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days']; - $var_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm']; + $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults']; + $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children']; - $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults']; - $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children']; + //// By webkul New way to calculate product prices with feature Prices + $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; + $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']*$var_quant; + $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']*$var_quant; + $cart_htl_data[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; + if ($data_v['is_back_order']) { + $any_back_order = 1; + } + //refund_stage + $cart_htl_data[$type_key]['date_diff'][$date_join]['stage_name'] = $stage_name; + } else { + $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); - //// By webkul New way to calculate product prices with feature Prices - $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; - $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']*$var_quant; - $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']*$var_quant; - $cart_htl_data[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; - if ($data_v['is_back_order']) { - $any_back_order = 1; + $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; + $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; + $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; + $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; + + $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; + $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; + + + // By webkul New way to calculate product prices with feature Prices + $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; + $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']; + $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']; + if ($data_v['is_back_order']) { + $any_back_order = 1; + } + //refund_stage + $cart_htl_data[$type_key]['date_diff'][$date_join]['stage_name'] = $stage_name; + $cart_htl_data[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; } - //refund_stage - $cart_htl_data[$type_key]['date_diff'][$date_join]['stage_name'] = $stage_name; + // $orderTotalInfo['total_rooms_te'] += $data_v['total_price_tax_excl']; + // $orderTotalInfo['total_rooms_ti'] += $data_v['total_price_tax_incl']; + $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + 0, + $data_v['date_from'], + $data_v['date_to'] + ); + if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) { + $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0; + } + $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + $data_v['id_room'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 1, + 1 + ); + $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI; + if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) { + $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0; + } + $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $type_value['product_id'], + $data_v['id_room'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 1, + 0 + ); + $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE; + $orderTotalInfo['total_demands_price_ti'] += $extraDemandPriceTI; + $orderTotalInfo['total_demands_price_te'] += $extraDemandPriceTE; + $cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl; + $cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl; + $cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl; + $cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl; + + $feature_price_diff = (float)($cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']); + $cart_htl_data[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff; + + //enter hotel name + $cart_htl_data[$type_key]['hotel_name'] = $data_v['hotel_name']; + + // add additional services products in hotel detail. + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'] + ); + if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) { + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0; + } + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $extraDemandPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 1 + ); + if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) { + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0; + } + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $extraDemandPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 0 + ); + // get auto added price to be displayed with room price + if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) { + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0; + } + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 1, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); + if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) { + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0; + } + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 0, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); + } + } else if ($product->service_product_type == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) { + if ($product->auto_add_to_cart && $product->price_addition_type == Product::PRICE_ADDITION_TYPE_INDEPENDENT) { + $orderTotalInfo['total_convenience_fee_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + $type_value['product_id'], + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1 + ); + $orderTotalInfo['total_convenience_fee_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + $type_value['product_id'], + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1 + ); + } + } else if ($product->service_product_type == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) { + $cover_image_arr = $product->getCover($type_value['product_id']); + + if (!empty($cover_image_arr)) { + $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); } else { - $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); - - $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; - $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; - $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; - $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; - - $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; - $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; - - - // By webkul New way to calculate product prices with feature Prices - $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; - $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']; - $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']; - if ($data_v['is_back_order']) { - $any_back_order = 1; - } - //refund_stage - $cart_htl_data[$type_key]['date_diff'][$date_join]['stage_name'] = $stage_name; - $cart_htl_data[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; + $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); } - $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( - $idOrder, - $type_value['product_id'], - 0, - $data_v['date_from'], - $data_v['date_to'] - ); - if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) { - $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0; - } - $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands( - $idOrder, - $type_value['product_id'], - $data_v['id_room'], - $data_v['date_from'], - $data_v['date_to'], - 0, - 1, - 1 - ); - $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI; - if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) { - $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0; - } - $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands( - $idOrder, - $type_value['product_id'], - $data_v['id_room'], - $data_v['date_from'], - $data_v['date_to'], - 0, - 1, - 0 - ); - $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE; - $orderTotalInfo['total_demands_price_ti'] += $extraDemandPriceTI; - $orderTotalInfo['total_demands_price_te'] += $extraDemandPriceTE; - $cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl; - $cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl; - $cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl; - $cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl; + // $orderTotalInfo['total_service_products_te'] += $type_value['total_price_tax_excl']; + // $orderTotalInfo['total_service_products_ti'] += $type_value['total_price_tax_incl']; + $cart_service_products[] = $type_value; - $feature_price_diff = (float)($cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']); - $cart_htl_data[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff; - - //enter hotel name - $cart_htl_data[$type_key]['hotel_name'] = $data_v['hotel_name']; } } + + if (!empty($cart_htl_data)) { + $this->context->smarty->assign('cart_htl_data', $cart_htl_data); + } + if (!empty($cart_service_products)) { + $this->context->smarty->assign('cart_service_products', $cart_service_products); + } } if (!$objCartOrder->hasInvoice()) { $orders_has_invoice = 0; } - $orderTotalInfo['total_wrapping'] += $objCartOrder->total_wrapping; - $orderTotalInfo['total_products_te'] += $objCartOrder->getTotalProductsWithoutTaxes(); - $orderTotalInfo['total_products_ti'] += $objCartOrder->getTotalProductsWithTaxes(); + $orderTotalInfo['total_rooms_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, true); + $orderTotalInfo['total_rooms_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, true); + $orderTotalInfo['total_service_products_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE); + $orderTotalInfo['total_service_products_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE); + $orderTotalInfo['total_services_te'] += $objCartOrder->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $orderTotalInfo['total_demands_price_te']; + $orderTotalInfo['total_services_ti'] += $objCartOrder->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $orderTotalInfo['total_demands_price_ti']; $orderTotalInfo['total_discounts'] += $objCartOrder->total_discounts; + $orderTotalInfo['total_discounts_te'] += $objCartOrder->total_discounts_tax_excl; + $orderTotalInfo['total_tax'] += $objCartOrder->total_paid_tax_incl - $objCartOrder->total_paid_tax_excl; $orderTotalInfo['total_paid'] += $objCartOrder->total_paid; $orderTotalInfo['total_paid_real'] += $objCartOrder->total_paid_real; } - - $this->context->smarty->assign('cart_htl_data', $cart_htl_data); } $this->context->smarty->assign('orderTotalInfo', $orderTotalInfo); @@ -354,6 +490,7 @@ class OrderConfirmationControllerCore extends FrontController $this->addCSS(_THEME_CSS_DIR_.'history.css'); $this->addJS(_THEME_JS_DIR_.'history.js'); $this->addJqueryPlugin(array('fancybox')); //fancybox not found for some client theme + $this->addJqueryUI('ui.tooltip', 'base', true); } } } diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index fdb54ae3a..286061863 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -163,93 +163,117 @@ class OrderDetailControllerCore extends FrontController $this->errors[] = Tools::displayError('Order ID required'); } else { $order = new Order($id_order); - // Here handle request from the ajax on order details page i.e refund, additional qty etc - $method = Tools::getValue('method'); - // extra demands popup ajax - if ($method == 'getRoomTypeBookingDemands') { - $extraDemandsTpl = ''; - if (($idProduct = Tools::getValue('id_product')) - && ($idOrder = Tools::getValue('id_order')) - && ($dateFrom = Tools::getValue('date_from')) - && ($dateTo = Tools::getValue('date_to')) - ) { - $objBookingDemand = new HotelBookingDemands(); - $useTax = 0; - $customer = Context::getContext()->customer; - if (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC) { - $useTax = 1; - } - if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands( - $idOrder, - $idProduct, - 0, - $dateFrom, - $dateTo, - 1, - 0, - $useTax - )) { - $this->context->smarty->assign( - array( + if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) { + // Here handle request from the ajax on order details page i.e refund, additional qty etc + $method = Tools::getValue('method'); + // extra demands popup ajax + if ($method == 'getRoomTypeBookingDemands') { + $response = array('reload' => false); + if (($idProduct = Tools::getValue('id_product')) + && ($idOrder = Tools::getValue('id_order')) + && ($dateFrom = Tools::getValue('date_from')) + && ($dateTo = Tools::getValue('date_to')) + ) { + $objBookingDemand = new HotelBookingDemands(); + $useTax = 0; + $customer = Context::getContext()->customer; + if (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC) { + $useTax = 1; + } + if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands( + $idOrder, + $idProduct, + 0, + $dateFrom, + $dateTo, + 1, + 0, + $useTax + )) { + $this->context->smarty->assign( + array( + 'useTax' => $useTax, + 'extraDemands' => $extraDemands, + ) + ); + } + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); + if ($additionalServices = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $idOrder, + 0, + 0, + $idProduct, + $dateFrom, + $dateTo, + 0, + 0, + $useTax + )) { + $this->context->smarty->assign(array( 'useTax' => $useTax, - 'extraDemands' => $extraDemands, - ) - ); - $extraDemandsTpl .= $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order_booking_demands.tpl'); + 'additionalServices' => $additionalServices, + )); + } + $response['extra_demands'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order_booking_demands.tpl'); } - } - die($extraDemandsTpl); - } elseif ($method == 'submitRefundRequest') { // room cancellation ajax - $hasError = 0; - if (!$refundReason = Tools::getValue('cancellation_reason')) { - $hasError = 1; - } elseif (!Validate::isCleanHtml($refundReason)) { - $hasError = 1; - } - if ($bookingRefunds = Tools::getValue('bookings_to_refund')) { - if (!count($bookingRefunds = json_decode($bookingRefunds, true))) { + die(json_encode($response)); + } elseif ($method == 'submitRefundRequest') { // room cancellation ajax + $hasError = 0; + if (!$refundReason = Tools::getValue('cancellation_reason')) { $hasError = 1; - } else { - foreach ($bookingRefunds as $idHtlBooking) { - if (OrderReturn::getOrdersReturnDetail($order->id, 0, $idHtlBooking)) { - $hasError = 1; - break; + } elseif (!Validate::isCleanHtml($refundReason)) { + $hasError = 1; + } + if ($bookingRefunds = Tools::getValue('bookings_to_refund')) { + if (!count($bookingRefunds = json_decode($bookingRefunds, true))) { + $hasError = 1; + } else { + foreach ($bookingRefunds as $idHtlBooking) { + $objHotelBookingDetail = new HotelBookingDetail($idHtlBooking); + if ($objHotelBookingDetail->id_customer != $order->id_customer + || OrderReturn::getOrdersReturnDetail($order->id, 0, $idHtlBooking) + ) { + $hasError = 1; + break; + } } } + } else { + $hasError = 1; } - } else { - $hasError = 1; - } - if (!$hasError) { - $objOrderReturn = new OrderReturn(); - $objOrderReturn->id_customer = $order->id_customer; - $objOrderReturn->id_order = $order->id; - $objOrderReturn->state = 0; - $objOrderReturn->by_admin = 0; - $objOrderReturn->question = $refundReason; - $objOrderReturn->save(); - if ($objOrderReturn->id) { - foreach ($bookingRefunds as $idHtlBooking) { - $objHtlBooking = new HotelBookingDetail($idHtlBooking); - $numDays = $objHtlBooking->getNumberOfDays( - $objHtlBooking->date_from, - $objHtlBooking->date_to - ); + if (!$hasError) { + $objOrderReturn = new OrderReturn(); + $objOrderReturn->id_customer = $order->id_customer; + $objOrderReturn->id_order = $order->id; + $objOrderReturn->state = 0; + $objOrderReturn->by_admin = 0; + $objOrderReturn->question = $refundReason; + $objOrderReturn->save(); + if ($objOrderReturn->id) { + foreach ($bookingRefunds as $idHtlBooking) { + $objHtlBooking = new HotelBookingDetail($idHtlBooking); + $numDays = $objHtlBooking->getNumberOfDays( + $objHtlBooking->date_from, + $objHtlBooking->date_to + ); - $objOrderReturnDetail = new OrderReturnDetail(); - $objOrderReturnDetail->id_order_return = $objOrderReturn->id; - $objOrderReturnDetail->id_order_detail = $objHtlBooking->id_order_detail; - $objOrderReturnDetail->product_quantity = $numDays; - $objOrderReturnDetail->id_htl_booking = $idHtlBooking; - $objOrderReturnDetail->save(); + $objOrderReturnDetail = new OrderReturnDetail(); + $objOrderReturnDetail->id_order_return = $objOrderReturn->id; + $objOrderReturnDetail->id_order_detail = $objHtlBooking->id_order_detail; + $objOrderReturnDetail->product_quantity = $numDays; + $objOrderReturnDetail->id_htl_booking = $idHtlBooking; + $objOrderReturnDetail->save(); + } } - } - // Emails to customer, admin on refund request state change - $objOrderReturn->changeIdOrderReturnState(Configuration::get('PS_ORS_PENDING')); + // Emails to customer, admin on refund request state change + $objOrderReturn->changeIdOrderReturnState(Configuration::get('PS_ORS_PENDING')); - die(json_encode(array('status' => 1))); + die(json_encode(array('status' => 1))); + } + die(json_encode(array('status' => 0))); } + } else { die(json_encode(array('status' => 0))); } // END ajax request handle @@ -283,150 +307,270 @@ class OrderDetailControllerCore extends FrontController //by webkul to show order details properly on order history page - if (Module::isInstalled('hotelreservationsystem')) { - include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; - $objHtlBranchInfo = new HotelBranchInformation(); + // if (Module::isInstalled('hotelreservationsystem')) { + // include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; + // $objHtlBranchInfo = new HotelBranchInformation(); $objBookingDetail = new HotelBookingDetail(); $objRoomType = new HotelRoomType(); $objBookingDemand = new HotelBookingDemands(); + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); $nonRequestedRooms = 1; $anyBackOrder = 0; $processedProducts = array(); $cartHotelData = array(); + $cartServiceProducts = array(); $total_demands_price_te = 0; $total_demands_price_ti = 0; - + $total_convenience_fee_te = 0; + $total_convenience_fee_ti = 0; if (!empty($products)) { foreach ($products as $type_key => $type_value) { if (in_array($type_value['product_id'], $processedProducts)) { continue; } - $processedProducts[] = $type_value['product_id']; + if ($type_value['is_booking_product']) { + $processedProducts[] = $type_value['product_id']; - $product = new Product($type_value['product_id'], false, $this->context->language->id); - $cover_image_arr = $product->getCover($type_value['product_id']); + $product = new Product($type_value['product_id'], false, $this->context->language->id); + $cover_image_arr = $product->getCover($type_value['product_id']); - if (!empty($cover_image_arr)) { - $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); - } else { - $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); - } - - if (isset($customer->id)) { - $obj_cart = new Cart($order->id_cart); - $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id); - } else { - $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']); - } - $rm_dtl = $objRoomType->getRoomTypeInfoByIdProduct($type_value['product_id']); - $cartHotelData[$type_key]['id_product'] = $type_value['product_id']; - $cartHotelData[$type_key]['cover_img'] = $cover_img; - - $objBookingDemand = new HotelBookingDemands(); - foreach ($order_bk_data as $data_k => $data_v) { - $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); - - /*Product price when order was created*/ - $order_details_obj = new OrderDetail($data_v['id_order_detail']); - $cartHotelData[$type_key]['name'] = $order_details_obj->product_name; - $cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity; - $cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity; - - if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1; - - $num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days']; - - $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults']; - $cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children']; - - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += $data_v['total_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; - if ($data_v['is_back_order']) { - $anyBackOrder = 1; - } + if (!empty($cover_image_arr)) { + $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); } else { - $num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']); - $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1; - $cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; - $cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; - $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; - $cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; + $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); + } - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']; - $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; - if ($data_v['is_back_order']) { - $anyBackOrder = 1; + if (isset($customer->id)) { + $obj_cart = new Cart($order->id_cart); + $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $obj_cart->id_guest, $type_value['product_id'], $customer->id); + } else { + $order_bk_data = $objBookingDetail->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']); + } + $cartHotelData[$type_key]['id_product'] = $type_value['product_id']; + $cartHotelData[$type_key]['cover_img'] = $cover_img; + + + $objBookingDemand = new HotelBookingDemands(); + foreach ($order_bk_data as $data_k => $data_v) { + $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); + + $cartHotelData[$type_key]['adults'] = $data_v['adults']; + $cartHotelData[$type_key]['children'] = $data_v['children']; + /*Product price when order was created*/ + $order_details_obj = new OrderDetail($data_v['id_order_detail']); + $cartHotelData[$type_key]['name'] = $order_details_obj->product_name; + $cartHotelData[$type_key]['paid_unit_price_tax_excl'] = ($order_details_obj->total_price_tax_excl)/$order_details_obj->product_quantity; + $cartHotelData[$type_key]['paid_unit_price_tax_incl'] = ($order_details_obj->total_price_tax_incl)/$order_details_obj->product_quantity; + + if (isset($cartHotelData[$type_key]['date_diff'][$date_join])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] += 1; + + $num_days = $cartHotelData[$type_key]['date_diff'][$date_join]['num_days']; + $var_quant = (int) $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults']; + $cartHotelData[$type_key]['date_diff'][$date_join]['children'] += $data_v['children']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += $data_v['total_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += $data_v['total_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; + if ($data_v['is_back_order']) { + $anyBackOrder = 1; + } + } else { + $num_days = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']); + $cartHotelData[$type_key]['date_diff'][$date_join]['num_rm'] = 1; + $cartHotelData[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; + $cartHotelData[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; + $cartHotelData[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; + $cartHotelData[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = $data_v['total_price_tax_incl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = $data_v['total_price_tax_excl']; + $cartHotelData[$type_key]['date_diff'][$date_join]['is_backorder'] = $data_v['is_back_order']; + if ($data_v['is_back_order']) { + $anyBackOrder = 1; + } } + + $cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id']; + + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( + $id_order, + $type_value['product_id'], + 0, + $data_v['date_from'], + $data_v['date_to'] + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands( + $id_order, + $type_value['product_id'], + $data_v['id_room'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 1, + 1 + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands( + $id_order, + $type_value['product_id'], + $data_v['id_room'], + $data_v['date_from'], + $data_v['date_to'], + 0, + 1, + 0 + ); + $total_demands_price_ti += $extraDemandPriceTI; + $total_demands_price_te += $extraDemandPriceTE; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl; + $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl; + + $feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']); + $cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff; + + $cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name']; + // add additional services products in hotel detail. + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $id_order, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'] + ); + + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $additionalServicesPriceTI = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $id_order, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 1 + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $additionalServicesPriceTE = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $id_order, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 0 + ); + // get auto added price to be displayed with room price + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $id_order, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 1, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); + if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'])) { + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] = 0; + } + $cartHotelData[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te'] += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $id_order, + 0, + 0, + $type_value['product_id'], + $data_v['date_from'], + $data_v['date_to'], + $data_v['id_room'], + 1, + 0, + 1, + Product::PRICE_ADDITION_TYPE_WITH_ROOM + ); } + // calculate averages now + foreach ($cartHotelData[$type_key]['date_diff'] as $key => &$value) { + $value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6); + $value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6); - $cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id']; - - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands( - $id_order, - $type_value['product_id'], - 0, - $data_v['date_from'], - $data_v['date_to'] - ); - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0; + $value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6)); + $value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6)); } - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands( - $id_order, - $type_value['product_id'], - $data_v['id_room'], - $data_v['date_from'], - $data_v['date_to'], - 0, - 1, - 1 - ); - if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) { - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0; + } else if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) { + if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) { + $total_convenience_fee_ti += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $id_order, + $type_value['product_id'], + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1 + ); + $total_convenience_fee_te += $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( + $id_order, + $type_value['product_id'], + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1 + ); } - $cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands( - $id_order, - $type_value['product_id'], - $data_v['id_room'], - $data_v['date_from'], - $data_v['date_to'], - 0, - 1, - 0 - ); - $total_demands_price_ti += $extraDemandPriceTI; - $total_demands_price_te += $extraDemandPriceTE; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl; - $cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] = $order_details_obj->unit_price_tax_incl + $order_details_obj->reduction_amount_tax_incl; + } else { + // get all products that are independent. + if ($type_value['product_service_type'] == Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE) { + $product = new Product($type_value['product_id'], false, $this->context->language->id); + $cover_image_arr = $product->getCover($type_value['product_id']); - $feature_price_diff = (float)($cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_incl'] - $cartHotelData[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl']); - $cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff; - - $cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name']; + if (!empty($cover_image_arr)) { + $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $product->id.'-'.$cover_image_arr['id_image'], 'small_default'); + } else { + $type_value['cover_img'] = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code.'-default', 'small_default'); + } + $cartServiceProducts[] = $type_value; + } } - // calculate averages now - foreach ($cartHotelData[$type_key]['date_diff'] as $key => &$value) { - $value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6); - $value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6); - $value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6)); - $value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6)); - } } $redirectTermsLink = $this->context->link->getCMSLink(new CMS(3, $this->context->language->id), null, $this->context->language->id); @@ -435,6 +579,8 @@ class OrderDetailControllerCore extends FrontController array( 'id_cms_refund_policy' => Configuration::get('WK_GLOBAL_REFUND_POLICY_CMS'), 'THEME_DIR' => _THEME_DIR_, + 'total_convenience_fee_ti' => $total_convenience_fee_ti, + 'total_convenience_fee_te' => $total_convenience_fee_te, 'total_demands_price_ti' => $total_demands_price_ti, 'total_demands_price_te' => $total_demands_price_te, 'any_back_order' => $anyBackOrder, @@ -442,10 +588,11 @@ class OrderDetailControllerCore extends FrontController 'back_ord_msg' => Configuration::get('WK_BO_MESSAGE'), 'order_has_invoice' => $order->hasInvoice(), 'cart_htl_data' => $cartHotelData, + 'cart_service_products' => $cartServiceProducts, 'non_requested_rooms' => $nonRequestedRooms, ) ); - } + // } $objOrderReturn = new OrderReturn(); $refundedAmount = 0; @@ -461,7 +608,6 @@ class OrderDetailControllerCore extends FrontController 'refundReqBookings' => $refundReqBookings, 'hasCompletelyRefunded' => $order->hasCompletelyRefunded(), 'refundedAmount' => $refundedAmount, - 'shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'guestInformations' => (array)new Customer($order->id_customer), diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index c45aa2d48..0c8e1a446 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -338,7 +338,7 @@ class OrderOpcControllerCore extends ParentOrderController $this->ajaxDie(); break; case 'getRoomTypeBookingDemands': - $this->ajaxDie($this->getRoomTypeBookingDemands()); + $this->ajaxDie($this->getRoomTypeBookingServices()); exit; break; case 'changeRoomDemands': @@ -389,6 +389,9 @@ class OrderOpcControllerCore extends ParentOrderController */ public function initContent() { + // check all service products are available + RoomTypeServiceProductCartDetail::validateServiceProductsInCart(); + parent::initContent(); // check ORDER RESTRICT condition before payment by the customer @@ -453,21 +456,17 @@ class OrderOpcControllerCore extends ParentOrderController $this->context->smarty->assign('checkout_process_steps', $this->checkoutProcess->getSteps()); // set room type demands - $objCartBookingData = new HotelCartBookingData(); - $objGlobalDemand = new HotelRoomTypeGlobalDemand(); - $allDemands = $objGlobalDemand->getAllDemands(); - $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); - $totalFacilityCostTI = $objCartBookingData->getCartExtraDemands($this->context->cart->id, 0, 0, 0, 0, 1, 0, 1); - $totalFacilityCostTE = $objCartBookingData->getCartExtraDemands($this->context->cart->id, 0, 0, 0, 0, 1, 0, 0); + // $objGlobalDemand = new HotelRoomTypeGlobalDemand(); + // $allDemands = $objGlobalDemand->getAllDemands(); + // $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $this->context->smarty->assign( array( 'orderRestrictErr' => $orderRestrictErr, - 'additional_facilities_tax' => ($totalFacilityCostTI - $totalFacilityCostTE), - 'totalFacilityCostTE' => $totalFacilityCostTE, - 'allDemands' => $allDemands, - 'defaultcurrencySign' => $objCurrency->sign, + // 'allDemands' => $allDemands, + // 'defaultcurrencySign' => $objCurrency->sign, 'THEME_DIR' => _THEME_DIR_, 'PS_CUSTOMER_ADDRESS_CREATION' => Configuration::get('PS_CUSTOMER_ADDRESS_CREATION'), + 'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => Configuration::get('PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN'), 'free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, @@ -550,15 +549,21 @@ class OrderOpcControllerCore extends ParentOrderController $this->setTemplate(_PS_THEME_DIR_ . 'order-opc-advanced.tpl'); } else { // set used objects in the below code - $objBookingDetail = new HotelBookingDetail(); - $objHtlRoomType = new HotelRoomType(); + // $objBookingDetail = new HotelBookingDetail(); + // $objHtlRoomType = new HotelRoomType(); - $roomTypeList = $this->context->cart->getProducts(); - if (!empty($roomTypeList)) { + $cartProducts = $this->context->cart->getProducts(); + + if (!empty($cartProducts)) { if ($cartBookingInfo = HotelCartBookingData::getHotelCartBookingData()) { + // ddd($cartBookingInfo); $this->context->smarty->assign('cart_htl_data', $cartBookingInfo); } + $objHotelServiceProductCartDetail = new HotelServiceProductCartDetail(); + if ($normalCartProduct = $objHotelServiceProductCartDetail->getHotelProducts($this->context->cart->id, 0, 0, 0, null, null, true)) { + $this->context->smarty->assign('cart_normal_data', $normalCartProduct); + } // For Advanced Payment work $objAdvPayment = new HotelAdvancedPayment(); @@ -665,6 +670,7 @@ class OrderOpcControllerCore extends ParentOrderController 'invoice_company' => Tools::htmlentitiesUTF8($address_invoice->company), 'invoice_lastname' => Tools::htmlentitiesUTF8($address_invoice->lastname), 'invoice_firstname' => Tools::htmlentitiesUTF8($address_invoice->firstname), + 'invoice_vat_number' => Tools::htmlentitiesUTF8($address_invoice->vat_number), 'invoice_dni' => Tools::htmlentitiesUTF8($address_invoice->dni), 'invoice_address' => $this->context->cart->id_address_invoice !== $this->context->cart->id_address_delivery, 'invoice_address1' => Tools::htmlentitiesUTF8($address_invoice->address1), @@ -944,9 +950,9 @@ class OrderOpcControllerCore extends ParentOrderController return $result; } - public function getRoomTypeBookingDemands() + public function getRoomTypeBookingServices() { - $extraDemandsTpl = ''; + $response = array('reload' => true); if ($idProduct = Tools::getValue('id_product')) { if (($dateFrom = Tools::getValue('date_from')) && ($dateTo = Tools::getValue('date_to')) @@ -980,14 +986,32 @@ class OrderOpcControllerCore extends ParentOrderController } $this->context->smarty->assign('roomTypeDemands', $roomTypeDemands); $this->context->smarty->assign('selectedRoomDemands', $selectedRoomDemands); - $extraDemandsTpl .= $this->context->smarty->fetch( - _PS_THEME_DIR_.'_partials/cart_booking_demands.tpl' - ); + } } + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, true, 1); + $cartRooms = $objCartBookingData->getHotelCartRoomsInfoByRoomType($this->context->cart->id, $idProduct,$dateFrom, $dateTo); + foreach($cartRooms as &$room) { + $room['selected_service'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts( + $room['id'], + 0, + null, + null + ); + } + $this->context->smarty->assign(array( + 'roomTypeServiceProducts' => $roomTypeServiceProducts, + 'cartRooms' => $cartRooms + )); } } - return $extraDemandsTpl; + $response['extra_demands'] = $this->context->smarty->fetch( + _PS_THEME_DIR_.'_partials/cart_booking_demands.tpl' + ); + + return json_encode($response); } public function changeRoomDemands() diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 8a148ca48..9bb0ba5f0 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -24,7 +24,6 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; class ProductControllerCore extends FrontController { public $php_self = 'product'; @@ -113,6 +112,10 @@ class ProductControllerCore extends FrontController $this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id); } + if (!$this->product->booking_product) { + Tools::redirect($this->context->link->getPageLink('pagenotfound')); + } + if (!Validate::isLoadedObject($this->product)) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); @@ -155,7 +158,10 @@ class ProductControllerCore extends FrontController break; } } - } elseif (!$this->product->checkAccess(isset($this->context->customer->id) && $this->context->customer->id ? (int)$this->context->customer->id : 0)) { + } elseif (!$this->product->checkAccess( + isset($this->context->customer->id) + && $this->context->customer->id ? (int)$this->context->customer->id : 0) + ) { header('HTTP/1.1 403 Forbidden'); header('Status: 403 Forbidden'); $this->errors[] = Tools::displayError('You do not have access to this Room Type.'); @@ -286,153 +292,160 @@ class ProductControllerCore extends FrontController $customization_datas = $this->context->cart->getProductCustomization($this->product->id, null, true); } - ##################################################################### - /*By webkul To send All needed Hotel Information on product.tpl*/ - ##################################################################### - - $htl_features = array(); - $obj_hotel_room_type = new HotelRoomType(); - $room_info_by_product_id = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($this->product->id); - $productCapacity = array(); - $productCapacity['adults'] = $room_info_by_product_id['adults']; - $productCapacity['children'] = $room_info_by_product_id['children']; - $this->product->capacity = $productCapacity; - $hotel_id = $room_info_by_product_id['id_hotel']; $useTax = HotelBookingDetail::useTax(); - if (isset($hotel_id) && $hotel_id) { - $obj_hotel_branch = new HotelBranchInformation(); - $hotel_info_by_id = $obj_hotel_branch->hotelBranchesInfo(false, 2, 1, $hotel_id); - $hotel_policies = $hotel_info_by_id['policies']; - $hotel_name = $hotel_info_by_id['hotel_name']; + // Check if product is a booking product or a service product + // Virtual product is booking product + if ($this->product->booking_product) { + ##################################################################### + /*By webkul To send All needed Hotel Information on product.tpl*/ + ##################################################################### - $addressInfo = $obj_hotel_branch->getAddress($room_info_by_product_id['id_hotel']); - $hotel_location = $addressInfo['city']. + $htl_features = array(); + $obj_hotel_room_type = new HotelRoomType(); + $room_info_by_product_id = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($this->product->id); + if ($hotel_id = $room_info_by_product_id['id_hotel']) { + $obj_hotel_branch = new HotelBranchInformation(); + $hotel_info_by_id = $obj_hotel_branch->hotelBranchesInfo(false, 2, 1, $hotel_id); + $hotel_policies = $hotel_info_by_id['policies']; + $hotel_name = $hotel_info_by_id['hotel_name']; + + $addressInfo = HotelBranchInformation::getAddress($room_info_by_product_id['id_hotel']); + $hotel_location = $addressInfo['city']. ($addressInfo['id_state']?', '.$addressInfo['state']:'').', '.$addressInfo['country']; - $obj_hotel_feaures_ids = $obj_hotel_branch->getFeaturesOfHotelByHotelId($hotel_id); + $obj_hotel_feaures_ids = $obj_hotel_branch->getFeaturesOfHotelByHotelId($hotel_id); - if (isset($obj_hotel_feaures_ids) && $obj_hotel_feaures_ids) { - foreach ($obj_hotel_feaures_ids as $key => $value) { - $obj_htl_ftr = new HotelFeatures(); - $htl_info = $obj_htl_ftr->getFeatureInfoById($value['feature_id']); - $htl_features[] = $htl_info['name']; + if (isset($obj_hotel_feaures_ids) && $obj_hotel_feaures_ids) { + foreach ($obj_hotel_feaures_ids as $key => $value) { + $obj_htl_ftr = new HotelFeatures(); + $htl_info = $obj_htl_ftr->getFeatureInfoById($value['feature_id']); + $htl_features[] = $htl_info['name']; + } } - } - $date_from = Tools::getValue('date_from'); - $date_to = Tools::getValue('date_to'); + $date_from = Tools::getValue('date_from'); + $date_to = Tools::getValue('date_to'); - if (!($date_from = Tools::getValue('date_from'))) { - $date_from = date('Y-m-d'); - $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); - } - if (!($date_to = Tools::getValue('date_to'))) { - $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); - } - - $hotel_branch_obj = new HotelBranchInformation($hotel_id); - /*Max date of ordering for order restrict*/ - $order_date_restrict = false; - $max_order_date = HotelOrderRestrictDate::getMaxOrderDate($hotel_id); - if ($max_order_date) { - $max_order_date = date('Y-m-d', strtotime($max_order_date)); - if (strtotime('-1 day', strtotime($max_order_date)) < strtotime($date_from) - || strtotime($max_order_date) < strtotime($date_to) - ) { - $order_date_restrict = true; + if (!($date_from = Tools::getValue('date_from'))) { + $date_from = date('Y-m-d'); + $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); + } + if (!($date_to = Tools::getValue('date_to'))) { + $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); } - } - /*End*/ - // booking preparation time - $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id); - $hotelImageLink = null; - if ($coverImage = HotelImage::getCover($hotel_id)) { - $hotelImagesBaseDir = _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/'; - $hotelImageLink = $this->context->link->getMediaLink( - $hotelImagesBaseDir.$coverImage['hotel_image_id'].'.jpg' + $hotel_branch_obj = new HotelBranchInformation($hotel_id); + /*Max date of ordering for order restrict*/ + $order_date_restrict = false; + $max_order_date = HotelOrderRestrictDate::getMaxOrderDate($hotel_id); + if ($max_order_date) { + $max_order_date = date('Y-m-d', strtotime($max_order_date)); + if (strtotime('-1 day', strtotime($max_order_date)) < strtotime($date_from) + || strtotime($max_order_date) < strtotime($date_to) + ) { + $order_date_restrict = true; + } + } + /*End*/ + // booking preparation time + $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id); + + $objHotelImage = new HotelImage(); + $hotelImageLink = null; + if ($coverImage = HotelImage::getCover($hotel_id)) { + $hotelImagesBaseDir = _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/'; + $hotelImageLink = $this->context->link->getMediaLink( + $objHotelImage->getImageLink($coverImage['id'], ImageType::getFormatedName('large')) + ); + } + + // get room type additional demands + $objRoomDemands = new HotelRoomTypeDemand(); + if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($this->product->id)) { + foreach ($roomTypeDemands as &$demand) { + // if demand has advance options then set demand price as first advance option price. + if (isset($demand['adv_option']) && $demand['adv_option']) { + $demand['price'] = current($demand['adv_option'])['price']; + } + } + } + + Media::addJsDef(array( + 'hotel_loc' => array( + 'latitude' => $hotel_branch_obj->latitude, + 'longitude' => $hotel_branch_obj->longitude, + ) + )); + + $this->context->smarty->assign( + array( + 'id_hotel' => $hotel_id, + 'room_type_demands' => $roomTypeDemands, + 'room_type_info' => $room_info_by_product_id, + 'isHotelRefundable' => $hotel_branch_obj->isRefundable(), + 'max_order_date' => $max_order_date, + 'preparation_time' => $preparationTime, + 'warning_num' => Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER'), + 'ratting_img_path' => _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png', + 'product_controller_url' => $this->context->link->getPageLink('product'), + 'date_from' => $date_from, + 'date_to' => $date_to, + 'hotel_check_in' => date('h:i a', strtotime($hotel_branch_obj->check_in)), + 'hotel_check_out' => date('h:i a', strtotime($hotel_branch_obj->check_out)), + 'hotel_location' => $hotel_location, + 'hotel_latitude' => $hotel_branch_obj->latitude, + 'hotel_longitude' => $hotel_branch_obj->longitude, + 'hotel_map_input_text' => $hotel_branch_obj->map_input_text, + 'hotel_address1' => $addressInfo['address1'], + 'hotel_phone' => $addressInfo['phone'], + 'hotel_name' => $hotel_name, + 'hotel_policies' => $hotel_policies, + 'hotel_features' => $htl_features, + 'hotel_image_link' => $hotelImageLink, + 'hotel_has_images' => (bool) HotelImage::getCover($hotel_id), + 'ftr_img_src' => _PS_IMG_.'rf/', + 'order_date_restrict' => $order_date_restrict, + 'PS_SERVICE_PRODUCT_CATEGORY_FILTER' => Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER'), + ) ); - } - Media::addJsDef(array( - 'hotel_loc' => array( - 'latitude' => $hotel_branch_obj->latitude, - 'longitude' => $hotel_branch_obj->longitude, - ) - )); + $this->assignBookingFormVars($this->product->id, $date_from, $date_to); + $this->assignServiceProductVars(); + + // product price after imposing feature prices... + if ($useTax) { + $priceProduct = Product::getPriceStatic($this->product->id, true); + $feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, true); + } else { + $priceProduct = Product::getPriceStatic($this->product->id, false); + $feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, false); + } + $productPriceWithoutReduction = $this->product->getPriceWithoutReduct(!$useTax); + $feature_price_diff = (float)($productPriceWithoutReduction - $feature_price); + $this->context->smarty->assign('feature_price', $feature_price); + $this->context->smarty->assign('feature_price_diff', $feature_price_diff); + + // send hotel refund rules + if ($hotel_branch_obj->active_refund) { + $objBranchRefundRules = new HotelBranchRefundRules(); + if ($hotelRefundRules = $objBranchRefundRules->getHotelRefundRules($hotel_id, 0, 1, 0, 1)) { + $this->context->smarty->assign('hotelRefundRules', $hotelRefundRules); + } + } + } else { + // when using service product we will not need any new paramaters, will update interface by checking is_virtual + } if (Tools::getValue('error')) { $this->context->smarty->assign('error', Tools::getValue('error')); } - - $this->context->smarty->assign( - array( - 'room_type_info' => $room_info_by_product_id, - 'isHotelRefundable' => $hotel_branch_obj->isRefundable(), - 'max_order_date' => $max_order_date, - 'preparation_time' => $preparationTime, - 'warning_num' => Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER'), - 'product_controller_url' => $this->context->link->getPageLink('product'), - 'date_from' => $date_from, - 'date_to' => $date_to, - 'hotel_check_in' => date('h:i a', strtotime($hotel_branch_obj->check_in)), - 'hotel_check_out' => date('h:i a', strtotime($hotel_branch_obj->check_out)), - 'hotel_location' => $hotel_location, - 'hotel_latitude' => $hotel_branch_obj->latitude, - 'hotel_longitude' => $hotel_branch_obj->longitude, - 'hotel_map_input_text' => $hotel_branch_obj->map_input_text, - 'hotel_address1' => $addressInfo['address1'], - 'hotel_phone' => $addressInfo['phone'], - 'hotel_name' => $hotel_name, - 'hotel_policies' => $hotel_policies, - 'hotel_features' => $htl_features, - 'hotel_image_link' => $hotelImageLink, - 'hotel_has_images' => (bool) HotelImage::getCover($hotel_id), - 'ftr_img_src' => _PS_IMG_.'rf/', - 'order_date_restrict' => $order_date_restrict - ) - ); - - $this->assignBookingFormVars($this->product->id, $date_from, $date_to); - - // product price after imposing feature prices... - if ($useTax) { - $priceProduct = Product::getPriceStatic($this->product->id, true); - $feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, true); - } else { - $priceProduct = Product::getPriceStatic($this->product->id, false); - $feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, false); - } - $productPriceWithoutReduction = $this->product->getPriceWithoutReduct(!$useTax); - $feature_price_diff = (float)($productPriceWithoutReduction - $feature_price); - $this->context->smarty->assign('feature_price', $feature_price); - $this->context->smarty->assign('feature_price_diff', $feature_price_diff); - - // send hotel refund rules - if ($hotel_branch_obj->active_refund) { - $objBranchRefundRules = new HotelBranchRefundRules(); - if ($hotelRefundRules = $objBranchRefundRules->getHotelRefundRules($hotel_id, 0, 1, 0, 1)) { - $this->context->smarty->assign('hotelRefundRules', $hotelRefundRules); - } - } } - // get room type additional demands - $objRoomDemands = new HotelRoomTypeDemand(); - if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($this->product->id)) { - foreach ($roomTypeDemands as &$demand) { - // if demand has advance options then set demand price as first advance option price. - if (isset($demand['adv_option']) && $demand['adv_option']) { - $demand['price'] = current($demand['adv_option'])['price']; - } - } - } - - + // send all the common variables for all type of products $this->context->smarty->assign( array( - 'room_type_demands' => $roomTypeDemands, + 'product_controller_url' => $this->context->link->getPageLink('product'), + 'ratting_img_path' => _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png', 'WK_PRICE_CALC_METHOD_EACH_DAY' => HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY, - 'product_id_hotel' => $hotel_id, 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $customization_fields, 'id_customization' => empty($customization_datas) ? null : $customization_datas[0]['id_customization'], @@ -475,12 +488,58 @@ class ProductControllerCore extends FrontController $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); } + public function assignServiceProductVars() + { + // get service products for room type + $p = 1; + $n = RoomTypeServiceProduct::WK_NUM_RESULTS; + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $smartyVars = array(); + if (Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER')) { + $serviceProductsByCategory = $objRoomTypeServiceProduct->getServiceProductsGroupByCategory( + $this->product->id, + $p, + $n, + true + ); + if ($serviceProductsByCategory) { + $smartyVars['service_products_exists'] = 1; + } + $smartyVars['service_products_by_category'] = $serviceProductsByCategory; + } else { + $roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData( + $this->product->id, + $p, + $n, + true + ); + $numTotalServiceProducts = $this->product->getProductServiceProducts( + $this->context->language->id, + $p, + $n, + true, + 2, + 0, + true + ); + if ($roomTypeServiceProducts) { + $smartyVars['service_products_exists'] = 1; + } + $smartyVars['service_products'] = $roomTypeServiceProducts; + $smartyVars['num_total_service_products'] = $numTotalServiceProducts; + } + + $this->context->smarty->assign($smartyVars); + } + + public function assignBookingFormVars( $idProduct, $dateFrom, $dateTo, $occupancy = array(), - $jsonDemands = '' + $jsonDemands = '', + $roomServiceProducts = null ) { $objProduct = new Product($idProduct, true, $this->context->language->id, $this->context->shop->id); if (!Validate::isLoadedObject($objProduct)) { @@ -525,7 +584,7 @@ class ProductControllerCore extends FrontController 'id_cart' => $idCart, 'id_guest' => $idGuest, ); - if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) { + if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) { $bookingParams['occupancy'] = $occupancy; $quantity = count($occupancy); } else { @@ -537,6 +596,7 @@ class ProductControllerCore extends FrontController $quantity = 1; } + $totalAvailableRooms = 0; if ($hotelRoomData = $objBookingDetail->DataForFrontSearch($bookingParams)) { $totalAvailableRooms = $hotelRoomData['stats']['num_avail']; $quantity = ($quantity > $totalAvailableRooms) ? $totalAvailableRooms : $quantity; @@ -573,13 +633,12 @@ class ProductControllerCore extends FrontController $featurePriceDiff = (float) ($productPriceWithoutReduction - $featurePrice); $totalRoomPrice = $roomTypeDateRangePrice * $quantity; - // calculate demand price now - $demandsPrice = 0; + $demandsPricePerRoom = 0; $roomTypeDemands = $objHRTDemand->getRoomTypeDemands($idProduct); if ($jsonDemands !== '') { $cartDemands = json_decode($jsonDemands, true); - $demandsPrice = $objHRTDemandPrice->getRoomTypeDemandsTotalPrice( + $demandsPricePerRoom = $objHRTDemandPrice->getRoomTypeDemandsTotalPrice( $idProduct, $cartDemands, $useTax, @@ -587,9 +646,77 @@ class ProductControllerCore extends FrontController $dateTo ); - $demandsPrice *= $quantity; + // send demand info to booking form + foreach($cartDemands as &$demand) { + if (Validate::isLoadedObject( + $objRoomTypeGlobalDemand = new HotelRoomTypeGlobalDemand($demand['id_global_demand'], $this->context->language->id) + )) { + $demand['name'] = $objRoomTypeGlobalDemand->name; + if ($demand['id_option']) { + if (Validate::isLoadedObject($objDemandAdvanceOption = new HotelRoomTypeGlobalDemandAdvanceOption($demand['id_option'], $this->context->language->id))) { + if ($objDemandAdvanceOption->id_global_demand != $objRoomTypeGlobalDemand->id) { + unset($demand); + continue; + } + $demand['advance_option'] = array( + 'id_option' => $objDemandAdvanceOption->id, + 'name' => $objDemandAdvanceOption->name + ); + } else { + unset($demand); + continue; + } + } + + $demand['price'] = HotelRoomTypeDemand::getPriceStatic( + $idProduct, + $objRoomTypeGlobalDemand->id, + $demand['id_option'], + $useTax + ); + } + } + $smartyVars['selected_demands'] = $cartDemands; } + if ($roomServiceProducts) { + $serviceProductsPrice = 0; + if ($roomServiceProducts = json_decode($roomServiceProducts, true)) { + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + foreach ($roomServiceProducts as &$product) { + if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($idProduct, $product['id_product'])) { + unset($product); + continue; + } else { + $objServiceProduct = new ProductCore($product['id_product'], false, $this->context->language->id); + if (!$objServiceProduct->allow_multiple_quantity && $product['quantity'] > 1) { + $product['quantity'] = 1; + } else if ($objServiceProduct->max_quantity && $objServiceProduct->max_quantity < $product['quantity'] ) { + $product['quantity'] = $objServiceProduct->max_quantity; + } + + } + $product['name'] = $objServiceProduct->name; + $product['allow_multiple_quantity'] = $objServiceProduct->allow_multiple_quantity; + $productPrice = $objRoomTypeServiceProductPrice->getServicePrice( + $product['id_product'], + $idProduct, + $product['quantity'], + $dateFrom, + $dateTo, + $useTax + ); + $product['price'] = $productPrice; + $serviceProductsPrice += $productPrice; + } + $smartyVars['selected_service_product'] = $roomServiceProducts; + } + $demandsPricePerRoom += $serviceProductsPrice; + $totalPrice += $serviceProductsPrice; + } + // multiply price by number of room required + $demandsPrice = $demandsPricePerRoom * $quantity; // calculate total price $totalPrice = $totalRoomPrice + $demandsPrice; // send occupancy information searched by the user @@ -612,6 +739,7 @@ class ProductControllerCore extends FrontController $smartyVars['total_available_rooms'] = $totalAvailableRooms; $smartyVars['has_room_type_demands'] = $roomTypeDemands ? true : false; // whether to show price breakup $smartyVars['rooms_price'] = $totalRoomPrice; + $smartyVars['demands_price_per_room'] = $demandsPricePerRoom; $smartyVars['demands_price'] = $demandsPrice; $smartyVars['total_price'] = $totalPrice; $this->context->smarty->assign($smartyVars); @@ -1091,16 +1219,21 @@ class ProductControllerCore extends FrontController $dateTo = Tools::getValue('date_to'); $occupancy = Tools::getValue('occupancy'); $roomTypeDemands = Tools::getValue('room_type_demands'); + $roomServiceProducts = Tools::getValue('room_service_products'); $dateFrom = date('Y-m-d', strtotime($dateFrom)); $dateTo = date('Y-m-d', strtotime($dateTo)); - + if ($occupancy == false) { + $occupancy = array(); + } + $this->assignServiceProductVars(); if ($this->assignBookingFormVars( $idProduct, $dateFrom, $dateTo, $occupancy, - $roomTypeDemands + $roomTypeDemands, + $roomServiceProducts )) { $html = $this->context->smarty->fetch('_partials/booking-form.tpl'); $response['status'] = true; @@ -1127,7 +1260,8 @@ class ProductControllerCore extends FrontController $hotelImagesBaseDir = _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/'; foreach ($hotelImages as &$hotelImage) { $hotelImage['link'] = $this->context->link->getMediaLink( - $hotelImagesBaseDir.$hotelImage['hotel_image_id'].'.jpg' + $objHotelImage->getImageLink($hotelImage['id'], + ImageType::getFormatedName('large')) ); } @@ -1145,4 +1279,120 @@ class ProductControllerCore extends FrontController die(json_encode($response)); } + + public function displayAjaxGetServiceProducts() + { + $response = array( + 'status' => false + ); + + $p = Tools::getValue('p'); + $id_product = Tools::getValue('id_product'); + $id_category = Tools::getValue('id_category'); + + if ($this->isTokenValid()) { + if ($p && $id_product) { + if (Validate::isLoadedObject($objProduct = new Product($id_product))) { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $n = RoomTypeServiceProduct::WK_NUM_RESULTS; + if (Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER') && !$id_category) { + $response['error'] = Tools::displayError('Invaild Request, please try again'); + } + if (empty($response['error'])) { + $response['status'] = true; + if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData( + $objProduct->id, + $p, + $n, + true, + 2, + 0, + $id_category + )) { + $this->context->smarty->assign('service_products', $roomTypeServiceProducts); + if (Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER')) { + $this->context->smarty->assign('group', $id_category); + } else { + $this->context->smarty->assign('group', 'all'); + } + $response['service_products'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/service-products-list.tpl'); + } + } + } else { + $response['error'] = Tools::displayError('Room Type not Found'); + } + } else { + $response['error'] = Tools::displayError('Invaild Request, please try again'); + } + } else { + $response['error'] = Tools::displayError('Unable to process request, please try again'); + } + + + $this->ajaxDie(json_encode($response)); + } + + public function displayAjaxCheckServiceProductWithRoomType() + { + $response = array( + 'success' => false + ); + + if ($this->isTokenValid()) { + $idProduct = Tools::getValue('id_product'); + $idServiceProduct = Tools::getValue('service_product'); + $addedServiceProduct = Tools::getValue('added_service_product'); + $qty = Tools::getValue('qty'); + if (Validate::isLoadedObject($objProduct = new Product($idProduct))) { + if (!Product::isBookingProduct($idProduct)) { + $response['error'] = Tools::displayError('Room Type info not Found'); + $this->ajaxDie(json_encode($response)); + } + + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($idProduct, $idServiceProduct)) { + $response['error'] = Tools::displayError('Selected product is not available with current room type'); + } else { + if (Validate::isLoadedObject($objServiceProduct = new Product($idServiceProduct))) { + $response['success'] = true; + if (!$objServiceProduct->allow_multiple_quantity) { + if (!empty($addedServiceProduct)) { + if (!in_array($idServiceProduct, array_column($addedServiceProduct, 'id_product'))) { + $response['add'] = true; + $response['msg'] = 'Service is added to cart.'; + } else { + $response['msg'] = 'Service already added.'; + } + } else { + $response['add'] = true; + $response['msg'] = 'Service is added to cart.'; + } + } else { + $totalQty = $qty; + if (!empty($addedServiceProduct)) { + if (($key = array_search($idServiceProduct, array_column($addedServiceProduct, 'id_product')))!== false) { + $totalQty += $addedServiceProduct[$key]['quantity']; + } + } + if ($objServiceProduct->max_quantity && $objServiceProduct->max_quantity < $totalQty ) { + $response['msg'] = Tools::displayError(sprintf('Cannot add more than %d quantity.', $objServiceProduct->max_quantity)); + } else { + $response['add'] = true; + $response['msg'] = Tools::displayError('Service is added to cart.'); + } + } + } else { + $response['error'] = Tools::displayError('Service not Found'); + } + } + } else { + $response['error'] = Tools::displayError('Room Type not Found'); + } + } else { + $response['error'] = Tools::displayError('Unable to process request, please try again'); + } + + + $this->ajaxDie(json_encode($response)); + } } diff --git a/install/classes/datas.php b/install/classes/datas.php index aa7eb821b..e88a8085f 100644 --- a/install/classes/datas.php +++ b/install/classes/datas.php @@ -44,7 +44,7 @@ class Datas 'default' => '0', 'validate' => 'isInt', 'alias' => 'l', - 'help' => 'install all available languages', + 'help' => 'Install all available languages', ), 'timezone' => array( 'default' => 'Europe/Paris', @@ -80,7 +80,7 @@ class Datas 'database_name' => array( 'name' => 'db_name', 'alias' => 'd', - 'default' => 'prestashop', + 'default' => 'qloapps', 'validate' => 'isGenericName', ), 'database_clear' => array( @@ -97,7 +97,7 @@ class Datas ), 'database_prefix' => array( 'name' => 'prefix', - 'default' => 'ps_', + 'default' => 'qlo_', 'validate' => 'isGenericName', ), 'database_engine' => array( @@ -109,7 +109,7 @@ class Datas 'shop_name' => array( 'name' => 'name', 'validate' => 'isGenericName', - 'default' => 'PrestaShop', + 'default' => 'QloApps', ), 'shop_activity' => array( 'name' => 'activity', @@ -144,17 +144,17 @@ class Datas 'show_license' => array( 'name' => 'license', 'default' => 0, - 'help' => 'show PrestaShop license' + 'help' => 'Show QloApps license' ), 'newsletter' => array( 'name' => 'newsletter', 'default' => 1, - 'help' => 'get news from PrestaShop', + 'help' => 'Get news from QloApps', ), 'send_email' => array( 'name' => 'send_email', 'default' => 1, - 'help' => 'send an email to the administrator after installation', + 'help' => 'Send an email to the administrator after installation', ), ); diff --git a/install/controllers/http/configure.php b/install/controllers/http/configure.php index 96d0eb2b5..a03dacfcf 100644 --- a/install/controllers/http/configure.php +++ b/install/controllers/http/configure.php @@ -307,9 +307,14 @@ class InstallControllerHttpConfigure extends InstallControllerHttp // Install type $this->install_type = ($this->session->install_type) ? $this->session->install_type : 'full'; - // Detect SSL mode - if (!isset($this->session->enable_ssl)) { - $this->session->enable_ssl = Tools::usingSecureMode() ? '1' : '0'; + if (!isset($this->session->allow_ssl) || $this->session->allow_ssl === false) { + if (Tools::usingSecureMode()) { + $this->session->enable_ssl = '1'; + $this->session->allow_ssl = true; + } else { + $this->session->enable_ssl = '0'; + $this->session->allow_ssl = false; + } } $this->displayTemplate('configure'); diff --git a/install/controllers/http/system.php b/install/controllers/http/system.php index ca3b4606a..950f93247 100644 --- a/install/controllers/http/system.php +++ b/install/controllers/http/system.php @@ -136,7 +136,6 @@ class InstallControllerHttpSystem extends InstallControllerHttp 'new_phpversion' => sprintf($this->l('You are using PHP %s version. Soon, the latest PHP version supported by QloApps will be PHP 5.6. To make sure you’re ready for the future, we recommend you to upgrade to PHP 5.6 now!'), phpversion()), 'register_globals' => $this->l('PHP register_globals option is enabled'), 'gz' => $this->l('GZIP compression is not activated'), - 'mcrypt' => $this->l('Mcrypt extension is not enabled'), 'mbstring' => $this->l('Mbstring extension is not enabled'), 'magicquotes' => $this->l('PHP magic quotes option is enabled'), 'dom' => $this->l('Dom extension is not loaded'), diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index 68057f487..de57c4024 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -1249,6 +1249,12 @@ CREATE TABLE `PREFIX_order_detail` ( `reduction_amount_tax_excl` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000', `group_reduction` DECIMAL(10, 2) NOT NULL DEFAULT '0.000000', `product_quantity_discount` decimal(20,6) NOT NULL DEFAULT '0.000000', + `is_booking_product` tinyint(1) NOT NULL DEFAULT '0', + `product_service_type` tinyint(1) NOT NULL DEFAULT '1', + `product_auto_add` tinyint(1) NOT NULL DEFAULT '0', + `product_price_addition_type` tinyint(1) NOT NULL DEFAULT '0', + `product_allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1', + `product_price_calculation_method` tinyint(1) unsigned NOT NULL DEFAULT '1', `product_ean13` varchar(13) DEFAULT NULL, `product_upc` varchar(12) DEFAULT NULL, `product_reference` varchar(32) DEFAULT NULL, @@ -1513,6 +1519,9 @@ CREATE TABLE `PREFIX_product` ( `ecotax` decimal(17,6) NOT NULL DEFAULT '0.00', `quantity` int(10) NOT NULL DEFAULT '0', `minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1', + `allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1', + `max_quantity` int(10) unsigned NOT NULL DEFAULT '1', + `price_calculation_method` tinyint(1) unsigned NOT NULL DEFAULT '1', `price` decimal(20,6) NOT NULL DEFAULT '0.000000', `wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000', `unity` varchar(255) DEFAULT NULL, @@ -1534,6 +1543,11 @@ CREATE TABLE `PREFIX_product` ( `redirect_type` ENUM('', '404', '301', '302') NOT NULL DEFAULT '', `id_product_redirected` int(10) unsigned NOT NULL DEFAULT '0', `available_for_order` tinyint(1) NOT NULL DEFAULT '1', + `auto_add_to_cart` tinyint(1) NOT NULL DEFAULT '0', + `price_addition_type` tinyint(1) NOT NULL DEFAULT '1', + `show_at_front` tinyint(1) NOT NULL DEFAULT '1', + `service_product_type` tinyint(1) NOT NULL DEFAULT '1', + `price_display_method` tinyint(1) NOT NULL DEFAULT '1', `available_date` date NOT NULL DEFAULT '0000-00-00', `condition` ENUM('new', 'used', 'refurbished') NOT NULL DEFAULT 'new', `show_price` tinyint(1) NOT NULL DEFAULT '1', @@ -1542,6 +1556,7 @@ CREATE TABLE `PREFIX_product` ( `cache_is_pack` tinyint(1) NOT NULL DEFAULT '0', `cache_has_attachments` tinyint(1) NOT NULL DEFAULT '0', `is_virtual` tinyint(1) NOT NULL DEFAULT '0', + `booking_product` tinyint(1) NOT NULL DEFAULT '1', `cache_default_attribute` int(10) unsigned DEFAULT NULL, `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, @@ -1564,6 +1579,9 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_shop` ( `online_only` tinyint(1) unsigned NOT NULL DEFAULT '0', `ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000', `minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1', + `allow_multiple_quantity` tinyint(1) unsigned NOT NULL DEFAULT '1', + `max_quantity` int(10) unsigned NOT NULL DEFAULT '1', + `price_calculation_method` tinyint(1) unsigned NOT NULL DEFAULT '1', `price` decimal(20,6) NOT NULL DEFAULT '0.000000', `wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000', `unity` varchar(255) DEFAULT NULL, @@ -1576,6 +1594,10 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_shop` ( `redirect_type` ENUM('', '404', '301', '302') NOT NULL DEFAULT '', `id_product_redirected` int(10) unsigned NOT NULL DEFAULT '0', `available_for_order` tinyint(1) NOT NULL DEFAULT '1', + `auto_add_to_cart` tinyint(1) NOT NULL DEFAULT '0', + `price_addition_type` tinyint(1) NOT NULL DEFAULT '1', + `show_at_front` tinyint(1) NOT NULL DEFAULT '1', + `price_display_method` tinyint(1) NOT NULL DEFAULT '1', `available_date` date NOT NULL DEFAULT '0000-00-00', `condition` enum('new','used','refurbished') NOT NULL DEFAULT 'new', `show_price` tinyint(1) NOT NULL DEFAULT '1', diff --git a/install/data/xml/category.xml b/install/data/xml/category.xml index 8e1562d8c..874aaeeda 100644 --- a/install/data/xml/category.xml +++ b/install/data/xml/category.xml @@ -7,5 +7,23 @@ + + + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/data/xml/category_group.xml b/install/data/xml/category_group.xml index 3de4adcfd..902335903 100644 --- a/install/data/xml/category_group.xml +++ b/install/data/xml/category_group.xml @@ -8,5 +8,11 @@ + + + + + + diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index 4eaa78730..c9babed8d 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -686,6 +686,24 @@ 3 + + 50 + + + 150 + + + 1 + + + 2 + + + 1 + + + 2 + 0_3|0_4 @@ -770,6 +788,12 @@ 2 + + 3 + + + 4 + 0 @@ -877,6 +901,9 @@ 0 + + + 1 diff --git a/install/data/xml/tab.xml b/install/data/xml/tab.xml index 38f072811..a20e6c70e 100644 --- a/install/data/xml/tab.xml +++ b/install/data/xml/tab.xml @@ -66,12 +66,15 @@ AdminStock - + AdminProducts - + diff --git a/install/langs/bg/data/category.xml b/install/langs/bg/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/bg/data/category.xml +++ b/install/langs/bg/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/bg/data/cms.xml b/install/langs/bg/data/cms.xml index 2d58b8c17..afe6a4e2b 100644 --- a/install/langs/bg/data/cms.xml +++ b/install/langs/bg/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/bg/data/order_state.xml b/install/langs/bg/data/order_state.xml index b4d010221..f22b1f4be 100644 --- a/install/langs/bg/data/order_state.xml +++ b/install/langs/bg/data/order_state.xml @@ -17,7 +17,7 @@ - Refund + Refunded diff --git a/install/langs/bg/data/tab.xml b/install/langs/bg/data/tab.xml index 18e8716d8..4aabd8eb0 100644 --- a/install/langs/bg/data/tab.xml +++ b/install/langs/bg/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/bn/data/category.xml b/install/langs/bn/data/category.xml index be0c6bd95..4a56d5050 100644 --- a/install/langs/bn/data/category.xml +++ b/install/langs/bn/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/bn/data/cms.xml b/install/langs/bn/data/cms.xml index cc5b2321d..16ad71044 100644 --- a/install/langs/bn/data/cms.xml +++ b/install/langs/bn/data/cms.xml @@ -12,7 +12,7 @@ আইনি বিজ্ঞপ্তি আইনি বিজ্ঞপ্তি notice, legal, credits - <h2>আইনগত</h2><h3>বকেয়া</h3><p>ধারনা এবং উৎপাদন:</p><p>এই ওয়েব সাইট টি ব্যাবহার করে তৈরি<a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/bn/data/tab.xml b/install/langs/bn/data/tab.xml index dc9fbc64c..a8d950ef5 100644 --- a/install/langs/bn/data/tab.xml +++ b/install/langs/bn/data/tab.xml @@ -22,7 +22,8 @@ - + + diff --git a/install/langs/br/data/category.xml b/install/langs/br/data/category.xml index 10f6dc119..a4a464154 100644 --- a/install/langs/br/data/category.xml +++ b/install/langs/br/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/br/data/cms.xml b/install/langs/br/data/cms.xml index 07350412e..a4a7c5269 100644 --- a/install/langs/br/data/cms.xml +++ b/install/langs/br/data/cms.xml @@ -12,7 +12,7 @@ Advertência Legal Advertência legal advertência, legal, créditos - <h2>Créditos</h2><h3>Legais</h3><p>Conceito e produção:</p><p>Esta loja on-line foi criada por meio do Software de carrinho de compras da PrestaShop<a href="http://www.prestashop.com"></a>. Confira o blog de comércio eletrônico da PrestaShop <a href="http://www.prestashop.com/blog/en/"></a> para obter novidades e conselhos sobre como vender on-line e operar seu site de comércio eletrônico.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> advertencia-legal diff --git a/install/langs/br/data/tab.xml b/install/langs/br/data/tab.xml index 3456cc548..805ebb386 100644 --- a/install/langs/br/data/tab.xml +++ b/install/langs/br/data/tab.xml @@ -66,7 +66,8 @@ - + + diff --git a/install/langs/cs/data/category.xml b/install/langs/cs/data/category.xml index 98eaefa91..3241f17bb 100644 --- a/install/langs/cs/data/category.xml +++ b/install/langs/cs/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/cs/data/cms.xml b/install/langs/cs/data/cms.xml index 2c26c68f5..fe904c62d 100644 --- a/install/langs/cs/data/cms.xml +++ b/install/langs/cs/data/cms.xml @@ -12,7 +12,7 @@ Právní ustanovení Právní ustanovení Právní, ustanovení, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/cs/data/tab.xml b/install/langs/cs/data/tab.xml index 0e58531ea..9c0b9d1f0 100644 --- a/install/langs/cs/data/tab.xml +++ b/install/langs/cs/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/de/data/category.xml b/install/langs/de/data/category.xml index 6e692ef85..97c863351 100644 --- a/install/langs/de/data/category.xml +++ b/install/langs/de/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/de/data/cms.xml b/install/langs/de/data/cms.xml index f888491fa..6add0c559 100644 --- a/install/langs/de/data/cms.xml +++ b/install/langs/de/data/cms.xml @@ -12,7 +12,7 @@ Rechtliche Hinweise Rechtliche Hinweise Hinweise, rechtlich, Gutscheine - <h2>Legal</h2><h3>Credits</h3><p>Konzept und Gestaltung:</p><p>Diese Webseite wurde hergestellt unter Verwendung von <a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> rechtliche-hinweise diff --git a/install/langs/de/data/tab.xml b/install/langs/de/data/tab.xml index 6e6a7fa59..ee0fabd35 100644 --- a/install/langs/de/data/tab.xml +++ b/install/langs/de/data/tab.xml @@ -66,7 +66,8 @@ - + + diff --git a/install/langs/en/data/category.xml b/install/langs/en/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/en/data/category.xml +++ b/install/langs/en/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/en/data/cms.xml b/install/langs/en/data/cms.xml index 2d58b8c17..afe6a4e2b 100644 --- a/install/langs/en/data/cms.xml +++ b/install/langs/en/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/en/data/tab.xml b/install/langs/en/data/tab.xml index c2450b111..ab5391a0f 100644 --- a/install/langs/en/data/tab.xml +++ b/install/langs/en/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/es/data/category.xml b/install/langs/es/data/category.xml index d02105efc..cbfc3d695 100644 --- a/install/langs/es/data/category.xml +++ b/install/langs/es/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/es/data/cms.xml b/install/langs/es/data/cms.xml index f93fa58f4..3ed2388c8 100644 --- a/install/langs/es/data/cms.xml +++ b/install/langs/es/data/cms.xml @@ -12,7 +12,7 @@ Aviso legal Aviso legal aviso, legal, créditos - <h2>Legal</h2><h3>Créditos</h3><p>Concepto y producción:</p><p>Esta tienda online fue creada utilizando el <a href="http://www.prestashop.com">Software Prestashop Shopping Cart</a>. No olvides echarle un vistazo al <a href="http://www.prestashop.com/blog/en/">blog de comercio electrónico</a> de PrestaShop para estar al día y leer todos los consejos sobre la venta online y sobre cómo gestionar tu web de comercio electrónico.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> aviso-legal diff --git a/install/langs/es/data/tab.xml b/install/langs/es/data/tab.xml index c2b326480..57b3fdacc 100644 --- a/install/langs/es/data/tab.xml +++ b/install/langs/es/data/tab.xml @@ -19,7 +19,8 @@ - + + diff --git a/install/langs/fa/data/category.xml b/install/langs/fa/data/category.xml index 5cf2d1e4c..edb1cc4cd 100644 --- a/install/langs/fa/data/category.xml +++ b/install/langs/fa/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/fa/data/cms.xml b/install/langs/fa/data/cms.xml index cff6e0de7..b15850a5b 100644 --- a/install/langs/fa/data/cms.xml +++ b/install/langs/fa/data/cms.xml @@ -12,7 +12,7 @@ نکات حقوقی نکات حقوقی نکات,حقوق,اعتبارات - <h2>حقوق</h2><h3>اعتبارات</h3><p>مفاهیم و تولیدات:</p><p>این وب سایت توسط نرم افزار متن باز <a href="http://www.presta-shop.ir">PrestaShop</a>&trade; ساخته شده.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/fa/data/tab.xml b/install/langs/fa/data/tab.xml index 99d6017af..aaca35d0d 100644 --- a/install/langs/fa/data/tab.xml +++ b/install/langs/fa/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/fr/data/category.xml b/install/langs/fr/data/category.xml index bd5745b2d..3bcbd4562 100644 --- a/install/langs/fr/data/category.xml +++ b/install/langs/fr/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/fr/data/cms.xml b/install/langs/fr/data/cms.xml index 8e4a24592..02477b527 100644 --- a/install/langs/fr/data/cms.xml +++ b/install/langs/fr/data/cms.xml @@ -12,7 +12,7 @@ Mentions légales Mentions légales mentions, légales, crédits - <h2>Mentions légales</h2><h3>Crédits</h3><p>Conception et production :</p><p>cette boutique en ligne a été créée à l'aide du <a href="http://www.prestashop.com">logiciel PrestaShop. </a>Rendez-vous sur le <a href="http://www.prestashop.com/blog/en/">blog e-commerce de PrestaShop</a> pour vous tenir au courant des dernières actualités et obtenir des conseils sur la vente en ligne et la gestion d'un site d'e-commerce.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> mentions-legales diff --git a/install/langs/fr/data/tab.xml b/install/langs/fr/data/tab.xml index 20dc6cfdf..dec7e8e9b 100644 --- a/install/langs/fr/data/tab.xml +++ b/install/langs/fr/data/tab.xml @@ -66,7 +66,8 @@ - + + diff --git a/install/langs/he/data/category.xml b/install/langs/he/data/category.xml index f3da14050..0c4d320d2 100644 --- a/install/langs/he/data/category.xml +++ b/install/langs/he/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/he/data/cms.xml b/install/langs/he/data/cms.xml index a26779171..40d8f8e4b 100644 --- a/install/langs/he/data/cms.xml +++ b/install/langs/he/data/cms.xml @@ -12,7 +12,7 @@ הבהרות משפטיות הבהרות משפטיות הבהרות, משפט, חוק, אשראי, זכויות - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> הבהרות-משפטיות diff --git a/install/langs/he/data/tab.xml b/install/langs/he/data/tab.xml index 657f73c57..1f6a51228 100644 --- a/install/langs/he/data/tab.xml +++ b/install/langs/he/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/hr/data/category.xml b/install/langs/hr/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/hr/data/category.xml +++ b/install/langs/hr/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/hr/data/cms.xml b/install/langs/hr/data/cms.xml index 2d58b8c17..afe6a4e2b 100644 --- a/install/langs/hr/data/cms.xml +++ b/install/langs/hr/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/hr/data/order_state.xml b/install/langs/hr/data/order_state.xml index b4d010221..f22b1f4be 100644 --- a/install/langs/hr/data/order_state.xml +++ b/install/langs/hr/data/order_state.xml @@ -17,7 +17,7 @@ - Refund + Refunded diff --git a/install/langs/hr/data/tab.xml b/install/langs/hr/data/tab.xml index 8e0554658..5164a0a52 100644 --- a/install/langs/hr/data/tab.xml +++ b/install/langs/hr/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/hu/data/category.xml b/install/langs/hu/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/hu/data/category.xml +++ b/install/langs/hu/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/hu/data/cms.xml b/install/langs/hu/data/cms.xml index 260ed61f3..9cbf0d7f4 100644 --- a/install/langs/hu/data/cms.xml +++ b/install/langs/hu/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Web site was created using <a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/hu/data/order_state.xml b/install/langs/hu/data/order_state.xml index cd3df1539..f22b1f4be 100644 --- a/install/langs/hu/data/order_state.xml +++ b/install/langs/hu/data/order_state.xml @@ -9,7 +9,7 @@ - Preparation in progress + Processing in progress @@ -17,7 +17,7 @@ - Refund + Refunded diff --git a/install/langs/hu/data/tab.xml b/install/langs/hu/data/tab.xml index ba956472a..3350dff34 100644 --- a/install/langs/hu/data/tab.xml +++ b/install/langs/hu/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/id/data/category.xml b/install/langs/id/data/category.xml index d619f5a04..c2b21c14b 100644 --- a/install/langs/id/data/category.xml +++ b/install/langs/id/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/id/data/cms.xml b/install/langs/id/data/cms.xml index fecd9ff77..c0721051f 100644 --- a/install/langs/id/data/cms.xml +++ b/install/langs/id/data/cms.xml @@ -12,7 +12,7 @@ Kebijakan privasi dan hukum Kebijakan privasi dan hukum notice, legal, credits - <h2>Kebijakan privasi dan hukum</h2><p>Tentang kebijakan privasi dan hukum bagi pelanggan</p><p>Website ini dibuat menggunakan <a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> kebijakan-privasi-dan-hukum diff --git a/install/langs/id/data/order_state.xml b/install/langs/id/data/order_state.xml index ee9f6bef5..16815db43 100644 --- a/install/langs/id/data/order_state.xml +++ b/install/langs/id/data/order_state.xml @@ -1,6 +1,6 @@ - + Menunggu pembayaran @@ -17,7 +17,7 @@ - Refund + Refunded diff --git a/install/langs/id/data/tab.xml b/install/langs/id/data/tab.xml index 9d1abb784..1a4e8d112 100644 --- a/install/langs/id/data/tab.xml +++ b/install/langs/id/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/it/data/category.xml b/install/langs/it/data/category.xml index 22122b13b..d3f326809 100644 --- a/install/langs/it/data/category.xml +++ b/install/langs/it/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/it/data/cms.xml b/install/langs/it/data/cms.xml index b050438a5..c9803da46 100644 --- a/install/langs/it/data/cms.xml +++ b/install/langs/it/data/cms.xml @@ -12,7 +12,7 @@ Note legali Note legali note, legali, crediti - <h2>Note legali</h2><h3>Crediti</h3><p>Ideazione e realizzazione:</p><p>Questo negozio online è stato creato usando <a href="http://www.prestashop.com">il software PrestaShop Shopping Cart</a>. Visitate il blog di e-commerce di PrestaShop <a href="http://www.prestashop.com/blog/en/"></a> per avere notizie e consigli su come vendere online e gestire il vostro sito web di e-commerce.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> note-legali diff --git a/install/langs/it/data/order_state.xml b/install/langs/it/data/order_state.xml index 1236d6fb8..9df4e2ac4 100644 --- a/install/langs/it/data/order_state.xml +++ b/install/langs/it/data/order_state.xml @@ -1,6 +1,6 @@ - + In attesa del pagamento @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/it/data/tab.xml b/install/langs/it/data/tab.xml index 1c0396cc2..b9a54ae8a 100644 --- a/install/langs/it/data/tab.xml +++ b/install/langs/it/data/tab.xml @@ -66,7 +66,8 @@ - + + diff --git a/install/langs/lt/data/category.xml b/install/langs/lt/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/lt/data/category.xml +++ b/install/langs/lt/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/lt/data/cms.xml b/install/langs/lt/data/cms.xml index 2d58b8c17..afe6a4e2b 100644 --- a/install/langs/lt/data/cms.xml +++ b/install/langs/lt/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/lt/data/order_state.xml b/install/langs/lt/data/order_state.xml index e59f3b9df..f22b1f4be 100644 --- a/install/langs/lt/data/order_state.xml +++ b/install/langs/lt/data/order_state.xml @@ -17,7 +17,7 @@ - Refund + Refunded @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/lt/data/tab.xml b/install/langs/lt/data/tab.xml index aaf9c5548..b11391910 100644 --- a/install/langs/lt/data/tab.xml +++ b/install/langs/lt/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/mk/data/category.xml b/install/langs/mk/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/mk/data/category.xml +++ b/install/langs/mk/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/mk/data/cms.xml b/install/langs/mk/data/cms.xml index 437df2de4..d96e794b1 100644 --- a/install/langs/mk/data/cms.xml +++ b/install/langs/mk/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Web site was created using <a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/mk/data/order_state.xml b/install/langs/mk/data/order_state.xml index 24380cc58..f22b1f4be 100644 --- a/install/langs/mk/data/order_state.xml +++ b/install/langs/mk/data/order_state.xml @@ -9,7 +9,7 @@ - Preparation in progress + Processing in progress @@ -17,7 +17,7 @@ - Refund + Refunded @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/mk/data/tab.xml b/install/langs/mk/data/tab.xml index b18f57736..06fbbe8cc 100644 --- a/install/langs/mk/data/tab.xml +++ b/install/langs/mk/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/nl/data/category.xml b/install/langs/nl/data/category.xml index 5f4802d1d..4b00c8611 100644 --- a/install/langs/nl/data/category.xml +++ b/install/langs/nl/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/nl/data/cms.xml b/install/langs/nl/data/cms.xml index f1cbf8cf6..77bb6c2ad 100644 --- a/install/langs/nl/data/cms.xml +++ b/install/langs/nl/data/cms.xml @@ -12,7 +12,7 @@ Wettelijke Mededeling Wettelijke mededeling mededeling, wettelijk, kredieten - <h2>Wettelijk</h2><h3>Kredieten</h3><p>Concept en productie:</p><p>Deze Webwinkel is opgezet met <a href="http://www.prestashop.com">Prestashop Webwinkel Software</a>, op Prestashop's <a href="http://www.prestashop.com/blog/en/">e-commerce blog</a> vindt u nieuws en advies over online verkopen en het runnen van uw e-commerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> wettelijke-mededeling diff --git a/install/langs/nl/data/order_state.xml b/install/langs/nl/data/order_state.xml index 15bed3718..0b5e4683b 100644 --- a/install/langs/nl/data/order_state.xml +++ b/install/langs/nl/data/order_state.xml @@ -1,6 +1,6 @@ - + In afwachting van betaling diff --git a/install/langs/nl/data/tab.xml b/install/langs/nl/data/tab.xml index 2580f90d0..4b8107c26 100644 --- a/install/langs/nl/data/tab.xml +++ b/install/langs/nl/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/no/data/category.xml b/install/langs/no/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/no/data/category.xml +++ b/install/langs/no/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/no/data/cms.xml b/install/langs/no/data/cms.xml index 260ed61f3..9cbf0d7f4 100644 --- a/install/langs/no/data/cms.xml +++ b/install/langs/no/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Web site was created using <a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/no/data/order_state.xml b/install/langs/no/data/order_state.xml index 703612756..f22b1f4be 100644 --- a/install/langs/no/data/order_state.xml +++ b/install/langs/no/data/order_state.xml @@ -9,7 +9,7 @@ - Preparation in progress + Processing in progress @@ -17,7 +17,7 @@ - Refund + Refunded @@ -25,7 +25,7 @@ - Payment remotely accepted + Remote payment accepted @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/no/data/tab.xml b/install/langs/no/data/tab.xml index d3810aac1..5d694eb85 100644 --- a/install/langs/no/data/tab.xml +++ b/install/langs/no/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/pl/data/category.xml b/install/langs/pl/data/category.xml index 441ec0b96..148500bf1 100644 --- a/install/langs/pl/data/category.xml +++ b/install/langs/pl/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/pl/data/cms.xml b/install/langs/pl/data/cms.xml index c88b9e1c1..f58ad96bd 100644 --- a/install/langs/pl/data/cms.xml +++ b/install/langs/pl/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Web site was created using <a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/pl/data/order_state.xml b/install/langs/pl/data/order_state.xml index 0d33de505..f216ff27c 100644 --- a/install/langs/pl/data/order_state.xml +++ b/install/langs/pl/data/order_state.xml @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/pl/data/tab.xml b/install/langs/pl/data/tab.xml index 9386cdb1e..10d1bed92 100644 --- a/install/langs/pl/data/tab.xml +++ b/install/langs/pl/data/tab.xml @@ -66,7 +66,8 @@ - + + diff --git a/install/langs/pt/data/category.xml b/install/langs/pt/data/category.xml index 364ded709..b72cc1d2f 100644 --- a/install/langs/pt/data/category.xml +++ b/install/langs/pt/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/pt/data/cms.xml b/install/langs/pt/data/cms.xml index 058b8644c..30cdf5b76 100644 --- a/install/langs/pt/data/cms.xml +++ b/install/langs/pt/data/cms.xml @@ -12,7 +12,7 @@ Informação legal Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Web site was created using <a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> informacao-legal diff --git a/install/langs/pt/data/tab.xml b/install/langs/pt/data/tab.xml index d0d156f45..379cd9823 100644 --- a/install/langs/pt/data/tab.xml +++ b/install/langs/pt/data/tab.xml @@ -66,7 +66,8 @@ - + + diff --git a/install/langs/qc/data/category.xml b/install/langs/qc/data/category.xml index bd5745b2d..3bcbd4562 100644 --- a/install/langs/qc/data/category.xml +++ b/install/langs/qc/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/qc/data/cms.xml b/install/langs/qc/data/cms.xml index 8e4a24592..02477b527 100644 --- a/install/langs/qc/data/cms.xml +++ b/install/langs/qc/data/cms.xml @@ -12,7 +12,7 @@ Mentions légales Mentions légales mentions, légales, crédits - <h2>Mentions légales</h2><h3>Crédits</h3><p>Conception et production :</p><p>cette boutique en ligne a été créée à l'aide du <a href="http://www.prestashop.com">logiciel PrestaShop. </a>Rendez-vous sur le <a href="http://www.prestashop.com/blog/en/">blog e-commerce de PrestaShop</a> pour vous tenir au courant des dernières actualités et obtenir des conseils sur la vente en ligne et la gestion d'un site d'e-commerce.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> mentions-legales diff --git a/install/langs/qc/data/order_state.xml b/install/langs/qc/data/order_state.xml index ed5c4dd61..3d7c8b67b 100644 --- a/install/langs/qc/data/order_state.xml +++ b/install/langs/qc/data/order_state.xml @@ -1,6 +1,6 @@ - + En attente de paiement diff --git a/install/langs/qc/data/tab.xml b/install/langs/qc/data/tab.xml index 97a0cd4e6..3a8822b69 100644 --- a/install/langs/qc/data/tab.xml +++ b/install/langs/qc/data/tab.xml @@ -66,7 +66,8 @@ - + + diff --git a/install/langs/ro/data/category.xml b/install/langs/ro/data/category.xml index 936b8f829..75871ddf4 100644 --- a/install/langs/ro/data/category.xml +++ b/install/langs/ro/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/ro/data/cms.xml b/install/langs/ro/data/cms.xml index 81d15b734..a6471c5a4 100644 --- a/install/langs/ro/data/cms.xml +++ b/install/langs/ro/data/cms.xml @@ -12,7 +12,7 @@ Notificare legală Notificare legală notificare, legala, acreditari - <h2>Legale</h2><h3>Acreditări</h3><p>Concept și producție:</p><p>Acest magazin online a fost creat folosind <a href="http://www.prestashop.com">aplicația de comerț electronic PrestaShop</a>,răsfoiți <a href="http://www.prestashop.com/blog/en/">blogul despre comerț electronic al PrestaShop</a> pentru noutăți și sfaturi despre vânzarea online și administrarea unui site de comerț electronic.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> notificare-legala diff --git a/install/langs/ro/data/order_state.xml b/install/langs/ro/data/order_state.xml index bd8677aba..14f13d0e3 100644 --- a/install/langs/ro/data/order_state.xml +++ b/install/langs/ro/data/order_state.xml @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/ro/data/tab.xml b/install/langs/ro/data/tab.xml index 538a36389..30bf5403e 100644 --- a/install/langs/ro/data/tab.xml +++ b/install/langs/ro/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/ru/data/category.xml b/install/langs/ru/data/category.xml index 02ad317a7..44d901c2e 100644 --- a/install/langs/ru/data/category.xml +++ b/install/langs/ru/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/ru/data/cms.xml b/install/langs/ru/data/cms.xml index 5dc273a8e..fe04339ae 100644 --- a/install/langs/ru/data/cms.xml +++ b/install/langs/ru/data/cms.xml @@ -12,7 +12,7 @@ Правовое положение Правовое положениe правовое положение, права - <h2>Правовое положение</h2><p>Производство:</p><p>Этот сайт был создан на <a href="http://www.prestashop.com">PrestaShop</a>&trade; ПО с открытым доступом </p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/ru/data/order_state.xml b/install/langs/ru/data/order_state.xml index f5834c9c6..c2bcb5ccc 100644 --- a/install/langs/ru/data/order_state.xml +++ b/install/langs/ru/data/order_state.xml @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/ru/data/tab.xml b/install/langs/ru/data/tab.xml index 8074f77a1..57aafbcb4 100644 --- a/install/langs/ru/data/tab.xml +++ b/install/langs/ru/data/tab.xml @@ -68,7 +68,8 @@ - + + diff --git a/install/langs/si/data/category.xml b/install/langs/si/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/si/data/category.xml +++ b/install/langs/si/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/si/data/cms.xml b/install/langs/si/data/cms.xml index 2d58b8c17..afe6a4e2b 100644 --- a/install/langs/si/data/cms.xml +++ b/install/langs/si/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/si/data/order_state.xml b/install/langs/si/data/order_state.xml index e59f3b9df..f22b1f4be 100644 --- a/install/langs/si/data/order_state.xml +++ b/install/langs/si/data/order_state.xml @@ -17,7 +17,7 @@ - Refund + Refunded @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/si/data/tab.xml b/install/langs/si/data/tab.xml index f586e4eda..265c4ce86 100644 --- a/install/langs/si/data/tab.xml +++ b/install/langs/si/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/sr/data/category.xml b/install/langs/sr/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/sr/data/category.xml +++ b/install/langs/sr/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/sr/data/cms.xml b/install/langs/sr/data/cms.xml index 260ed61f3..9cbf0d7f4 100644 --- a/install/langs/sr/data/cms.xml +++ b/install/langs/sr/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Web site was created using <a href="http://www.prestashop.com">PrestaShop</a>&trade; open-source software.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/sr/data/order_state.xml b/install/langs/sr/data/order_state.xml index 24380cc58..f22b1f4be 100644 --- a/install/langs/sr/data/order_state.xml +++ b/install/langs/sr/data/order_state.xml @@ -9,7 +9,7 @@ - Preparation in progress + Processing in progress @@ -17,7 +17,7 @@ - Refund + Refunded @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/sr/data/tab.xml b/install/langs/sr/data/tab.xml index d4870637b..a40848ea0 100644 --- a/install/langs/sr/data/tab.xml +++ b/install/langs/sr/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/sv/data/category.xml b/install/langs/sv/data/category.xml index 87b90b95e..05d04e86b 100644 --- a/install/langs/sv/data/category.xml +++ b/install/langs/sv/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/sv/data/cms.xml b/install/langs/sv/data/cms.xml index 2d58b8c17..afe6a4e2b 100644 --- a/install/langs/sv/data/cms.xml +++ b/install/langs/sv/data/cms.xml @@ -12,7 +12,7 @@ Legal Notice Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/sv/data/order_state.xml b/install/langs/sv/data/order_state.xml index b4d010221..f22b1f4be 100644 --- a/install/langs/sv/data/order_state.xml +++ b/install/langs/sv/data/order_state.xml @@ -17,7 +17,7 @@ - Refund + Refunded diff --git a/install/langs/sv/data/tab.xml b/install/langs/sv/data/tab.xml index 07d714118..fea2b137f 100644 --- a/install/langs/sv/data/tab.xml +++ b/install/langs/sv/data/tab.xml @@ -20,7 +20,8 @@ - + + diff --git a/install/langs/tw/data/category.xml b/install/langs/tw/data/category.xml index 53f14132b..3c3625541 100644 --- a/install/langs/tw/data/category.xml +++ b/install/langs/tw/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/tw/data/cms.xml b/install/langs/tw/data/cms.xml index 1a2e75a60..75e8e9268 100644 --- a/install/langs/tw/data/cms.xml +++ b/install/langs/tw/data/cms.xml @@ -12,7 +12,7 @@ 法律聲明 法律聲明 notice, legal, credits - 請在這裡填入網站的法律聲明 + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/tw/data/order_state.xml b/install/langs/tw/data/order_state.xml index cf52116b7..05008b4f9 100644 --- a/install/langs/tw/data/order_state.xml +++ b/install/langs/tw/data/order_state.xml @@ -44,5 +44,4 @@ Partial payment accepted - diff --git a/install/langs/tw/data/tab.xml b/install/langs/tw/data/tab.xml index 3e560de6f..3da81a133 100644 --- a/install/langs/tw/data/tab.xml +++ b/install/langs/tw/data/tab.xml @@ -22,7 +22,8 @@ - + + diff --git a/install/langs/vn/data/category.xml b/install/langs/vn/data/category.xml index 9355fa05b..07af7b042 100644 --- a/install/langs/vn/data/category.xml +++ b/install/langs/vn/data/category.xml @@ -16,4 +16,20 @@ + + Locations + + locations + + + + + + Services + + services + + + + diff --git a/install/langs/vn/data/cms.xml b/install/langs/vn/data/cms.xml index aff88e4db..485df8f41 100644 --- a/install/langs/vn/data/cms.xml +++ b/install/langs/vn/data/cms.xml @@ -12,7 +12,7 @@ Thông báo pháp lý Legal notice notice, legal, credits - <h2>Legal</h2><h3>Credits</h3><p>Concept and production:</p><p>This Online store was created using <a href="http://www.prestashop.com">Prestashop Shopping Cart Software</a>,check out PrestaShop's <a href="http://www.prestashop.com/blog/en/">ecommerce blog</a> for news and advices about selling online and running your ecommerce website.</p> + <h2>Legal</h2><h3>Credits</h3><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> legal-notice diff --git a/install/langs/vn/data/order_state.xml b/install/langs/vn/data/order_state.xml index 2df84fb4b..f2d195131 100644 --- a/install/langs/vn/data/order_state.xml +++ b/install/langs/vn/data/order_state.xml @@ -28,9 +28,9 @@ Remote payment accepted - - Awaiting Cash On Delivery validation - + + Awaiting remote payment +