diff --git a/.gitignore b/.gitignore
index a6845dd3e..3017e8d48 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,31 +1,44 @@
-local/config/build.properties
-local/config/config_db.php
-local/config/build
-local/config/database.yml
-local/config/database.yml.sample.save
-core/vendor
-local/config/runtime-conf.xml
-cache/*
-log/*
-bin/*
-local/session/*
-coverage
-.idea
-.buildpath
-.project
-.settings/
-local/media/documents/*
-local/media/images/*
-web/assets/*
-web/cache/*
-web/tinymce
-web/media
-phpdoc*.log
-xhprof/
-phpunit.phar
-.DS_Store
-phpmyadmin
-templates/default-esi
-local/modules/TemplateEsiModule
-composer.phar
-web/.htaccess
+local/config/build.properties
+local/config/config_db.php
+local/config/build
+local/config/database.yml
+local/config/database.yml.sample.save
+core/vendor
+local/config/runtime-conf.xml
+cache/*
+log/*
+bin/*
+local/session/*
+coverage
+.idea
+.buildpath
+.project
+.settings/
+local/media/documents/*
+local/media/images/*
+web/assets/*
+web/cache/*
+web/tinymce
+web/media
+phpdoc*.log
+xhprof/
+phpunit.phar
+.DS_Store
+phpmyadmin
+composer.phar
+web/.htaccess
+
+# Ignore everything in the "modules" directory, except the "default modules"
+local/modules/*
+!local/modules/Cheque/
+!local/modules/Front/
+!local/modules/TheliaDebugBar/
+!local/modules/Tinymce/
+!local/modules/Colissimo/
+
+# Ignore everything in the "templates" directory, except the "default template"
+templates/*
+!templates/backOffice/
+!templates/email/
+!templates/frontOffice/
+!templates/pdf/
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..af9d60242
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "local/modules/Klikandpay"]
+ path = local/modules/Klikandpay
+ url = https://github.com/thelia-modules/Klikandpay
diff --git a/.travis.yml b/.travis.yml
index eb6e3a046..56524f1a5 100755
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,7 +15,7 @@ before_script:
- composer install --prefer-dist --dev
- sh -c "mysql -u$DB_USER -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS thelia;SET FOREIGN_KEY_CHECKS = 1;'; fi"
- php Thelia thelia:install --db_host=localhost --db_username=$DB_USER --db_name=thelia
- - php install/faker.php
+ - php setup/faker.php
- php Thelia module:activate Colissimo
- php Thelia module:activate Cheque
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77146ebee..7797282d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,36 @@
+#2.0.1
+- possibility to apply a permanent discount on a customer
+- display estimated shipping on cart page
+- export newsletter subscribers list
+- Fix redirect issues
+- enhancement of coupon UI
+- enhancement of admin menu. Coupon is now in Tools menu
+- front office, email and pdf templates are translated in Russian and Czech
+- fix bugs : https://github.com/thelia/thelia/issues?milestone=4&page=1&state=closed
+
#2.0.0
-- coupons effect are recalculated after each product's cart modification
+- Coupons values are re-evaluated when a product quantity is changed in the shopping cart
- You can declare new compilerPass in modules. See Thelia\Module\BaseModule::getCompilers phpDoc
- Add ability to load assets from another template. See https://gist.github.com/lunika/9365180
+- allow possibility to use Dependency Injection compiler in Thelia modules
+- Add Deactivate Module Command Line
+- Add indexes to database to improve performance
+- Order and customer references are more human readable than before
+- Refactor intl process. A domain is created for each templates and modules :
+ - core => for thelia core translations
+ - bo.template_name (eg : bo.default) => for each backoffice template
+ - fo.template_name (eg : fo.default) => for each frontoffice template
+ - pdf.template_name (eg : pdf.default) => for each pdf template
+ - email.template_name (eg : email.default) => for each email template
+ - modules :
+ - module_code (eg : paypal) => fore module core translations
+ - module_code.ai (eg : paypal.ai) => used in AdminIncludes templates
+ - bo.module_code.template_name (eg : bo.paypal.default) => used in back office template
+ - fo.module_code.template_name (eg : fo.paypal.default) => used in front office template
+- new parameter for smarty ```intl``` function. The parameter ```d``` allow you to specify the translation domain (as explain before). This parameter is optional
+- the ```d``` can be omitted if you use ```{default_translation_domain domain='bo.default'}``` in your layout. If you use this smarty function, the ```d``` parameter is automatically set with the domain specify in ```default_translation_domain``` function
+- We changed Thelia's license. Thelia is published under the LGPL 3.0+ License
+
#2.0.0-RC1
- Remove container from BaseAction.
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 6812da56c..2ded5698b 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -4,6 +4,7 @@ please email us (info@thelia.net) or fork this file on Github and send a pull-re
Manuel Raynaud - manu@thelia.net
Etienne Roudeix - etienne.roudeix@gmail.com
Franck Allimant - franck@allimant.org
+Julien Chanséaume - jchanseaume@openstudio.fr
Guillaume Morel - gmorel@openstudio.fr
Michaël Espeche - mespeche@openstudio.fr
Christophe Laffont - claffont@openstudio.fr
diff --git a/LICENSE.txt b/LICENSE.txt
index 94a9ed024..65c5ca88a 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,674 +1,165 @@
- GNU GENERAL PUBLIC LICENSE
+ 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.
- 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 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.
diff --git a/Readme.md b/Readme.md
index 921ccce47..58134075e 100644
--- a/Readme.md
+++ b/Readme.md
@@ -5,11 +5,13 @@ Thelia
------
[](https://travis-ci.org/thelia/thelia) [](https://packagist.org/packages/thelia/thelia) [](https://scrutinizer-ci.com/g/thelia/thelia/)
-[Thelia](http://thelia.net/v2) is an open source tool for creating e-business websites and managing online content. This software is published under GPL.
+[Thelia](http://thelia.net/) is an open source tool for creating e-business websites and managing online content. This software is published under LGPL.
-Here is the most recent developed code for the next major version (v2). You can download this version for testing or having a look on the code (or anything you wish, respecting GPL). See http://thelia.net/v2 web site for more information.
+This is the new major version of Thelia.
-Most part of the code can possibly change, a large part will be refactor soon, graphical setup does not exist yet.
+You can download this version and have a try or take a look at the source code (or anything you wish, respecting LGPL). See http://thelia.net/ web site for more information.
+
+A repository containing all thelia modules is available at this address : https://github.com/thelia-modules
Requirements
------------
@@ -34,7 +36,7 @@ If you use Mac OSX, it still doesn't use php 5.4 as default php version... There
* use last MAMP version and put the php bin directory in your path:
```bash
-export PATH=/Applications/MAMP/bin/php/php5.4.x/bin/:$PATH
+export PATH=/Applications/MAMP/bin/php/php5.5.x/bin/:$PATH
```
* configure a complete development environment : http://php-osx.liip.ch/
@@ -65,15 +67,36 @@ SET @@GLOBAL.sql_mode='NO_ENGINE_SUBSTITUTION', @@SESSION.sql_mode='NO_ENGINE_SU
For more information on sql_mode you can consult the [MySQL doc](http://dev.mysql.com/doc/refman/5.0/fr/server-sql-mode.html "sql Mode")
-Installation
-------------
+## Download Thelia 2
``` bash
$ curl -sS https://getcomposer.org/installer | php
-$ php composer.phar create-project thelia/thelia path/ 2.0.0-RC1
+$ php composer.phar create-project thelia/thelia path/ 2.0.0
```
-Finish the installation using cli tools :
+## Install it
+
+You can install Thelia by two different way
+
+### Using install wizard
+
+Installing thelia with the web install wizard allow to create an administrator, add some informations about your shop, etc
+
+First of all, you have to configure a vhost as describe in [configuration](http://doc.thelia.net/en/documentation/configuration.html) section.
+
+The install wizard in accessible with your favorite browser :
+
+``` bash
+http://yourdomain.tld/[/subdomain_if_needed]/install
+```
+
+For example, I have thelia downloaded at http://thelia.net and my vhost is correctly configured, I have to reach this address :
+
+``` bash
+http://thelia.net/install
+```
+
+### Using cli tools
``` bash
$ php Thelia thelia:install
@@ -89,6 +112,12 @@ Thelia documentation is available at http://doc.thelia.net
The documentation is also in beta version and some part can be obsolete cause to some refactor.
+Roadmap
+-------
+
+The Roadmap is available at http://thelia.net/community/roadmap
+
+
Contribute
----------
diff --git a/Thelia b/Thelia
index a161b610f..ab1dc7a07 100755
--- a/Thelia
+++ b/Thelia
@@ -1,6 +1,8 @@
#!/usr/bin/env php
=5.4",
"ircmaxell/password-compat": "1.0.*",
"propel/propel": "dev-master",
- "psr/log" : "1.0",
+ "psr/log": "1.0",
"symfony/class-loader": "2.2.*",
- "symfony/config" : "2.2.*",
- "symfony/console" : "2.2.*",
- "symfony/dependency-injection" : "2.2.*",
- "symfony/event-dispatcher" : "2.2.*",
- "symfony/http-kernel" : "2.2.*",
- "symfony/routing" : "2.2.*",
- "symfony/filesystem" : "2.2.*",
- "symfony/yaml" : "2.2.*",
- "symfony/translation" : "2.2.*",
-
+ "symfony/config": "2.2.*",
+ "symfony/console": "2.2.*",
+ "symfony/dependency-injection": "2.2.*",
+ "symfony/event-dispatcher": "2.2.*",
+ "symfony/http-kernel": "2.2.*",
+ "symfony/routing": "2.2.*",
+ "symfony/filesystem": "2.2.*",
+ "symfony/yaml": "2.2.*",
+ "symfony/translation": "2.2.*",
"symfony-cmf/routing": "1.0.0",
-
"symfony/form": "2.2.*",
"symfony/validator": "2.3.*",
-
"smarty/smarty": "v3.1.14",
"kriswallsmith/assetic": "1.2.*@dev",
"leafo/lessphp": "0.4.*",
"ptachoire/cssembed": "1.0.*",
-
+ "doctrine/cache": "v1.3.0",
"simplepie/simplepie": "dev-master",
-
"imagine/imagine": "0.*",
"symfony/icu": "1.0",
"swiftmailer/swiftmailer": "5.0.*",
@@ -42,20 +38,20 @@
"ensepar/html2pdf": "1.0.1",
"symfony/finder": "~2.2"
},
- "require-dev" : {
+ "require-dev": {
"phpunit/phpunit": "3.7.*",
"fzaninotto/faker": "dev-master",
"maximebf/debugbar": "dev-master"
},
"minimum-stability": "stable",
- "config" : {
- "vendor-dir" : "core/vendor",
- "bin-dir" : "bin"
+ "config": {
+ "vendor-dir": "core/vendor",
+ "bin-dir": "bin"
},
"autoload": {
"psr-0": {
"": "local/modules/",
- "Thelia" : "core/lib/"
+ "Thelia": "core/lib/"
}
},
"extra": {
@@ -79,7 +75,9 @@
"reference": "tags/Smarty_3_1_14/distribution/"
},
"autoload": {
- "classmap": ["libs/"]
+ "classmap": [
+ "libs/"
+ ]
}
}
}
diff --git a/composer.lock b/composer.lock
index b333e828c..d7da926ba 100644
--- a/composer.lock
+++ b/composer.lock
@@ -3,8 +3,82 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "92d99dbb21763697accf7050ded155b6",
+ "hash": "d1e1c31ed8e38f2282ab431898cf8b08",
"packages": [
+ {
+ "name": "doctrine/cache",
+ "version": "v1.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/cache.git",
+ "reference": "e16d7adf45664a50fa86f515b6d5e7f670130449"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/cache/zipball/e16d7adf45664a50fa86f515b6d5e7f670130449",
+ "reference": "e16d7adf45664a50fa86f515b6d5e7f670130449",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "conflict": {
+ "doctrine/common": ">2.2,<2.4"
+ },
+ "require-dev": {
+ "phpunit/phpunit": ">=3.7",
+ "satooshi/php-coveralls": "~0.6"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Doctrine\\Common\\Cache\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jonathan H. Wage",
+ "email": "jonwage@gmail.com",
+ "homepage": "http://www.jwage.com/",
+ "role": "Creator"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com",
+ "homepage": "http://www.instaclick.com"
+ },
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com",
+ "homepage": "http://jmsyst.com",
+ "role": "Developer of wrapped JMSSerializerBundle"
+ }
+ ],
+ "description": "Caching library offering an object-oriented API for many cache backends",
+ "homepage": "http://www.doctrine-project.org",
+ "keywords": [
+ "cache",
+ "caching"
+ ],
+ "time": "2013-10-25 19:04:14"
+ },
{
"name": "ensepar/html2pdf",
"version": "1.0.1",
diff --git a/core/bootstrap.php b/core/bootstrap.php
index 7578ec1de..87cbb2907 100644
--- a/core/bootstrap.php
+++ b/core/bootstrap.php
@@ -1,9 +1,17 @@
getUriForPath('/install'));
+ header('Location: '.$request->getUriForPath('/install'));
+ exit;
}
}
diff --git a/core/lib/Thelia/Action/Address.php b/core/lib/Thelia/Action/Address.php
index 9e278d899..e6e9b9f65 100644
--- a/core/lib/Thelia/Action/Address.php
+++ b/core/lib/Thelia/Action/Address.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Administrator.php b/core/lib/Thelia/Action/Administrator.php
index 77078df0b..74e11f517 100644
--- a/core/lib/Thelia/Action/Administrator.php
+++ b/core/lib/Thelia/Action/Administrator.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Area.php b/core/lib/Thelia/Action/Area.php
index 19037c9e4..f15039d02 100644
--- a/core/lib/Thelia/Action/Area.php
+++ b/core/lib/Thelia/Action/Area.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Attribute.php b/core/lib/Thelia/Action/Attribute.php
index 5372f1ec7..ef7866476 100644
--- a/core/lib/Thelia/Action/Attribute.php
+++ b/core/lib/Thelia/Action/Attribute.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/AttributeAv.php b/core/lib/Thelia/Action/AttributeAv.php
index 5c3fdebc4..1b88b4209 100644
--- a/core/lib/Thelia/Action/AttributeAv.php
+++ b/core/lib/Thelia/Action/AttributeAv.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php
index 46dc3eaf1..ed42f14e1 100644
--- a/core/lib/Thelia/Action/BaseAction.php
+++ b/core/lib/Thelia/Action/BaseAction.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
@@ -38,7 +27,7 @@ class BaseAction
* @param ModelCriteria $query
* @param UpdatePositionEvent $event
*
- * @return mixed
+ * @return null
*/
protected function genericUpdatePosition(ModelCriteria $query, UpdatePositionEvent $event)
{
diff --git a/core/lib/Thelia/Action/BaseCachedFile.php b/core/lib/Thelia/Action/BaseCachedFile.php
index 63f99dc1f..ce70eed47 100644
--- a/core/lib/Thelia/Action/BaseCachedFile.php
+++ b/core/lib/Thelia/Action/BaseCachedFile.php
@@ -1,26 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
-
namespace Thelia\Action;
use Thelia\Core\Event\CachedFileEvent;
diff --git a/core/lib/Thelia/Action/Cache.php b/core/lib/Thelia/Action/Cache.php
index 85cedadd8..6532dda35 100644
--- a/core/lib/Thelia/Action/Cache.php
+++ b/core/lib/Thelia/Action/Cache.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Cart.php b/core/lib/Thelia/Action/Cart.php
index 69ef2dd29..da4ff8706 100644
--- a/core/lib/Thelia/Action/Cart.php
+++ b/core/lib/Thelia/Action/Cart.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
@@ -26,12 +15,14 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Cart\CartEvent;
+use Thelia\Core\Event\Currency\CurrencyChangeEvent;
use Thelia\Core\Event\TheliaEvents;
-use Thelia\Model\ProductPrice;
-use Thelia\Model\ProductPriceQuery;
+use Thelia\Model\Base\ProductSaleElementsQuery;
+use Thelia\Model\Currency;
use Thelia\Model\CartItem;
use Thelia\Model\CartItemQuery;
use Thelia\Model\ConfigQuery;
+use Thelia\Model\Tools\ProductPriceTools;
/**
*
@@ -43,6 +34,7 @@ use Thelia\Model\ConfigQuery;
*/
class Cart extends BaseAction implements EventSubscriberInterface
{
+
/**
*
* add an article in the current cart
@@ -55,6 +47,13 @@ class Cart extends BaseAction implements EventSubscriberInterface
$newness = $event->getNewness();
$append = $event->getAppend();
$quantity = $event->getQuantity();
+ $currency = $cart->getCurrency();
+ $customer = $cart->getCustomer();
+ $discount = 0;
+
+ if (null !== $customer && $customer->getDiscount() > 0) {
+ $discount = $customer->getDiscount();
+ }
$productSaleElementsId = $event->getProductSaleElementsId();
$productId = $event->getProduct();
@@ -62,13 +61,16 @@ class Cart extends BaseAction implements EventSubscriberInterface
$cartItem = $this->findItem($cart->getId(), $productId, $productSaleElementsId);
if ($cartItem === null || $newness) {
- $productPrice = ProductPriceQuery::create()
- ->filterByProductSaleElementsId($productSaleElementsId)
- ->findOne();
- $event->setCartItem(
- $this->doAddItem($event->getDispatcher(), $cart, $productId, $productPrice->getProductSaleElements(), $quantity, $productPrice)
- );
+ $productSaleElements = ProductSaleElementsQuery::create()
+ ->findPk($productSaleElementsId);
+
+ if (null !== $productSaleElements) {
+ $productPrices = $productSaleElements->getPricesByCurrency($currency, $discount);
+ $event->setCartItem(
+ $this->doAddItem($event->getDispatcher(), $cart, $productId, $productSaleElements, $quantity, $productPrices)
+ );
+ }
}
if ($append && $cartItem !== null) {
@@ -136,6 +138,52 @@ class Cart extends BaseAction implements EventSubscriberInterface
}
}
+ public function updateCart(CurrencyChangeEvent $event)
+ {
+ $session = $event->getRequest()->getSession();
+ $cart = $session->getCart();
+ if (null !== $cart) {
+ $this->updateCartPrices($cart, $event->getCurrency());
+ }
+ }
+
+ /**
+ *
+ * Refresh article's price
+ *
+ * @param \Thelia\Model\Cart $cart
+ * @param \Thelia\Model\Currency $currency
+ */
+ public function updateCartPrices(\Thelia\Model\Cart $cart, Currency $currency)
+ {
+
+ $customer = $cart->getCustomer();
+ $discount = 0;
+
+ if (null !== $customer && $customer->getDiscount() > 0) {
+ $discount = $customer->getDiscount();
+ }
+
+ // cart item
+ foreach ($cart->getCartItems() as $cartItem) {
+ $productSaleElements = $cartItem->getProductSaleElements();
+
+ $productPrice = $productSaleElements->getPricesByCurrency($currency, $discount);
+
+ $cartItem
+ ->setPrice($productPrice->getPrice())
+ ->setPromoPrice($productPrice->getPromoPrice());
+
+ $cartItem->save();
+ }
+
+ // update the currency cart
+ $cart->setCurrencyId($currency->getId());
+ $cart->save();
+
+ }
+
+
/**
* Returns an array of event names this subscriber wants to listen to.
*
@@ -163,6 +211,7 @@ class Cart extends BaseAction implements EventSubscriberInterface
TheliaEvents::CART_DELETEITEM => array("deleteItem", 128),
TheliaEvents::CART_UPDATEITEM => array("changeItem", 128),
TheliaEvents::CART_CLEAR => array("clear", 128),
+ TheliaEvents::CHANGE_DEFAULT_CURRENCY => array("updateCart", 128),
);
}
@@ -186,15 +235,16 @@ class Cart extends BaseAction implements EventSubscriberInterface
/**
* try to attach a new item to an existing cart
*
- * @param \Thelia\Model\Cart $cart
- * @param int $productId
- * @param \Thelia\Model\ProductSaleElements $productSaleElements
- * @param float $quantity
- * @param ProductPrice $productPrice
+ * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
+ * @param \Thelia\Model\Cart $cart
+ * @param int $productId
+ * @param \Thelia\Model\ProductSaleElements $productSaleElements
+ * @param float $quantity
+ * @param ProductPriceTools $productPrices
*
* @return CartItem
*/
- protected function doAddItem(EventDispatcherInterface $dispatcher, \Thelia\Model\Cart $cart, $productId, \Thelia\Model\ProductSaleElements $productSaleElements, $quantity, ProductPrice $productPrice)
+ protected function doAddItem(EventDispatcherInterface $dispatcher, \Thelia\Model\Cart $cart, $productId, \Thelia\Model\ProductSaleElements $productSaleElements, $quantity, ProductPriceTools $productPrices)
{
$cartItem = new CartItem();
$cartItem->setDisptacher($dispatcher);
@@ -203,8 +253,8 @@ class Cart extends BaseAction implements EventSubscriberInterface
->setProductId($productId)
->setProductSaleElementsId($productSaleElements->getId())
->setQuantity($quantity)
- ->setPrice($productPrice->getPrice())
- ->setPromoPrice($productPrice->getPromoPrice())
+ ->setPrice($productPrices->getPrice())
+ ->setPromoPrice($productPrices->getPromoPrice())
->setPromo($productSaleElements->getPromo())
->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30))
->save();
diff --git a/core/lib/Thelia/Action/Category.php b/core/lib/Thelia/Action/Category.php
index 2029af138..b2ccf4146 100644
--- a/core/lib/Thelia/Action/Category.php
+++ b/core/lib/Thelia/Action/Category.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Config.php b/core/lib/Thelia/Action/Config.php
index 377eb17f6..f63c86479 100644
--- a/core/lib/Thelia/Action/Config.php
+++ b/core/lib/Thelia/Action/Config.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Content.php b/core/lib/Thelia/Action/Content.php
index 98a094f7b..e6f4462c7 100644
--- a/core/lib/Thelia/Action/Content.php
+++ b/core/lib/Thelia/Action/Content.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Country.php b/core/lib/Thelia/Action/Country.php
index 4c2d0839b..bf43a888d 100644
--- a/core/lib/Thelia/Action/Country.php
+++ b/core/lib/Thelia/Action/Country.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Coupon.php b/core/lib/Thelia/Action/Coupon.php
index 82de51bdf..aaa827a9d 100644
--- a/core/lib/Thelia/Action/Coupon.php
+++ b/core/lib/Thelia/Action/Coupon.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Currency.php b/core/lib/Thelia/Action/Currency.php
index 5e391c2bc..0a79e37be 100644
--- a/core/lib/Thelia/Action/Currency.php
+++ b/core/lib/Thelia/Action/Currency.php
@@ -1,31 +1,20 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Thelia\Core\Event\ActionEvent;
use Thelia\Model\CurrencyQuery;
use Thelia\Model\Currency as CurrencyModel;
@@ -98,18 +87,14 @@ class Currency extends BaseAction implements EventSubscriberInterface
{
if (null !== $currency = CurrencyQuery::create()->findPk($event->getCurrencyId())) {
+ // Reset default status
+ CurrencyQuery::create()->filterByByDefault(true)->update(array('ByDefault' => false));
- if ($currency->getByDefault() != $event->getIsDefault()) {
-
- // Reset default status
- CurrencyQuery::create()->filterByByDefault(true)->update(array('ByDefault' => false));
-
- $currency
- ->setDispatcher($event->getDispatcher())
- ->setByDefault($event->getIsDefault())
- ->save()
- ;
- }
+ $currency
+ ->setDispatcher($event->getDispatcher())
+ ->setByDefault($event->getIsDefault())
+ ->save()
+ ;
$event->setCurrency($currency);
}
@@ -134,7 +119,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
}
}
- public function updateRates(EventDispatcherInterface $dispatcher)
+ public function updateRates(ActionEvent $event)
{
$rates_url = ConfigQuery::read('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml');
@@ -148,7 +133,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
if (null !== $currency = CurrencyQuery::create()->findOneByCode($code)) {
$currency
- ->setDispatcher($dispatcher)
+ ->setDispatcher($event->getDispatcher())
->setRate($rate)
->save()
;
diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php
index 6220aefe5..62e10446e 100644
--- a/core/lib/Thelia/Action/Customer.php
+++ b/core/lib/Thelia/Action/Customer.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
@@ -147,6 +136,11 @@ class Customer extends BaseAction implements EventSubscriberInterface
public function login(CustomerLoginEvent $event)
{
+ $customer = $event->getCustomer();
+
+ if (method_exists($customer, 'clearDispatcher')) {
+ $customer->clearDispatcher();
+ }
$this->securityContext->setCustomerUser($event->getCustomer());
}
diff --git a/core/lib/Thelia/Action/Document.php b/core/lib/Thelia/Action/Document.php
index 4605ee7c9..b41ea920c 100644
--- a/core/lib/Thelia/Action/Document.php
+++ b/core/lib/Thelia/Action/Document.php
@@ -1,26 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
-
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
diff --git a/core/lib/Thelia/Action/Feature.php b/core/lib/Thelia/Action/Feature.php
index f2cda8e24..544a74b34 100644
--- a/core/lib/Thelia/Action/Feature.php
+++ b/core/lib/Thelia/Action/Feature.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/FeatureAv.php b/core/lib/Thelia/Action/FeatureAv.php
index 9a97c871b..9240a0f04 100644
--- a/core/lib/Thelia/Action/FeatureAv.php
+++ b/core/lib/Thelia/Action/FeatureAv.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Folder.php b/core/lib/Thelia/Action/Folder.php
index 7483c08b6..779fc2376 100644
--- a/core/lib/Thelia/Action/Folder.php
+++ b/core/lib/Thelia/Action/Folder.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/HttpException.php b/core/lib/Thelia/Action/HttpException.php
index d889529fa..934bd9827 100644
--- a/core/lib/Thelia/Action/HttpException.php
+++ b/core/lib/Thelia/Action/HttpException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Image.php b/core/lib/Thelia/Action/Image.php
index 3f92c7cc5..ef76254bf 100644
--- a/core/lib/Thelia/Action/Image.php
+++ b/core/lib/Thelia/Action/Image.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Lang.php b/core/lib/Thelia/Action/Lang.php
index 20fde397a..b44c1b6b3 100644
--- a/core/lib/Thelia/Action/Lang.php
+++ b/core/lib/Thelia/Action/Lang.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
@@ -52,6 +41,9 @@ class Lang extends BaseAction implements EventSubscriberInterface
->setCode($event->getCode())
->setDateFormat($event->getDateFormat())
->setTimeFormat($event->getTimeFormat())
+ ->setDecimalSeparator($event->getDecimalSeparator())
+ ->setThousandsSeparator($event->getThousandsSeparator())
+ ->setDecimals($event->getDecimals())
->save();
$event->setLang($lang);
@@ -80,6 +72,9 @@ class Lang extends BaseAction implements EventSubscriberInterface
->setLocale($event->getLocale())
->setDateFormat($event->getDateFormat())
->setTimeFormat($event->getTimeFormat())
+ ->setDecimalSeparator($event->getDecimalSeparator())
+ ->setThousandsSeparator($event->getThousandsSeparator())
+ ->setDecimals($event->getDecimals())
->save();
$event->setLang($lang);
diff --git a/core/lib/Thelia/Action/MailingSystem.php b/core/lib/Thelia/Action/MailingSystem.php
index 2f62d749b..95caee753 100644
--- a/core/lib/Thelia/Action/MailingSystem.php
+++ b/core/lib/Thelia/Action/MailingSystem.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Message.php b/core/lib/Thelia/Action/Message.php
index de9de9cbb..20c2084de 100644
--- a/core/lib/Thelia/Action/Message.php
+++ b/core/lib/Thelia/Action/Message.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Module.php b/core/lib/Thelia/Action/Module.php
index 05e29020b..7cabcc2fa 100644
--- a/core/lib/Thelia/Action/Module.php
+++ b/core/lib/Thelia/Action/Module.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
@@ -61,9 +50,8 @@ class Module extends BaseAction implements EventSubscriberInterface
public function toggleActivation(ModuleToggleActivationEvent $event)
{
if (null !== $module = ModuleQuery::create()->findPk($event->getModuleId())) {
- $moduleClass = new \ReflectionClass($module->getFullNamespace());
- $moduleInstance = $moduleClass->newInstance();
+ $moduleInstance = $module->createInstance();
if ( method_exists($moduleInstance, 'setContainer')) {
$moduleInstance->setContainer($this->container);
@@ -96,12 +84,11 @@ class Module extends BaseAction implements EventSubscriberInterface
}
try {
- $reflected = new \ReflectionClass($module->getFullNamespace());
+ $instance = $module->createInstance();
- $instance = $reflected->newInstance();
$instance->setContainer($this->container);
- $path = dirname($reflected->getFileName());
+ $path = $module->getAbsoluteBaseDir();
$instance->destroy($con, $event->getDeleteData());
@@ -191,6 +178,8 @@ class Module extends BaseAction implements EventSubscriberInterface
public function updatePosition(UpdatePositionEvent $event)
{
$this->genericUpdatePosition(ModuleQuery::create(), $event);
+
+ $this->cacheClear($event->getDispatcher());
}
protected function cacheClear(EventDispatcherInterface $dispatcher)
diff --git a/core/lib/Thelia/Action/Newsletter.php b/core/lib/Thelia/Action/Newsletter.php
index b43972620..4a4b7a3d4 100644
--- a/core/lib/Thelia/Action/Newsletter.php
+++ b/core/lib/Thelia/Action/Newsletter.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Order.php b/core/lib/Thelia/Action/Order.php
index 0e8293c4a..7d27167cc 100644
--- a/core/lib/Thelia/Action/Order.php
+++ b/core/lib/Thelia/Action/Order.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
@@ -48,7 +37,6 @@ use Thelia\Model\Order as ModelOrder;
use Thelia\Model\OrderAddress;
use Thelia\Model\OrderProduct;
use Thelia\Model\OrderProductAttributeCombination;
-use Thelia\Model\OrderStatus;
use Thelia\Model\OrderStatusQuery;
use Thelia\Tools\I18n;
@@ -106,7 +94,14 @@ class Order extends BaseAction implements EventSubscriberInterface
{
$order = $event->getOrder();
- $order->setDeliveryModuleId($event->getDeliveryModule());
+ $deliveryModuleId = $event->getDeliveryModule();
+
+ $order->setDeliveryModuleId($deliveryModuleId);
+
+ // Reset postage cost if the delivery module had been removed
+ if ($deliveryModuleId <= 0) {
+ $order->setPostage(0);
+ }
$event->setOrder($order);
}
@@ -206,7 +201,7 @@ class Order extends BaseAction implements EventSubscriberInterface
$placedOrder->setInvoiceOrderAddressId($invoiceOrderAddress->getId());
$placedOrder->setStatusId(
- OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_NOT_PAID)->getId()
+ OrderStatusQuery::getNotPaidStatus()->getId()
);
/* memorize discount */
@@ -266,6 +261,7 @@ class Order extends BaseAction implements EventSubscriberInterface
->setTaxRuleTitle($taxRuleI18n->getTitle())
->setTaxRuleDescription($taxRuleI18n->getDescription())
->setEanCode($pse->getEanCode())
+ ->setCartIemId($cartItem->getId())
->setDispatcher($dispatcher)
->save($con)
;
diff --git a/core/lib/Thelia/Action/Pdf.php b/core/lib/Thelia/Action/Pdf.php
index 2bdad9366..cda86a547 100644
--- a/core/lib/Thelia/Action/Pdf.php
+++ b/core/lib/Thelia/Action/Pdf.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php
index b0e443179..5d827be8e 100644
--- a/core/lib/Thelia/Action/Product.php
+++ b/core/lib/Thelia/Action/Product.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
@@ -75,7 +64,7 @@ class Product extends BaseAction implements EventSubscriberInterface
->setRef($event->getRef())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
- ->setVisible($event->getVisible())
+ ->setVisible($event->getVisible() ? 1 : 0)
// Set the default tax rule to this product
->setTaxRule(TaxRuleQuery::create()->findOneByIsDefault(true))
@@ -109,7 +98,7 @@ class Product extends BaseAction implements EventSubscriberInterface
->setDescription($event->getDescription())
->setChapo($event->getChapo())
->setPostscriptum($event->getPostscriptum())
- ->setVisible($event->getVisible())
+ ->setVisible($event->getVisible() ? 1 : 0)
->save()
;
diff --git a/core/lib/Thelia/Action/ProductSaleElement.php b/core/lib/Thelia/Action/ProductSaleElement.php
index 56d033419..acecaad15 100644
--- a/core/lib/Thelia/Action/ProductSaleElement.php
+++ b/core/lib/Thelia/Action/ProductSaleElement.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Profile.php b/core/lib/Thelia/Action/Profile.php
index c264b1439..a309052af 100644
--- a/core/lib/Thelia/Action/Profile.php
+++ b/core/lib/Thelia/Action/Profile.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/ShippingZone.php b/core/lib/Thelia/Action/ShippingZone.php
index 0a58537da..3d654688b 100644
--- a/core/lib/Thelia/Action/ShippingZone.php
+++ b/core/lib/Thelia/Action/ShippingZone.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Tax.php b/core/lib/Thelia/Action/Tax.php
index 87c78fe6e..111a02ae7 100644
--- a/core/lib/Thelia/Action/Tax.php
+++ b/core/lib/Thelia/Action/Tax.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/TaxRule.php b/core/lib/Thelia/Action/TaxRule.php
index 992a8d1a1..af96dd706 100644
--- a/core/lib/Thelia/Action/TaxRule.php
+++ b/core/lib/Thelia/Action/TaxRule.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Action/Template.php b/core/lib/Thelia/Action/Template.php
index 16493e94c..671b9d681 100644
--- a/core/lib/Thelia/Action/Template.php
+++ b/core/lib/Thelia/Action/Template.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Action;
diff --git a/core/lib/Thelia/Cart/CartTrait.php b/core/lib/Thelia/Cart/CartTrait.php
index dce726552..c3cb403c8 100644
--- a/core/lib/Thelia/Cart/CartTrait.php
+++ b/core/lib/Thelia/Cart/CartTrait.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Cart;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -86,6 +76,7 @@ trait CartTrait
//le cookie de panier n'existe pas, il va falloir le créer et faire un enregistrement en base.
$cart = $this->createCart($session);
}
+ $session->setCart($cart->getId());
return $cart;
}
@@ -97,7 +88,8 @@ trait CartTrait
protected function createCart(Session $session)
{
$cart = new CartModel();
- $cart->setToken($this->generateCookie());
+ $cart->setToken($this->generateCookie($session));
+ $cart->setCurrency($session->getCurrency(true));
if (null !== $customer = $session->getCustomerUser()) {
$cart->setCustomer($customer);
@@ -120,7 +112,8 @@ trait CartTrait
*/
protected function duplicateCart(EventDispatcherInterface $dispatcher, CartModel $cart, Session $session, Customer $customer = null)
{
- $newCart = $cart->duplicate($this->generateCookie(), $customer);
+ $currency = $session->getCurrency();
+ $newCart = $cart->duplicate($this->generateCookie($session), $customer, $currency, $dispatcher);
$session->setCart($newCart->getId());
$cartEvent = new CartEvent($newCart);
@@ -130,18 +123,12 @@ trait CartTrait
return $cartEvent->getCart();
}
- protected function generateCookie()
+ protected function generateCookie(Session $session)
{
$id = null;
if (ConfigQuery::read("cart.session_only", 0) == 0) {
$id = uniqid('', true);
- setcookie(
- "thelia_cart",
- $id,
- time()+ConfigQuery::read("cart.cookie_lifetime", 60*60*24*365),
- '/'
- );
-
+ $session->set('cart_use_cookie', $id);
}
return $id;
diff --git a/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php b/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php
index 690f4362b..b64c290f9 100644
--- a/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php
+++ b/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/BaseModuleGenerate.php b/core/lib/Thelia/Command/BaseModuleGenerate.php
index b3286c874..06e25a077 100644
--- a/core/lib/Thelia/Command/BaseModuleGenerate.php
+++ b/core/lib/Thelia/Command/BaseModuleGenerate.php
@@ -1,27 +1,19 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Command;
+use Thelia\Model\Module;
+
/**
* base class for module commands
*
@@ -42,7 +34,11 @@ abstract class BaseModuleGenerate extends ContainerAwareCommand
'Config',
'Model',
'Loop',
- 'AdminIncludes',
+ 'Command',
+ 'Controller',
+ 'EventListeners',
+ 'I18n',
+ Module::ADMIN_INCLUDES_DIRECTORY_NAME,
'templates',
);
diff --git a/core/lib/Thelia/Command/CacheClear.php b/core/lib/Thelia/Command/CacheClear.php
index f8a6063c8..8351d0573 100644
--- a/core/lib/Thelia/Command/CacheClear.php
+++ b/core/lib/Thelia/Command/CacheClear.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
@@ -53,6 +42,12 @@ class CacheClear extends ContainerAwareCommand
InputOption::VALUE_NONE,
"do not clear the assets cache in the web space"
)
+ ->addOption(
+ 'with-images',
+ null,
+ InputOption::VALUE_NONE,
+ 'clear images generated in web/cache directory'
+ )
;
}
@@ -62,10 +57,15 @@ class CacheClear extends ContainerAwareCommand
$cacheDir = $this->getContainer()->getParameter("kernel.cache_dir");
$this->clearCache($cacheDir, $output);
+
if (!$input->getOption("without-assets")) {
$this->clearCache(THELIA_WEB_DIR . "assets", $output);
}
+ if ($input->getOption('with-images')) {
+ $this->clearCache(THELIA_CACHE_DIR, $output);
+ }
+
}
protected function clearCache($dir, OutputInterface $output)
diff --git a/core/lib/Thelia/Command/ClearImageCache.php b/core/lib/Thelia/Command/ClearImageCache.php
index acd2cb02e..22330473c 100644
--- a/core/lib/Thelia/Command/ClearImageCache.php
+++ b/core/lib/Thelia/Command/ClearImageCache.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/ContainerAwareCommand.php b/core/lib/Thelia/Command/ContainerAwareCommand.php
index da903f509..8d307ee51 100644
--- a/core/lib/Thelia/Command/ContainerAwareCommand.php
+++ b/core/lib/Thelia/Command/ContainerAwareCommand.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/CreateAdminUser.php b/core/lib/Thelia/Command/CreateAdminUser.php
index a9b622419..02d814b60 100644
--- a/core/lib/Thelia/Command/CreateAdminUser.php
+++ b/core/lib/Thelia/Command/CreateAdminUser.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/GenerateResources.php b/core/lib/Thelia/Command/GenerateResources.php
index 29a8b4acd..465b5e910 100644
--- a/core/lib/Thelia/Command/GenerateResources.php
+++ b/core/lib/Thelia/Command/GenerateResources.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php
index d1a83c215..c127206bb 100644
--- a/core/lib/Thelia/Command/Install.php
+++ b/core/lib/Thelia/Command/Install.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/ModuleActivateCommand.php b/core/lib/Thelia/Command/ModuleActivateCommand.php
index 139f21e9e..e05426d23 100644
--- a/core/lib/Thelia/Command/ModuleActivateCommand.php
+++ b/core/lib/Thelia/Command/ModuleActivateCommand.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
@@ -63,9 +52,7 @@ class ModuleActivateCommand extends BaseModuleGenerate
}
try {
- $moduleReflection = new \ReflectionClass($module->getFullNamespace());
-
- $moduleInstance = $moduleReflection->newInstance();
+ $moduleInstance = $module->createInstance();
$moduleInstance->activate();
} catch (\Exception $e) {
diff --git a/core/lib/Thelia/Command/ModuleDeactivateCommand.php b/core/lib/Thelia/Command/ModuleDeactivateCommand.php
new file mode 100755
index 000000000..e62572486
--- /dev/null
+++ b/core/lib/Thelia/Command/ModuleDeactivateCommand.php
@@ -0,0 +1,71 @@
+
+ *
+ */
+class ModuleDeactivateCommand extends BaseModuleGenerate
+{
+ protected function configure()
+ {
+ $this
+ ->setName("module:deactivate")
+ ->setDescription("Deactivate a module")
+ ->addArgument(
+ "module" ,
+ InputArgument::REQUIRED,
+ "module to deactivate"
+ )
+ ;
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $moduleCode = $this->formatModuleName($input->getArgument("module"));
+
+ $module = ModuleQuery::create()->findOneByCode($moduleCode);
+
+ if (null === $module) {
+ throw new \RuntimeException(sprintf("module %s not found", $moduleCode));
+ }
+
+ try {
+ $moduleInstance = $module->createInstance();
+
+ $moduleInstance->deActivate();
+ } catch (\Exception $e) {
+ throw new \RuntimeException(sprintf("Deactivation fail with Exception : [%d] %s", $e->getCode(), $e->getMessage()));
+ }
+
+ //impossible to change output class in CommandTester...
+ if (method_exists($output, "renderBlock")) {
+ $output->renderBlock(array(
+ '',
+ sprintf("Deactivation succeed for module %s", $moduleCode),
+ ''
+ ), "bg=green;fg=black");
+ }
+ }
+}
diff --git a/core/lib/Thelia/Command/ModuleGenerateCommand.php b/core/lib/Thelia/Command/ModuleGenerateCommand.php
index 8a610b991..f5cae9487 100644
--- a/core/lib/Thelia/Command/ModuleGenerateCommand.php
+++ b/core/lib/Thelia/Command/ModuleGenerateCommand.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Command;
use Symfony\Component\Console\Input\InputArgument;
@@ -88,6 +78,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate
try {
$skeletonDir = str_replace("/", DIRECTORY_SEPARATOR, THELIA_ROOT . "/core/lib/Thelia/Command/Skeleton/Module/");
+ // config.xml file
$fs->copy($skeletonDir . "config.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.xml");
$moduleContent = file_get_contents($skeletonDir . "module.xml");
@@ -97,6 +88,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "module.xml", $moduleContent);
+ // PHP Class template
$classContent = file_get_contents($skeletonDir . "Class.php.template");
$classContent = str_replace("%%CLASSNAME%%", $this->module, $classContent);
@@ -104,11 +96,31 @@ class ModuleGenerateCommand extends BaseModuleGenerate
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . $this->module.".php", $classContent);
+ // schema.xml file
$schemaContent = file_get_contents($skeletonDir . "schema.xml");
$schemaContent = str_replace("%%NAMESPACE%%", $this->module, $schemaContent);
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
+
+ // routing.xml file
+ $routingContent = file_get_contents($skeletonDir . "routing.xml");
+
+ $routingContent = str_replace("%%NAMESPACE%%", $this->module, $routingContent);
+ $routingContent = str_replace("%%CLASSNAME_LOWER%%", strtolower($this->module), $routingContent);
+
+ file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "routing.xml", $routingContent);
+
+ // I18n sample files
+ $fs->copy(
+ $skeletonDir . DIRECTORY_SEPARATOR . "I18n" . DIRECTORY_SEPARATOR . "fr_FR.php",
+ $this->moduleDirectory . DIRECTORY_SEPARATOR . "I18n" . DIRECTORY_SEPARATOR . "fr_FR.php"
+ );
+
+ $fs->copy(
+ $skeletonDir . DIRECTORY_SEPARATOR . "I18n" . DIRECTORY_SEPARATOR . "en_US.php",
+ $this->moduleDirectory . DIRECTORY_SEPARATOR . "I18n" . DIRECTORY_SEPARATOR . "en_US.php"
+ );
} catch (\Exception $ex) {
$fs->remove($this->moduleDirectory);
diff --git a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php
index fbbe9be6c..66e3eeb9c 100644
--- a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php
+++ b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php
index 2c6b310a5..c8cbd1165 100644
--- a/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php
+++ b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php b/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php
index f13ef4d9b..4440b69e6 100644
--- a/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php
+++ b/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command\Output;
diff --git a/core/lib/Thelia/Command/ReloadDatabaseCommand.php b/core/lib/Thelia/Command/ReloadDatabaseCommand.php
index 0bd76c9e5..57870c634 100644
--- a/core/lib/Thelia/Command/ReloadDatabaseCommand.php
+++ b/core/lib/Thelia/Command/ReloadDatabaseCommand.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Command/Skeleton/Module/Class.php.template b/core/lib/Thelia/Command/Skeleton/Module/Class.php.template
index 41fcfadbb..a11e247e7 100644
--- a/core/lib/Thelia/Command/Skeleton/Module/Class.php.template
+++ b/core/lib/Thelia/Command/Skeleton/Module/Class.php.template
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace %%NAMESPACE%%;
diff --git a/core/lib/Thelia/Command/Skeleton/Module/I18n/en_US.php b/core/lib/Thelia/Command/Skeleton/Module/I18n/en_US.php
new file mode 100644
index 000000000..0b4fa142b
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/I18n/en_US.php
@@ -0,0 +1,4 @@
+ 'The displayed english string',
+);
diff --git a/core/lib/Thelia/Command/Skeleton/Module/I18n/fr_FR.php b/core/lib/Thelia/Command/Skeleton/Module/I18n/fr_FR.php
new file mode 100644
index 000000000..370862450
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/I18n/fr_FR.php
@@ -0,0 +1,4 @@
+ 'La traduction française de la chaine',
+);
diff --git a/core/lib/Thelia/Command/Skeleton/Module/routing.xml b/core/lib/Thelia/Command/Skeleton/Module/routing.xml
new file mode 100644
index 000000000..12c942d0b
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/routing.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
diff --git a/core/lib/Thelia/Command/UpdateCommand.php b/core/lib/Thelia/Command/UpdateCommand.php
index ecfc8277b..1ccb62b1c 100644
--- a/core/lib/Thelia/Command/UpdateCommand.php
+++ b/core/lib/Thelia/Command/UpdateCommand.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Command;
diff --git a/core/lib/Thelia/Condition/ConditionCollection.php b/core/lib/Thelia/Condition/ConditionCollection.php
index 0298e510d..d820edfe1 100644
--- a/core/lib/Thelia/Condition/ConditionCollection.php
+++ b/core/lib/Thelia/Condition/ConditionCollection.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
@@ -38,7 +27,7 @@ use Thelia\Condition\Implementation\ConditionInterface;
class ConditionCollection implements Iterator, Countable, ArrayAccess
{
/** @var array Array of ConditionInterface */
- protected $conditions = array();
+ protected $conditions = [];
/**
* (PHP 5 >= 5.0.0)
@@ -191,7 +180,7 @@ class ConditionCollection implements Iterator, Countable, ArrayAccess
*/
public function __toString()
{
- $arrayToSerialize = array();
+ $arrayToSerialize = [];
/** @var ConditionInterface $condition */
foreach ($this as $condition) {
$arrayToSerialize[] = $condition->getSerializableCondition();
diff --git a/core/lib/Thelia/Condition/ConditionEvaluator.php b/core/lib/Thelia/Condition/ConditionEvaluator.php
index 8e00cfcdb..455537ee8 100644
--- a/core/lib/Thelia/Condition/ConditionEvaluator.php
+++ b/core/lib/Thelia/Condition/ConditionEvaluator.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
diff --git a/core/lib/Thelia/Condition/ConditionFactory.php b/core/lib/Thelia/Condition/ConditionFactory.php
index 932815110..8fd9647b6 100644
--- a/core/lib/Thelia/Condition/ConditionFactory.php
+++ b/core/lib/Thelia/Condition/ConditionFactory.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
@@ -72,7 +61,7 @@ class ConditionFactory
);
$collection[] = $conditionNone;
}
- $serializableConditions = array();
+ $serializableConditions = [];
/** @var $condition ConditionInterface */
foreach ($collection as $condition) {
$serializableConditions[] = $condition->getSerializableCondition();
diff --git a/core/lib/Thelia/Condition/ConditionOrganizer.php b/core/lib/Thelia/Condition/ConditionOrganizer.php
index 6dab6e92c..15cfa7b19 100644
--- a/core/lib/Thelia/Condition/ConditionOrganizer.php
+++ b/core/lib/Thelia/Condition/ConditionOrganizer.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
diff --git a/core/lib/Thelia/Condition/ConditionOrganizerInterface.php b/core/lib/Thelia/Condition/ConditionOrganizerInterface.php
index ab5a9dff7..8d056d5e0 100644
--- a/core/lib/Thelia/Condition/ConditionOrganizerInterface.php
+++ b/core/lib/Thelia/Condition/ConditionOrganizerInterface.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
diff --git a/core/lib/Thelia/Condition/Implementation/ConditionAbstract.php b/core/lib/Thelia/Condition/Implementation/ConditionAbstract.php
index c5f7ebb91..bae7fcf31 100644
--- a/core/lib/Thelia/Condition/Implementation/ConditionAbstract.php
+++ b/core/lib/Thelia/Condition/Implementation/ConditionAbstract.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
@@ -29,6 +18,7 @@ use Thelia\Condition\SerializableCondition;
use Thelia\Core\Translation\Translator;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionValueException;
+use Thelia\Model\Base\CurrencyQuery;
use Thelia\Model\Currency;
use Thelia\Type\FloatType;
@@ -46,10 +36,10 @@ abstract class ConditionAbstract implements ConditionInterface
protected $serviceId = null;
/** @var array Available Operators (Operators::CONST) */
- protected $availableOperators = array();
+ protected $availableOperators = [];
/** @var array Parameters validating parameters against */
- protected $validators = array();
+ protected $validators = [];
/** @var FacadeInterface Provide necessary value from Thelia */
protected $facade = null;
@@ -58,10 +48,10 @@ abstract class ConditionAbstract implements ConditionInterface
protected $translator = null;
/** @var array Operators set by Admin in BackOffice */
- protected $operators = array();
+ protected $operators = [];
/** @var array Values set by Admin in BackOffice */
- protected $values = array();
+ protected $values = [];
/** @var ConditionEvaluator Conditions validator */
protected $conditionValidator = null;
@@ -97,9 +87,9 @@ abstract class ConditionAbstract implements ConditionInterface
{
$this->validators = $this->generateInputs();
- $translatedInputs = array();
+ $translatedInputs = [];
foreach ($this->validators as $key => $validator) {
- $translatedOperators = array();
+ $translatedOperators = [];
foreach ($validator['availableOperators'] as $availableOperators) {
$translatedOperators[$availableOperators] = Operators::getI18n(
$this->translator,
@@ -110,7 +100,7 @@ abstract class ConditionAbstract implements ConditionInterface
$validator['availableOperators'] = $translatedOperators;
$translatedInputs[$key] = $validator;
}
- $validators = array();
+ $validators = [];
$validators['inputs'] = $translatedInputs;
$validators['setOperators'] = $this->operators;
$validators['setValues'] = $this->values;
@@ -227,27 +217,21 @@ abstract class ConditionAbstract implements ConditionInterface
*/
protected function drawBackOfficeInputOperators($inputKey)
{
- $selectHtml = '';
- $optionHtml = '';
- $inputs = $this->getValidators();
- if (isset($inputs['inputs'][$inputKey])) {
- $operators = $inputs['inputs'][$inputKey]['availableOperators'];
- foreach ($operators as $key => $operator) {
- $selected = '';
- if (isset($this->operators) && isset($this->operators[$inputKey]) && $this->operators[$inputKey] == $key) {
- $selected = ' selected="selected"';
- }
- $optionHtml .= '';
- }
+ $html = '';
- $selectHtml .= '
-
- ';
+ $inputs = $this->getValidators();
+
+ if (isset($inputs['inputs'][$inputKey])) {
+
+ $html = $this->facade->getParser()->render('coupon/condition-fragments/condition-selector.html', [
+ 'operators' => $inputs['inputs'][$inputKey]['availableOperators'],
+ 'value' => isset($this->operators[$inputKey]) ? $this->operators[$inputKey] : '',
+ 'inputKey' => $inputKey
+ ]
+ );
}
- return $selectHtml;
+ return $html;
}
/**
@@ -262,26 +246,19 @@ abstract class ConditionAbstract implements ConditionInterface
protected function drawBackOfficeBaseInputsText($label, $inputKey)
{
$operatorSelectHtml = $this->drawBackOfficeInputOperators($inputKey);
+
$currentValue = '';
if (isset($this->values) && isset($this->values[$inputKey])) {
$currentValue = $this->values[$inputKey];
}
- $html = '
-
-
-
-
- ' . $operatorSelectHtml . '
-
-
-
-
-
-
- ';
-
- return $html;
+ return $this->facade->getParser()->render('coupon/conditions-fragments/base-input-text.html', [
+ 'label' => $label,
+ 'inputKey' => $inputKey,
+ 'currentValue' => $currentValue,
+ 'operatorSelectHtml' => $operatorSelectHtml
+ ]
+ );
}
/**
@@ -296,23 +273,39 @@ abstract class ConditionAbstract implements ConditionInterface
*/
protected function drawBackOfficeInputQuantityValues($inputKey, $max = 10, $min = 0)
{
- $selectHtml = '';
- $optionHtml = '';
- for ($i = $min; $i <= $max; $i++) {
- $selected = '';
- if (isset($this->values) && isset($this->values[$inputKey]) && $this->values[$inputKey] == $i) {
- $selected = ' selected="selected"';
- }
- $optionHtml .= '';
- }
-
- $selectHtml .= '
-
- ';
-
- return $selectHtml;
+ return $this->facade->getParser()->render('coupon/condition-fragments/quantity-selector.html', [
+ 'min' => $min,
+ 'max' => $max,
+ 'value' => isset($this->values[$inputKey]) ? $this->values[$inputKey] : '',
+ 'inputKey' => $inputKey
+ ]
+ );
}
-}
+ /**
+ * Draw the currency input displayed in the BackOffice
+ * allowing Admin to set its Coupon Conditions
+ *
+ * @param string $inputKey Input key (ex: self::INPUT1)
+ *
+ * @return string HTML string
+ */
+ protected function drawBackOfficeCurrencyInput($inputKey)
+ {
+ $currencies = CurrencyQuery::create()->find();
+
+ $cleanedCurrencies = [];
+
+ /** @var Currency $currency */
+ foreach ($currencies as $currency) {
+ $cleanedCurrencies[$currency->getCode()] = $currency->getSymbol();
+ }
+
+ return $this->facade->getParser()->render('coupon/condition-fragments/currency-selector.html', [
+ 'currencies' => $cleanedCurrencies,
+ 'value' => isset($this->values[$inputKey]) ? $this->values[$inputKey] : '',
+ 'inputKey' => $inputKey
+ ]
+ );
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Condition/Implementation/ConditionInterface.php b/core/lib/Thelia/Condition/Implementation/ConditionInterface.php
index 0b4f3efe0..209a403f9 100644
--- a/core/lib/Thelia/Condition/Implementation/ConditionInterface.php
+++ b/core/lib/Thelia/Condition/Implementation/ConditionInterface.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
diff --git a/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php b/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php
index 92edec3ba..5049470a2 100644
--- a/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php
+++ b/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
@@ -36,7 +25,7 @@ class MatchForEveryone extends ConditionAbstract
protected $serviceId = 'thelia.condition.match_for_everyone';
/** @var array Available Operators (Operators::CONST) */
- protected $availableOperators = array();
+ protected $availableOperators = [];
/**
* Check validators relevancy and store them
@@ -62,8 +51,8 @@ class MatchForEveryone extends ConditionAbstract
*/
protected function setValidators()
{
- $this->operators = array();
- $this->values = array();
+ $this->operators = [];
+ $this->values = [];
return $this;
}
@@ -86,8 +75,8 @@ class MatchForEveryone extends ConditionAbstract
public function getName()
{
return $this->translator->trans(
- 'Everybody can use it (no condition)',
- array(),
+ 'Unconditional usage',
+ [],
'condition'
);
}
@@ -101,8 +90,8 @@ class MatchForEveryone extends ConditionAbstract
public function getToolTip()
{
$toolTip = $this->translator->trans(
- 'Will return always true',
- array(),
+ 'This condition is always true',
+ [],
'condition'
);
@@ -118,8 +107,8 @@ class MatchForEveryone extends ConditionAbstract
public function getSummary()
{
$toolTip = $this->translator->trans(
- 'Will return always true',
- array(),
+ 'Unconditionnal usage',
+ [],
'condition'
);
@@ -133,7 +122,7 @@ class MatchForEveryone extends ConditionAbstract
*/
protected function generateInputs()
{
- return array();
+ return [];
}
/**
diff --git a/core/lib/Thelia/Condition/Implementation/MatchForTotalAmount.php b/core/lib/Thelia/Condition/Implementation/MatchForTotalAmount.php
index 272ec0a84..6b4b48f15 100644
--- a/core/lib/Thelia/Condition/Implementation/MatchForTotalAmount.php
+++ b/core/lib/Thelia/Condition/Implementation/MatchForTotalAmount.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
@@ -164,7 +153,7 @@ class MatchForTotalAmount extends ConditionAbstract
{
return $this->translator->trans(
'By cart total amount',
- array(),
+ [],
'condition'
);
}
@@ -179,7 +168,7 @@ class MatchForTotalAmount extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'Check the total Cart amount in the given currency',
- array(),
+ [],
'condition'
);
@@ -219,7 +208,7 @@ class MatchForTotalAmount extends ConditionAbstract
protected function generateInputs()
{
$currencies = CurrencyQuery::create()->find();
- $cleanedCurrencies = array();
+ $cleanedCurrencies = [];
/** @var Currency $currency */
foreach ($currencies as $currency) {
$cleanedCurrencies[$currency->getCode()] = $currency->getSymbol();
@@ -251,7 +240,7 @@ class MatchForTotalAmount extends ConditionAbstract
{
$labelPrice = $this->facade
->getTranslator()
- ->trans('Price', array(), 'condition');
+ ->trans('Cart total amount is', [], 'condition');
$html = $this->drawBackOfficeBaseInputsText($labelPrice, self::INPUT1);
@@ -269,66 +258,17 @@ class MatchForTotalAmount extends ConditionAbstract
*/
protected function drawBackOfficeBaseInputsText($label, $inputKey)
{
- $operatorSelectHtml = $this->drawBackOfficeInputOperators(self::INPUT1);
- $currencySelectHtml = $this->drawBackOfficeCurrencyInput(self::INPUT2);
- $selectedAmount = '';
- if (isset($this->values) && isset($this->values[$inputKey])) {
- $selectedAmount = $this->values[$inputKey];
- }
+ return $this->facade->getParser()->render('coupon/condition-fragments/cart-total-amount-condition.html', [
+ 'label' => $label,
+ 'inputKey' => $inputKey,
+ 'value' => isset($this->values[$inputKey]) ? $this->values[$inputKey] : '',
- $html = '
-
-
-
- ' . $operatorSelectHtml . '
-
-
-
-
-
-
- ' . $currencySelectHtml . '
-
-
- ';
+ 'field_1_name' => self::INPUT1,
+ 'field_2_name' => self::INPUT2,
- return $html;
+ 'operatorSelectHtml' => $this->drawBackOfficeInputOperators(self::INPUT1),
+ 'currencySelectHtml' => $this->drawBackOfficeCurrencyInput(self::INPUT2),
+ ]
+ );
}
-
- /**
- * Draw the currency input displayed in the BackOffice
- * allowing Admin to set its Coupon Conditions
- *
- * @param string $inputKey Input key (ex: self::INPUT1)
- *
- * @return string HTML string
- */
- protected function drawBackOfficeCurrencyInput($inputKey)
- {
- $optionHtml = '';
-
- $currencies = CurrencyQuery::create()->find();
- $cleanedCurrencies = array();
- /** @var Currency $currency */
- foreach ($currencies as $currency) {
- $cleanedCurrencies[$currency->getCode()] = $currency->getSymbol();
- }
-
- foreach ($cleanedCurrencies as $key => $cleanedCurrency) {
- $selected = '';
- if (isset($this->values) && isset($this->values[$inputKey]) && $this->values[$inputKey] == $key) {
- $selected = ' selected="selected"';
- }
- $optionHtml .= '';
- }
-
- $selectHtml = '
-
- ';
-
- return $selectHtml;
- }
-
-}
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php b/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php
index 8eeeec1c2..0e7c9d832 100644
--- a/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php
+++ b/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
@@ -138,8 +127,8 @@ class MatchForXArticles extends ConditionAbstract
public function getName()
{
return $this->translator->trans(
- 'By number of articles in cart',
- array(),
+ 'Cart item count condition',
+ [],
'condition'
);
}
@@ -153,8 +142,8 @@ class MatchForXArticles extends ConditionAbstract
public function getToolTip()
{
$toolTip = $this->translator->trans(
- 'Check the amount of product in the Cart',
- array(),
+ 'The cart item count should match the condition',
+ [],
'condition'
);
@@ -174,7 +163,7 @@ class MatchForXArticles extends ConditionAbstract
);
$toolTip = $this->translator->trans(
- 'If cart products quantity is %operator% %quantity%',
+ 'If cart item count is %operator% %quantity%',
array(
'%operator%' => $i18nOperator,
'%quantity%' => $this->values[self::INPUT1]
@@ -211,7 +200,7 @@ class MatchForXArticles extends ConditionAbstract
{
$labelQuantity = $this->facade
->getTranslator()
- ->trans('Quantity', array(), 'condition');
+ ->trans('Cart item count is', [], 'condition');
$html = $this->drawBackOfficeBaseInputsText($labelQuantity, self::INPUT1);
@@ -229,24 +218,11 @@ class MatchForXArticles extends ConditionAbstract
*/
protected function drawBackOfficeBaseInputsText($label, $inputKey)
{
- $operatorSelectHtml = $this->drawBackOfficeInputOperators($inputKey);
- $quantitySelectHtml = $this->drawBackOfficeInputQuantityValues($inputKey, 20, 1);
-
- $html = '
-
-
-
-
- ' . $operatorSelectHtml . '
-
-
- ' . $quantitySelectHtml . '
-
-
-
- ';
-
- return $html;
+ return $this->facade->getParser()->render('coupon/condition-fragments/cart-item-count-condition.html', [
+ 'label' => $label,
+ 'operatorSelectHtml' => $this->drawBackOfficeInputOperators($inputKey),
+ 'quantitySelectHtml' => $this->drawBackOfficeInputQuantityValues($inputKey, 20, 1)
+ ]
+ );
}
-
-}
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Condition/Operators.php b/core/lib/Thelia/Condition/Operators.php
index b6a8816ba..0d0600967 100644
--- a/core/lib/Thelia/Condition/Operators.php
+++ b/core/lib/Thelia/Condition/Operators.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
@@ -65,57 +54,57 @@ abstract class Operators
switch ($operator) {
case self::INFERIOR:
$ret = $translator->trans(
- 'inferior to',
- array(),
+ 'Less than',
+ [],
'condition'
);
break;
case self::INFERIOR_OR_EQUAL:
$ret = $translator->trans(
- 'inferior or equal to',
- array(),
+ 'Less than or equals',
+ [],
'condition'
);
break;
case self::EQUAL:
$ret = $translator->trans(
- 'equal to',
- array(),
+ 'Equals',
+ [],
'condition'
);
break;
case self::SUPERIOR_OR_EQUAL:
$ret = $translator->trans(
- 'superior or equal to',
- array(),
+ 'Greater than or equals',
+ [],
'condition'
);
break;
case self::SUPERIOR:
$ret = $translator->trans(
- 'superior to',
- array(),
+ 'Greater than',
+ [],
'condition'
);
break;
case self::DIFFERENT:
$ret = $translator->trans(
- 'different from',
- array(),
+ 'Not equals',
+ [],
'condition'
);
break;
case self::IN:
$ret = $translator->trans(
- 'in',
- array(),
+ 'In',
+ [],
'condition'
);
break;
case self::OUT:
$ret = $translator->trans(
- 'not in',
- array(),
+ 'Not in',
+ [],
'condition'
);
break;
@@ -124,4 +113,4 @@ abstract class Operators
return $ret;
}
-}
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Condition/SerializableCondition.php b/core/lib/Thelia/Condition/SerializableCondition.php
index d147adbd2..8d8cf4a7d 100644
--- a/core/lib/Thelia/Condition/SerializableCondition.php
+++ b/core/lib/Thelia/Condition/SerializableCondition.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
@@ -36,9 +25,9 @@ class SerializableCondition
public $conditionServiceId = null;
/** @var array Operators set by Admin for this Condition */
- public $operators = array();
+ public $operators = [];
/** @var array Values set by Admin for this Condition */
- public $values = array();
+ public $values = [];
}
diff --git a/core/lib/Thelia/Config/DatabaseConfiguration.php b/core/lib/Thelia/Config/DatabaseConfiguration.php
index 6d74a03fb..9e5f50aa7 100644
--- a/core/lib/Thelia/Config/DatabaseConfiguration.php
+++ b/core/lib/Thelia/Config/DatabaseConfiguration.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Config;
diff --git a/core/lib/Thelia/Config/DefinePropel.php b/core/lib/Thelia/Config/DefinePropel.php
index cd057ea20..063b490d8 100644
--- a/core/lib/Thelia/Config/DefinePropel.php
+++ b/core/lib/Thelia/Config/DefinePropel.php
@@ -1,26 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
-
namespace Thelia\Config;
use Symfony\Component\Config\Definition\Processor;
diff --git a/core/lib/Thelia/Config/I18n/cs_CZ.php b/core/lib/Thelia/Config/I18n/cs_CZ.php
new file mode 100644
index 000000000..634c0e768
--- /dev/null
+++ b/core/lib/Thelia/Config/I18n/cs_CZ.php
@@ -0,0 +1,4 @@
+ '"%param" parameter cannot be empty in loop type: %type, name: %name',
+ '"%param" parameter is missing in loop type: %type, name: %name' => '"%param" parameter is missing in loop type: %type, name: %name',
'%obj SEO modification' => '%obj SEO modification',
'%obj creation' => '%obj creation',
'%obj modification' => '%obj modification',
+ '\'%type\' loop class should extends Thelia\Core\Template\Element\BaseLoop' => '\'%type\' loop class should extends Thelia\Core\Template\Element\BaseLoop',
'A currency with code "%name" already exists.' => 'A currency with code "%name" already exists.',
+ 'A loop named \'%name\' already exists in the current scope.' => 'A loop named \'%name\' already exists in the current scope.',
'A message with name "%name" already exists.' => 'A message with name "%name" already exists.',
+ 'A product with reference %ref already exists. Please choose another reference.' => 'A product with reference %ref already exists. Please choose another reference.',
+ 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.' => 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.',
+ 'A value for attribute "%name" is already present in the combination' => 'A value for attribute "%name" is already present in the combination',
'A variable with name "%name" already exists.' => 'A variable with name "%name" already exists.',
'Activate logs only for these IP Addresses' => 'Activate logs only for these IP Addresses',
'Activate logs only for these files' => 'Activate logs only for these files',
'Add to all product templates' => 'Add to all product templates',
'Additional address' => 'Additional address',
+ 'Address ID not found' => 'Address ID not found',
'Address Line 2' => 'Address Line 2',
'Address Line 3' => 'Address Line 3',
'Address label' => 'Address label',
+ 'Administrator ID not found' => 'Administrator ID not found',
'Advertise this product as new' => 'Advertise this product as new',
'Alerts' => 'Alerts',
'Alpha code 2 *' => 'Alpha code 2 *',
'Alpha code 3 *' => 'Alpha code 3 *',
- 'Amount removed from the cart' => 'Amount removed from the cart',
'Apply exchange rates on price in %sym' => 'Apply exchange rates on price in %sym',
- 'Area' => 'Area',
'Attribute ID:Attribute AV ID' => 'Attribute ID:Attribute AV ID',
'Auth mode' => 'Auth mode',
'Available quantity' => 'Available quantity',
'Available quantity *' => 'Available quantity *',
+ 'Available shipping zones' => 'Available shipping zones',
+ 'Bad tax list JSON' => 'Bad tax list JSON',
'Business ID' => 'Business ID',
+ 'By cart total amount' => 'By cart total amount',
'Cannot find a default country. Please define one.' => 'Cannot find a default country. Please define one.',
'Cannot find the shop country. Please select a shop country.' => 'Cannot find the shop country. Please select a shop country.',
+ 'Cannot instanciante module "%name%": the namespace is null. Maybe the model is not loaded ?' => 'Cannot instanciante module "%name%": the namespace is null. Maybe the model is not loaded ?',
+ 'Cart item count condition' => 'Cart item count condition',
+ 'Cart item count is' => 'Cart item count is',
+ 'Cart total amount is' => 'Cart total amount is',
'Category title *' => 'Category title *',
'Cellphone' => 'Cellphone',
'Chapo' => 'Chapo',
+ 'Check the total Cart amount in the given currency' => 'Check the total Cart amount in the given currency',
'City' => 'City',
'Combination builder' => 'Combination builder',
'Compagny' => 'Compagny',
@@ -41,31 +56,53 @@ return array(
'Constant amount found in one of the product\'s feature' => 'Constant amount found in one of the product\'s feature',
'Content title *' => 'Content title *',
'Country' => 'Country',
+ 'Country ID not found' => 'Country ID not found',
'Country area' => 'Country area',
'Country title *' => 'Country title *',
'Critical' => 'Critical',
'Current Password' => 'Current Password',
+ 'Date \'%date\' is invalid, please enter a valid date using %fmt format' => 'Date \'%date\' is invalid, please enter a valid date using %fmt format',
'Debug' => 'Debug',
'Default folder *' => 'Default folder *',
'Default product category *' => 'Default product category *',
'Default product sale element' => 'Default product sale element',
+ 'Deleting document for %id% with parent id %parentId%' => 'Deleting document for %id% with parent id %parentId%',
+ 'Deleting image for %id% with parent id %parentId%' => 'Deleting image for %id% with parent id %parentId%',
+ 'Delivery module ID not found' => 'Delivery module ID not found',
'Description' => 'Description',
'Detailed description' => 'Detailed description',
'Disabled' => 'Disabled',
+ 'Discount amount' => 'Discount amount',
+ 'Document deleted successfully' => 'Document deleted successfully',
+ 'Document position updated' => 'Document position updated',
'EAN Code' => 'EAN Code',
'Email Address' => 'Email Address',
'Email address' => 'Email address',
'Emergency' => 'Emergency',
'Enable remote SMTP use' => 'Enable remote SMTP use',
'Encryption' => 'Encryption',
+ 'Equals' => 'Equals',
+ 'Error during %action process : %error. Exception was %exc' => 'Error during %action process : %error. Exception was %exc',
+ 'Error occured while processing order ref. %ref, ID %id: %err' => 'Error occured while processing order ref. %ref, ID %id: %err',
'Errors' => 'Errors',
+ 'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)' => 'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)',
+ 'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)' => 'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)',
+ 'Fail to update document position' => 'Fail to update document position',
+ 'Fail to update image position' => 'Fail to update image position',
+ 'Failed to create instance of module "%name%" when trying to delete module. Module directory has probably been deleted' => 'Failed to create instance of module "%name%" when trying to delete module. Module directory has probably been deleted',
+ 'Failed to find a payment Module with ID=%mid for order ID=%oid' => 'Failed to find a payment Module with ID=%mid for order ID=%oid',
+ 'Failed to open translation file %file. Please be sure that this file is writable by your Web server' => 'Failed to open translation file %file. Please be sure that this file is writable by your Web server',
'Failed to update language definition: %ex' => 'Failed to update language definition: %ex',
'Fax' => 'Fax',
'Feature value does not match FLOAT format' => 'Feature value does not match FLOAT format',
+ 'File is too heavy, please retry with a file having a size less than %size%.' => 'File is too Large, please retry with a file having a size less than %size%.',
'First Name' => 'First Name',
'Firstname' => 'Firstname',
+ 'Fixed Amount Discount' => 'Fixed Amount Discount',
'Folder title *' => 'Folder title *',
'Full Name' => 'Full Name',
+ 'Greater than' => 'Greater than',
+ 'Greater than or equals' => 'Greater than or equals',
'HTML Message' => 'HTML Message',
'Host' => 'Host',
'I would like to receive the newsletter or the latest news.' => 'I would like to receive the newsletter or the latest news.',
@@ -73,21 +110,41 @@ return array(
'ISO 639-1 Code' => 'ISO 639-1 Code',
'ISO Code *' => 'ISO Code *',
'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :',
+ 'If cart item count is %operator% %quantity%' => 'If cart item count is %operator% %quantity%',
+ 'If cart total amount is %operator% %amount% %currency%' => 'If cart total amount is %operator% %amount% %currency%',
+ 'Image position updated' => 'Image position updated',
+ 'Images deleted successfully' => 'Images deleted successfully',
+ 'Impossible to delete a customer who already have orders' => 'Impossible to delete a customer who already have orders',
+ 'In' => 'In',
'Information' => 'Information',
'Invalid product_sale_elements' => 'Invalid product_sale_elements',
+ 'Invalid value "%value" for "%param" parameter in loop type: %type, name: %name' => 'Invalid value "%value" for "%param" parameter in loop type: %type, name: %name',
'Invalid value for walkMode parameter: %value' => 'Invalid value for walkMode parameter: %value',
'Is it the default product sale element ?' => 'Is it the default product sale element ?',
'Language name' => 'Language name',
'Last Name' => 'Last Name',
'Lastname' => 'Lastname',
+ 'Less than' => 'Less than',
+ 'Less than or equals' => 'Less than or equals',
'Log format *' => 'Log format *',
'Log level *' => 'Log level *',
'Login' => 'Login',
'Login failed. Please check your username and password.' => 'Login failed. Please check your username and password.',
+ 'Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`' => 'Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`',
+ 'Loop must implements \'PropelSearchLoopInterface\' to be timestampable' => 'Loop must implements \'PropelSearchLoopInterface\' to be timestampable',
+ 'Loop must implements \'PropelSearchLoopInterface\' to be versionable' => 'Loop must implements \'PropelSearchLoopInterface\' to be versionable',
+ 'Loop must implements one of the following interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`' => 'Loop must implements one of the following interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`',
+ 'Loop type \'%type\' is not defined.' => 'Loop type \'%type\' is not defined.',
'Make this address as my primary address' => 'Make this address as my primary address',
'Message subject' => 'Message subject',
'Meta Description' => 'Meta Description',
'Meta Keywords' => 'Meta Keywords',
+ 'Missing \'name\' parameter in loop arguments' => 'Missing \'name\' parameter in loop arguments',
+ 'Missing \'rel\' parameter in ifloop/elseloop arguments' => 'Missing \'rel\' parameter in ifloop/elseloop arguments',
+ 'Missing \'rel\' parameter in page loop' => 'Missing \'rel\' parameter in page loop',
+ 'Missing \'type\' parameter in loop arguments' => 'Missing \'type\' parameter in loop arguments',
+ 'Missing \'type\' parameter in {count} loop arguments' => 'Missing \'type\' parameter in {count} loop arguments',
+ 'Module ID not found' => 'Module ID not found',
'Name' => 'Name',
'Name *' => 'Name *',
'Name of the HTML layout file' => 'Name of the HTML layout file',
@@ -97,17 +154,27 @@ return array(
'New Password' => 'New Password',
'No %obj was created.' => 'No %obj was created.',
'No %obj was updated.' => 'No %obj was updated.',
+ 'No module found for code \'%item\'' => 'No module found for code \'%item\'',
+ 'No pagination currently defined for loop name \'%name\'' => 'No pagination currently defined for loop name \'%name\'',
'No, I am a new customer.' => 'No, I am a new customer.',
+ 'Not equals' => 'Not equals',
+ 'Not found' => 'Not found',
+ 'Not in' => 'Not in',
'Notices' => 'Notices',
+ 'Order address ID not found' => 'Order address ID not found',
+ 'Order ref. %ref is now unpaid.' => 'Order ref. %ref is now unpaid.',
+ 'Order ref. %ref, ID %id has been successfully paid.' => 'Order ref. %ref, ID %id has been successfully paid.',
'Page Title' => 'Page Title',
'Parent category *' => 'Parent category *',
'Parent folder *' => 'Parent folder *',
'Password' => 'Password',
'Password *' => 'Password *',
'Password confirmation' => 'Password confirmation',
+ 'Percent Discount' => 'Percent Discount',
'Percentage of the product price' => 'Percentage of the product price',
- 'Percentage removed from the cart' => 'Percentage removed from the cart',
'Phone' => 'Phone',
+ 'Please accept the Terms and conditions in order to register.' => 'Please accept the Terms and conditions in order to register.',
+ 'Please check your input: %error' => 'Please check your input: %error',
'Please enter your email address' => 'Please enter your email address',
'Please enter your password' => 'Please enter your password',
'Please specify either \'path\' or \'file\' parameter in {url} function.' => 'Please specify either \'path\' or \'file\' parameter in {url} function.',
@@ -117,12 +184,14 @@ return array(
'Preferred locale' => 'Preferred locale',
'Prevent mailing template modification or deletion, except for super-admin' => 'Prevent mailing template modification or deletion, except for super-admin',
'Prevent variable modification or deletion, except for super-admin' => 'Prevent variable modification or deletion, except for super-admin',
- 'Price' => 'Price',
'Price currency *' => 'Price currency *',
+ 'Processing cancelation of payment for order ref. %ref' => 'Processing cancelation of payment for order ref. %ref',
+ 'Processing confirmation of order ref. %ref, ID %id' => 'Processing confirmation of order ref. %ref, ID %id',
'Prodcut ID *' => 'Prodcut ID *',
'Product ID' => 'Product ID',
'Product ID *' => 'Product ID *',
'Product base price excluding taxes *' => 'Product base price excluding taxes *',
+ 'Product base price with taxes' => 'Product base price with taxes',
'Product price excluding taxes' => 'Product price excluding taxes',
'Product price excluding taxes *' => 'Product price excluding taxes *',
'Product price including taxes' => 'Product price including taxes',
@@ -133,6 +202,8 @@ return array(
'ProductSaleElement modification' => 'ProductSaleElement modification',
'Profile' => 'Profile',
'Profile Code' => 'Profile Code',
+ 'Profile ID not found' => 'Profile ID not found',
+ 'Profile `code` already exists' => 'Profile `code` already exists',
'Purpose *' => 'Purpose *',
'Quantity' => 'Quantity',
'Rate from € *' => 'Rate from € *',
@@ -140,8 +211,8 @@ return array(
'Redirecting to %url' => 'Redirecting to %url',
'Reference' => 'Reference',
'Reference *' => 'Reference *',
+ 'Related loop name \'%name\'\' is not defined.' => 'Related loop name \'%name\'\' is not defined.',
'Remember me ?' => 'Remember me ?',
- 'Remove X amount to total cart' => 'Remove X amount to total cart',
'Remove X percent to total cart' => 'Remove X percent to total cart',
'Replace by the default language' => 'Replace by the default language',
'Replace current document by this file' => 'Replace current document by this file',
@@ -150,11 +221,16 @@ return array(
'Rotated Text File' => 'Rotated Text File',
'Sale price excluding taxes' => 'Sale price excluding taxes',
'Sale price including taxes' => 'Sale price including taxes',
+ 'Saving documents for %parentName% parent id %parentId% (%parentType%)' => 'Saving documents for %parentName% parent id %parentId% (%parentType%)',
+ 'Saving images for %parentName% parent id %parentId% (%parentType%)' => 'Saving images for %parentName% parent id %parentId% (%parentType%)',
+ 'Shipping zone name' => 'Shipping zone name',
'Show redirections *' => 'Show redirections *',
'Sorry, an error occured: %msg' => 'Sorry, an error occured: %msg',
+ 'Sorry, an error occurred: %err' => 'Sorry, an error occurred: %err',
'Sorry, you are not allowed to perform this action.' => 'Sorry, you are not allowed to perform this action.',
'Sorry, you\'re not allowed to perform this action' => 'Sorry, you\'re not allowed to perform this action',
'Source IP' => 'Source IP',
+ 'Stats on %month/%year' => 'Stats on %month/%year',
'Store configuration failed.' => 'Store configuration failed.',
'Store email address' => 'Store email address',
'Store logs into text file' => 'Store logs into text file',
@@ -167,65 +243,70 @@ return array(
'Summary' => 'Summary',
'Symbol *' => 'Symbol *',
'System log configuration failed.' => 'System log configuration failed.',
+ 'Tax ID not found in tax list JSON' => 'Tax ID not found in tax list JSON',
+ 'Tax list is not valid JSON' => 'Tax list is not valid JSON',
+ 'Tax rule ID not found' => 'Tax rule ID not found',
'Tax rule for this product *' => 'Tax rule for this product *',
'Template Name *' => 'Template Name *',
'Template file %file cannot be found.' => 'Template file %file cannot be found.',
'Text File' => 'Text File',
'Text Message' => 'Text Message',
+ 'The TaxEngine should be passed to this form before using it.' => 'The TaxEngine should be passed to this form before using it.',
+ 'The cart item count should match the condition' => 'The cart item count should match the condition',
+ 'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.' => 'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.',
+ 'The loop name \'%name\' is already defined in %className class' => 'The loop name \'%name\' is already defined in %className class',
'This category is online.' => 'This category is online.',
+ 'This condition is always true' => 'This condition is always true',
'This content is online.' => 'This content is online.',
+ 'This coupon does not exists' => 'This coupon does not exists',
+ 'This coupon will offert a flat percentage off a shopper\'s entire order (not applied to shipping costs or tax rates). If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.' => 'This coupon will offert a flat percentage off a shopper\'s entire order (not applied to shipping costs or tax rates). If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
+ 'This coupon will subtracts a set amount from the total cost of an order. If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.' => 'This coupon will subtracts a set amount from the total cost of an order. If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
+ 'This email already exists.' => 'This email already exists.',
+ 'This email does not exists' => 'This email does not exists',
'This extension must be installed and loaded' => 'This extension must be installed and loaded',
'This folder is online.' => 'This folder is online.',
+ 'This login already exists' => 'This login already exists',
'This product is on sale' => 'This product is on sale',
'This product is online' => 'This product is online',
+ 'This product_sale_elements_id does not exists for this product : %d' => 'This product_sale_elements_id does not exists for this product : %d',
+ 'This template is in use in some of your products, and cannot be deleted. Delete it from all your products and try again.' => 'This template is in use in some of your products, and cannot be deleted. Delete it from all your products and try again.',
+ 'This value should not be blank.' => 'This value should not be blank.',
'Timeout' => 'Timeout',
'Title' => 'Title',
'Title *' => 'Title *',
+ 'Title ID not found' => 'Title ID not found',
'Type' => 'Type',
+ 'Unable to process your request. Please try again (%err).' => 'Unable to process your request. Please try again (%err).',
+ 'Unavailable' => 'Unavailable',
+ 'Unconditional usage' => 'Unconditional usage',
+ 'Unconditionnal usage' => 'Unconditionnal usage',
+ 'Undefined loop argument "%name"' => 'Undefined loop argument "%name"',
+ 'Undefined search mode \'%mode\'' => 'Undefined search mode \'%mode\'',
+ 'Undefined translation type: %item' => 'Undefined translation type: %item',
+ 'Unknown order ID: %id' => 'Unknown order ID: %id',
+ 'Unsupported magic method %name. only getArgname() is supported.' => 'Unsupported magic method %name. only getArgname() is supported.',
'Username' => 'Username',
'Username *' => 'Username *',
'Value' => 'Value',
'Value *' => 'Value *',
'Warnings' => 'Warnings',
'Weight' => 'Weight',
- 'Weight *' => 'Weight *',
'Yes, I have a password :' => 'Yes, I have a password :',
+ 'You are already registered!' => 'You are already registered!',
+ 'You can only upload images (.png, .jpg, .jpeg, .gif)' => 'You can only upload images (.png, .jpg, .jpeg, .gif)',
'Your Email Address' => 'Your Email Address',
'Your Message' => 'Your Message',
+ 'Your current password does not match.' => 'Your current password does not match.',
'Zip code' => 'Zip code',
'date format' => 'date format',
+ 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface',
'language locale' => 'language locale',
'mailing system modification' => 'mailing system modification',
- 'shipping area name' => 'shipping area name',
- 'time format' => 'time format',
- 'This value should not be blank.' => 'This value should not be blank.',
- 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.' => 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.',
- 'Administrator ID not found' => 'Administrator ID not found',
- 'This login already exists' => 'This login already exists',
'password confirmation is not the same as password field' => 'password confirmation is not the same as password field',
'password must be composed of at least 4 characters' => 'password must be composed of at least 4 characters',
- 'this product id does not exists : %d' => 'this product id does not exists : %d',
- 'This product_sale_elements_id does not exists for this product : %d' => 'This product_sale_elements_id does not exists for this product : %d',
+ 'payment module %s is not a Thelia\Module\PaymentModuleInterface' => 'payment module %s is not a Thelia\Module\PaymentModuleInterface',
+ 'permanent discount (in percent)' => 'permanent discount (in percent)',
'quantity value is not valid' => 'quantity value is not valid',
- 'Please accept the Terms and conditions in order to register.' => 'Please accept the Terms and conditions in order to register.',
- 'This email already exists.' => 'This email already exists.',
- 'This email does not exists' => 'This email does not exists',
- 'Your current password does not match.' => 'Your current password does not match.',
- 'Module ID not found' => 'Module ID not found',
- 'You are already registered!' => 'You are already registered!',
- 'Address ID not found' => 'Address ID not found',
- 'Delivery module ID not found' => 'Delivery module ID not found',
- 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface',
- 'Order address ID not found' => 'Order address ID not found',
- 'Title ID not found' => 'Title ID not found',
- 'Country ID not found' => 'Country ID not found',
- 'Profile `code` already exists' => 'Profile `code` already exists',
- 'Profile ID not found' => 'Profile ID not found',
- 'The TaxEngine should be passed to this form before using it.' => 'The TaxEngine should be passed to this form before using it.',
- 'Tax rule ID not found' => 'Tax rule ID not found',
- 'Tax list is not valid JSON' => 'Tax list is not valid JSON',
- 'Bad tax list JSON' => 'Bad tax list JSON',
- 'Tax ID not found in tax list JSON' => 'Tax ID not found in tax list JSON',
- 'Please check your input: %s' => 'Please check your input: %s',
- 'Sorry, an error occured: %s' => 'Sorry, an error occured: %s',
+ 'this product id does not exists : %d' => 'this product id does not exists : %d',
+ 'time format' => 'time format',
);
diff --git a/core/lib/Thelia/Config/I18n/fr_FR.php b/core/lib/Thelia/Config/I18n/fr_FR.php
index ab7492dd6..bf413a362 100644
--- a/core/lib/Thelia/Config/I18n/fr_FR.php
+++ b/core/lib/Thelia/Config/I18n/fr_FR.php
@@ -1,36 +1,51 @@
'Le paramètre "%param" ne peut être vide dans la boucle type: %type, nom: %name ',
+ '"%param" parameter is missing in loop type: %type, name: %name' => 'Le paramètre "%param" est absent dans la boucle type: %type, nom: %name ',
'%obj SEO modification' => 'Modification SEO de %obj',
'%obj creation' => 'Création de %obj',
'%obj modification' => 'Modification de %obj',
+ '\'%type\' loop class should extends Thelia\Core\Template\Element\BaseLoop' => 'La classe de boucle \'%type\' doit hériter de Thelia\Core\Template\Element\BaseLoop ',
'A currency with code "%name" already exists.' => 'Une devise avec la code "%name" existe déjà',
+ 'A loop named \'%name\' already exists in the current scope.' => 'Une boucle nommée \'%name\' existe déjà dans le scope courant',
'A message with name "%name" already exists.' => 'Un message avec le nom "%name" existe déjà.',
+ 'A product with reference %ref already exists. Please choose another reference.' => 'Un produit portant la référfence %ref existe déja. Merci de choisir une autre référence.',
+ 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.' => 'Un utilisateur existe déjà avec cette adresse email. Connectez-vous ou demandez une réinitialisation de votre mot de passe.',
+ 'A value for attribute "%name" is already present in the combination' => 'Une valeur pour la déclinaison "%name" est déjà présente dans la combinaison',
'A variable with name "%name" already exists.' => 'Une variable avec le nom "%name" existe déjà.',
'Activate logs only for these IP Addresses' => 'Activer les logs uniquement pour ces adresses IP',
'Activate logs only for these files' => 'Activer les logs uniquement pour ces fichiers',
'Add to all product templates' => 'Ajouter à tous les templates produit',
'Additional address' => 'Adresse complémentaire',
- 'Address Line 2' => 'Adresse 1',
- 'Address Line 3' => 'Adresse 2',
- 'Address label' => 'Adresse',
+ 'Address ID not found' => 'ID de l\'adresse non trouvé',
+ 'Address Line 2' => 'Adresse suite',
+ 'Address Line 3' => 'Adresse suite',
+ 'Address label' => 'Libellé',
+ 'Administrator ID not found' => 'ID de l\'administrateur not trouvé',
'Advertise this product as new' => 'Afficher ce produit comme nouveau',
'Alerts' => 'Alertes',
'Alpha code 2 *' => 'Code Alpha 2 *',
'Alpha code 3 *' => 'Code Alpha 3 *',
- 'Amount removed from the cart' => 'Montant déduit du panier',
'Apply exchange rates on price in %sym' => 'Appliquer le taux de change sur le prix en %sym',
- 'Area' => 'Zone',
'Attribute ID:Attribute AV ID' => 'Déclinaison ID : Valeur de déclinaison ID',
'Auth mode' => 'Mode d\'authentification',
'Available quantity' => 'Quantité disponible',
'Available quantity *' => 'Quantité disponible *',
+ 'Available shipping zones' => 'Zones de livraison disponibles',
+ 'Bad tax list JSON' => 'Mauvais JSON de la liste des taxes',
'Business ID' => 'ID du business',
+ 'By cart total amount' => 'Montant total du panier',
'Cannot find a default country. Please define one.' => 'Impossible de trouver un pays par défaut. Veuillez en définir un.',
'Cannot find the shop country. Please select a shop country.' => 'Impossible de trouver le pays du magasin. Veuillez en sélectionner un.',
+ 'Cannot instanciante module "%name%": the namespace is null. Maybe the model is not loaded ?' => 'Ne peut instancier le module "%name%": le namespace est null. Peut-être que le modèle n\'est pas chargé ?',
+ 'Cart item count condition' => 'Nombre d\'articles dans le panier',
+ 'Cart item count is' => 'Le nombre d\'articles dans le panier est',
+ 'Cart total amount is' => 'Le total du panier est',
'Category title *' => 'Titre de la catégorie *',
'Cellphone' => 'Numéro de portable',
'Chapo' => 'Chapeau',
+ 'Check the total Cart amount in the given currency' => 'Applique une condition sur le montant total du panier dans la devise indiquée.',
'City' => 'Ville',
'Combination builder' => 'générateur de combinaison',
'Compagny' => 'Société',
@@ -41,31 +56,53 @@ return array(
'Constant amount found in one of the product\'s feature' => 'Montant fixe trouvé depuis une caractéristique produit',
'Content title *' => 'Titre du contenu *',
'Country' => 'Pays',
+ 'Country ID not found' => 'ID du pays non trouvé',
'Country area' => 'Zone du pays',
'Country title *' => 'Pays *',
'Critical' => 'Critique',
'Current Password' => 'Mot de passe actuel.',
+ 'Date \'%date\' is invalid, please enter a valid date using %fmt format' => 'La date \'%date\' est incorrecte, merci d\'indiquer une date au format %fmt',
'Debug' => 'Debug',
'Default folder *' => 'Dossier par défaut *',
'Default product category *' => 'Catégorie du produit par défaut *',
'Default product sale element' => 'Product Sale Element par défaut',
+ 'Deleting document for %id% with parent id %parentId%' => 'Suppression du document %id% avec l\'ID parent %parentId%',
+ 'Deleting image for %id% with parent id %parentId%' => 'Suppression de l\'image %id% avec l\'ID parent %parentId%',
+ 'Delivery module ID not found' => 'Id du module de livraison non trouvé',
'Description' => 'Description',
'Detailed description' => 'Description détaillée',
'Disabled' => 'Désactivé',
+ 'Discount amount' => 'Montant de la remise',
+ 'Document deleted successfully' => 'Le document a été supprimé.',
+ 'Document position updated' => 'La position du document a été modfiée',
'EAN Code' => 'Code EAN',
'Email Address' => 'Adresse mail',
'Email address' => 'Adresse e-mail',
'Emergency' => 'Urgence',
'Enable remote SMTP use' => 'Activer l\'utilisation d\'un serveur SMTP distant.',
'Encryption' => 'Chiffrement',
+ 'Equals' => 'Egal à',
+ 'Error during %action process : %error. Exception was %exc' => 'Erreur lors de %action: %error. Exception: %exc ',
+ 'Error occured while processing order ref. %ref, ID %id: %err' => 'Un erreur est survenue paedant le traitement de la commande ref. %ref, ID %id; %err',
'Errors' => 'Erreurs',
+ 'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)' => 'Echec lors de la suppression du document %id% avec l\'ID parent %parentId% (Exception : %e%)',
+ 'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)' => 'Echec lors de la suppression de l\'image %id% avec l\'ID parent %parentId% (Exception : %e%)',
+ 'Fail to update document position' => 'La position du document e n\'a pas pu être modfiée',
+ 'Fail to update image position' => 'La position de l\'image n\'a pas pu être modfiée',
+ 'Failed to create instance of module "%name%" when trying to delete module. Module directory has probably been deleted' => 'Ne peut créer une instance du module "%name%" lors de la suppression du module. Le répertoire du module à sans doute été supprimé manuellement.',
+ 'Failed to find a payment Module with ID=%mid for order ID=%oid' => 'Ne peut trouver le module de paiement ID=%mid pour la commande ID=%oid ',
+ 'Failed to open translation file %file. Please be sure that this file is writable by your Web server' => 'L\'ouverture du fichier %file a échoué. Merci de vérifier que ce fichier est accessible en écriture pour votre serveur Web.',
'Failed to update language definition: %ex' => 'Erreur lors de la mise à jour de la définition de la langue : %ex',
'Fax' => 'Fax',
'Feature value does not match FLOAT format' => 'valeur de caractéristique n\'est pas un FLOAT',
+ 'File is too heavy, please retry with a file having a size less than %size%.' => 'La taille du fichier est trop importante, et doit être inféreiure à %size%.',
'First Name' => 'Prénom',
'Firstname' => 'Prénom',
+ 'Fixed Amount Discount' => 'Remise d\'un montant fixe',
'Folder title *' => 'Titre du dossier *',
'Full Name' => 'Nom complet',
+ 'Greater than' => 'Supérieur à',
+ 'Greater than or equals' => 'Supérieur ou égal à',
'HTML Message' => 'Message au format HTML',
'Host' => 'Nom de l\'hôte',
'I would like to receive the newsletter or the latest news.' => 'Je souhaite recevoir la lettre d\'information ou les dernières actualités.',
@@ -73,21 +110,41 @@ return array(
'ISO 639-1 Code' => 'Code ISO 639-1',
'ISO Code *' => 'Code ISO *',
'If a translation is missing or incomplete :' => 'Si une traduction est manquante ou incomplète :',
+ 'If cart item count is %operator% %quantity%' => 'Le nombre d\'articles dans le panier est %operator% %quantity% ',
+ 'If cart total amount is %operator% %amount% %currency%' => 'Si le total du panier est %operator% %amount% %currency% ',
+ 'Image position updated' => 'La position de l\'image a été modfiée',
+ 'Images deleted successfully' => 'L\'image a été supprimée.',
+ 'Impossible to delete a customer who already have orders' => 'Impossible de supprimer un client si celui-ci a déjà une commande',
+ 'In' => 'Compris dans',
'Information' => 'Information',
'Invalid product_sale_elements' => 'product_sale_elements invalide',
+ 'Invalid value "%value" for "%param" parameter in loop type: %type, name: %name' => 'La valeur "%value" est invalide pour le paramètre "%param" dans la boucle type: %type, nom: %name ',
'Invalid value for walkMode parameter: %value' => 'Valeur incorrecte pour le paramètre walkMode : %value',
'Is it the default product sale element ?' => 'Product Sale Element par défaut ?',
'Language name' => 'Nom de la langue',
'Last Name' => 'Nom',
'Lastname' => 'Nom',
+ 'Less than' => 'Inférieur à',
+ 'Less than or equals' => 'Inférieur ou égal à',
'Log format *' => 'Format des logs *',
'Log level *' => 'Niveau de log *',
'Login' => 'Connexion',
'Login failed. Please check your username and password.' => 'Erreur de login. Veuillez vérifier votre login et votre mot de passe.',
+ 'Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`' => 'Une boucle ne peut implémenter plusieurs Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`',
+ 'Loop must implements \'PropelSearchLoopInterface\' to be timestampable' => 'Les classes \'boucle\' doivent implémenter \'PropelSearchLoopInterface\' pour être horodatables',
+ 'Loop must implements \'PropelSearchLoopInterface\' to be versionable' => 'Les classes \'boucle\' doivent implémenter \'PropelSearchLoopInterface\' pour être versonnables',
+ 'Loop must implements one of the following interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`' => 'Une boucle doit implémenter au moins une de ces interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`',
+ 'Loop type \'%type\' is not defined.' => 'La boucle de type \'%type\' n\'existe pas.',
'Make this address as my primary address' => 'Choisir cette adresse comme adresse par défaut',
'Message subject' => 'Sujet',
'Meta Description' => 'Meta description',
'Meta Keywords' => 'Meta keywords',
+ 'Missing \'name\' parameter in loop arguments' => 'Le paramètre obligatoire \'name\' est absent des paramètre de la boucle',
+ 'Missing \'rel\' parameter in ifloop/elseloop arguments' => 'Le paramètre obligatoire \'rel\' est absent des paramètre de la boucle ifloop/elseloop',
+ 'Missing \'rel\' parameter in page loop' => 'Le paramètre obligatoire \'rel\' est absent des paramètre de la boucle \'page\'',
+ 'Missing \'type\' parameter in loop arguments' => 'Le paramètre obligatoire \'type\' est absent des paramètre de la boucle ',
+ 'Missing \'type\' parameter in {count} loop arguments' => 'Le paramètre obligatoire \'type\' est absent des paramètre de la boucle {count}',
+ 'Module ID not found' => 'Id du module non trouvé',
'Name' => 'Nom',
'Name *' => 'Nom *',
'Name of the HTML layout file' => 'Nom du layout HTML',
@@ -97,17 +154,27 @@ return array(
'New Password' => 'Nouveau mot de passe.',
'No %obj was created.' => 'aucun %obj n\'a été créé.',
'No %obj was updated.' => 'Aucun %obj mis à jour',
+ 'No module found for code \'%item\'' => 'Aucun module trouvé pour \'%item\' ',
+ 'No pagination currently defined for loop name \'%name\'' => 'La pagination n\'est pas définie pour la boucle \'%name\'',
'No, I am a new customer.' => 'Non, je suis un nouveau client.',
+ 'Not equals' => 'Différent de',
+ 'Not found' => 'Non trouvé.',
+ 'Not in' => 'Non compris dans',
'Notices' => 'Notices',
+ 'Order address ID not found' => 'ID de l\'adresse de la commande non trouvé',
+ 'Order ref. %ref is now unpaid.' => 'La commande %ref, ID %id est désormais non payée',
+ 'Order ref. %ref, ID %id has been successfully paid.' => 'La commande ref. %ref, ID %id a été correctement payée',
'Page Title' => 'Titre de la page',
'Parent category *' => 'Catégorie parente *',
'Parent folder *' => 'Dossier parent *',
'Password' => 'Mot de passe',
'Password *' => 'Mot de passe *',
'Password confirmation' => 'Confirmation du mot de passe.',
+ 'Percent Discount' => 'Remise en pourcentage de la commande',
'Percentage of the product price' => 'Pourcentage du prix du produit',
- 'Percentage removed from the cart' => 'Pourcentage déduit du panier',
'Phone' => 'Téléphone',
+ 'Please accept the Terms and conditions in order to register.' => 'Veuillez accepter les termes et conditions pour vous inscrire.',
+ 'Please check your input: %error' => 'Merci de vérifier votre saisie: %error',
'Please enter your email address' => 'Renseignez votre adresse mail',
'Please enter your password' => 'Entrez votre mot de passe.',
'Please specify either \'path\' or \'file\' parameter in {url} function.' => 'Veuillez spécifier soit le paramètre \'chemin\' ou \'fichier\' dans la fonction {url}',
@@ -117,12 +184,14 @@ return array(
'Preferred locale' => 'locale souhaitée',
'Prevent mailing template modification or deletion, except for super-admin' => 'Prévenir la suppression ou la modification ds templates de mail, excepté pour les super-administrateurs.',
'Prevent variable modification or deletion, except for super-admin' => 'Prévenir la suppression ou la modification de variables, excepté pour les super-administrateurs.',
- 'Price' => 'Prix',
'Price currency *' => 'Devise *',
+ 'Processing cancelation of payment for order ref. %ref' => 'Traitement de l\'annulation du paiement de la commande %ref, ID %id',
+ 'Processing confirmation of order ref. %ref, ID %id' => 'Traitement de la confirmation de la commande %ref, ID %id',
'Prodcut ID *' => 'ID du produit *',
'Product ID' => 'ID produit',
'Product ID *' => 'ID produit *',
'Product base price excluding taxes *' => 'Prix du produit Hors Taxe *',
+ 'Product base price with taxes' => 'Prix du produit TTC',
'Product price excluding taxes' => 'Prix du produit Hors Taxes',
'Product price excluding taxes *' => 'prix HT',
'Product price including taxes' => 'Prix du produit taxes incluses',
@@ -133,14 +202,17 @@ return array(
'ProductSaleElement modification' => 'Modification de ProductSaleElement.',
'Profile' => 'Profil',
'Profile Code' => 'Profil',
+ 'Profile ID not found' => 'ID du profil non trouvé',
+ 'Profile `code` already exists' => 'Le `code` du profil existe déjà',
'Purpose *' => 'Objet',
+ 'Quantity' => 'Quantité',
'Rate from € *' => 'Taux à partie de l\'€ *',
'Redirecting ...' => 'Redirection ...',
'Redirecting to %url' => 'Redirection vers %url',
'Reference' => 'Référence',
'Reference *' => 'Référence *',
+ 'Related loop name \'%name\'\' is not defined.' => 'La boucle \'%name\' n\'est pas définie.',
'Remember me ?' => 'Se souvenir de moi ?',
- 'Remove X amount to total cart' => 'Enlève un montant fixe du total du panier',
'Remove X percent to total cart' => 'Enlève un pourcentage du panier total',
'Replace by the default language' => 'Remplacer par la langue par défaut',
'Replace current document by this file' => 'Remplacer le document courant par ce fichier',
@@ -149,11 +221,16 @@ return array(
'Rotated Text File' => 'Rotation du fichier texte',
'Sale price excluding taxes' => 'Prix de vente Hors Taxes',
'Sale price including taxes' => 'Prix de vente Toutes Taxes Comprises',
+ 'Saving documents for %parentName% parent id %parentId% (%parentType%)' => 'Enregistrement des documents pour %parentName% ID parent %parentId% (%parentType%)',
+ 'Saving images for %parentName% parent id %parentId% (%parentType%)' => 'Enregistrement des images pour %parentName% ID parent %parentId% (%parentType%)',
+ 'Shipping zone name' => 'Nom de la zone de livraison',
'Show redirections *' => 'Montrer les redirections *',
'Sorry, an error occured: %msg' => 'Désolé, une erreur est survenue : %msg',
+ 'Sorry, an error occurred: %err' => 'Désolé, une erreur est survenue: %err',
'Sorry, you are not allowed to perform this action.' => 'Désolé, vous n\'êtes pas autorisé à réaliser cette action.',
'Sorry, you\'re not allowed to perform this action' => 'Désolé, vous n\'êtes pas autorisé à réaliser cette action.',
'Source IP' => 'IP source',
+ 'Stats on %month/%year' => 'Statistiques pour %month/%year ',
'Store configuration failed.' => 'Erreur de configuration du magasin.',
'Store email address' => 'Adresse mail du magasin',
'Store logs into text file' => 'Conserver les logs dans des fichiers texte',
@@ -166,65 +243,70 @@ return array(
'Summary' => 'Résumé',
'Symbol *' => 'Symbole *',
'System log configuration failed.' => 'Erreur du configurateur de log system.',
+ 'Tax ID not found in tax list JSON' => 'ID de la taxe non trouvé dans le JSON de la liste des taxes',
+ 'Tax list is not valid JSON' => 'Le JSON de la liste des taxes n\'est pas valide',
+ 'Tax rule ID not found' => 'ID de la règle de taxe non trouvé',
'Tax rule for this product *' => 'Règle de taxe pour ce produit *',
'Template Name *' => 'Nom du template *',
'Template file %file cannot be found.' => 'Le fichier %file n\'a pas été trouvé dans le template. ',
'Text File' => 'Fichier texte',
'Text Message' => 'Message au format texte',
+ 'The TaxEngine should be passed to this form before using it.' => 'Le moteur de taxe doit être passé au formulaire avant d\'être utilisé.',
+ 'The cart item count should match the condition' => 'Le nombre d\'articles dans le panier doit vérifier la condition',
+ 'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.' => 'L\'image qui remplace un drapeau de pays manquant (%file) n\'a pas été trouvée. Merci de vérifier la variable de configuration unknown-flag-path.',
+ 'The loop name \'%name\' is already defined in %className class' => 'La boucle \'%name\' est déjà définir dans la classe %className',
'This category is online.' => 'Cette catégorie est en ligne.',
+ 'This condition is always true' => 'Cette condition est troujours vérifiée',
'This content is online.' => 'Ce contenu est en ligne.',
+ 'This coupon does not exists' => 'Ce code promo n\'existe pas',
+ 'This coupon will offert a flat percentage off a shopper\'s entire order (not applied to shipping costs or tax rates). If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.' => 'Ce code promo retire le pourcentage indiqué du total de la commande, hors frais de port et taxes. Si la remise est supérieur au total de la commande, seul le port sera facturé, à moins que le code promo n\'offre aussi les frais port.',
+ 'This coupon will subtracts a set amount from the total cost of an order. If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.' => 'Ce code promo retire le montant indiqué du total de la commande, hors frais de port et taxes. Si la remise est supérieur au total de la commande, seul le port sera facturé, à moins que le code promo n\'offre aussi les frais port.',
+ 'This email already exists.' => 'Cette adresse email existe déjà',
+ 'This email does not exists' => 'Cette adresse email n\'existe pas',
'This extension must be installed and loaded' => 'Cette extension doit être installée et chargée.',
'This folder is online.' => 'Ce dossier est en ligne.',
+ 'This login already exists' => 'Cet identifiant existe déjà',
'This product is on sale' => 'Ce produit est en promo',
'This product is online' => 'Ce produit est en ligne',
+ 'This product_sale_elements_id does not exists for this product : %d' => 'Le product_sale_elements_id n\'existe pas pour ce produit : %d',
+ 'This template is in use in some of your products, and cannot be deleted. Delete it from all your products and try again.' => 'Ce template est utilisé par des produits, et ne peut être supprimé. Retirez-le de tous vos produits, et ré-essayez.',
+ 'This value should not be blank.' => 'Cette valeur ne doit pas être vide.',
'Timeout' => 'Délai d\'attente expiré',
'Title' => 'Titre',
'Title *' => 'Titre *',
+ 'Title ID not found' => 'ID de la civilité non trouvé',
'Type' => 'Type',
+ 'Unable to process your request. Please try again (%err).' => 'Echec lors du traitement de votre requête. Merci de ré-essayer (%err).',
+ 'Unavailable' => 'Non disponible.',
+ 'Unconditional usage' => 'Utilisable sans conditions',
+ 'Unconditionnal usage' => 'Utilisable sans conditions',
+ 'Undefined loop argument "%name"' => 'Argument de boucle invalide: "%name" ',
+ 'Undefined search mode \'%mode\'' => 'Mode de recherche \'%mode\' invalide',
+ 'Undefined translation type: %item' => 'Type de traduction inconnu:%item ',
+ 'Unknown order ID: %id' => 'La commande ID %id est inconnue.',
+ 'Unsupported magic method %name. only getArgname() is supported.' => 'La méthode magique %name n\'est pas supportée. Seule get() est supporté..',
'Username' => 'Nom d\'utilisateur',
'Username *' => 'Nom d\'utilisateur *',
'Value' => 'Valeur',
'Value *' => 'Valeur *',
'Warnings' => 'Avertissements',
'Weight' => 'Poids',
- 'Weight *' => 'Poids *',
'Yes, I have a password :' => 'Oui, j\'ai un mot de passe :',
+ 'You are already registered!' => 'Vous êtes déjà enregistré !',
+ 'You can only upload images (.png, .jpg, .jpeg, .gif)' => 'Seules les images sont autorisées (.png, .jpg, .jpeg, .gif)',
'Your Email Address' => 'Votre adresse mail',
'Your Message' => 'Votre message',
+ 'Your current password does not match.' => 'Votre mot de passe actuel ne correspond pas',
'Zip code' => 'Code postal',
'date format' => 'Format de date',
+ 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'le module de livraison %s n\'est pas un Thelia\Module\DeliveryModuleInterface',
'language locale' => 'Langue locale',
'mailing system modification' => 'Modification du système d\'envoi de mail.',
- 'shipping area name' => 'Nom de la zone de livraison',
- 'time format' => 'Format d\'heure',
- 'This value should not be blank.' => 'Cette valeur ne doit pas être vide.',
- 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.' => 'Un utilisateur existe déjà avec cette adresse email. Connectez-vous ou demandez une réinitialisation de votre mot de passe.',
- 'Administrator ID not found' => 'ID de l\'administrateur not trouvé',
- 'This login already exists' => 'Cet identifiant existe déjà',
'password confirmation is not the same as password field' => 'le mot de passe de confirmation n\'est pas le même que le champ mot de passe',
'password must be composed of at least 4 characters' => 'le mot de passe doit être composé d\'au moins 4 caractères',
- 'this product id does not exists : %d' => 'l\'id du produit %d n\'existe pas',
- 'This product_sale_elements_id does not exists for this product : %d' => 'Le product_sale_elements_id n\'existe pas pour ce produit : %d',
+ 'payment module %s is not a Thelia\Module\PaymentModuleInterface' => 'Le module de paiement %s n\'est pas une instance de Thelia\Module\PaymentModuleInterface ',
+ 'permanent discount (in percent)' => 'Remise permanente (en pourcentage)',
'quantity value is not valid' => 'la valeur de la quantité n\'est pas valide',
- 'Please accept the Terms and conditions in order to register.' => 'Veuillez accepter les termes et conditions pour vous inscrire.',
- 'This email already exists.' => 'Cette adresse email existe déjà',
- 'This email does not exists' => 'Cette adresse email n\'existe pas',
- 'Your current password does not match.' => 'Votre mot de passe actuel ne correspond pas',
- 'Module ID not found' => 'Id du module non trouvé',
- 'You are already registered!' => 'Vous êtes déjà enregistré !',
- 'Address ID not found' => 'ID de l\'adresse non trouvé',
- 'Delivery module ID not found' => 'Id du module de livraison non trouvé',
- 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'le module de livraison %s n\'est pas un Thelia\Module\DeliveryModuleInterface',
- 'Order address ID not found' => 'ID de l\'adresse de la commande non trouvé',
- 'Title ID not found' => 'ID de la civilité non trouvé',
- 'Country ID not found' => 'ID du pays non trouvé',
- 'Profile `code` already exists' => 'Le `code` du profil existe déjà',
- 'Profile ID not found' => 'ID du profil non trouvé',
- 'The TaxEngine should be passed to this form before using it.' => 'Le moteur de taxe doit être passé au formulaire avant d\'être utilisé.',
- 'Tax rule ID not found' => 'ID de la règle de taxe non trouvé',
- 'Tax list is not valid JSON' => 'Le JSON de la liste des taxes n\'est pas valide',
- 'Bad tax list JSON' => 'Mauvais JSON de la liste des taxes',
- 'Tax ID not found in tax list JSON' => 'ID de la taxe non trouvé dans le JSON de la liste des taxes',
- 'Please check your input: %s' => 'Veuillez vérifier votre saisie: %s',
- 'Sorry, an error occured: %s' => 'Désolé, une erreur est survenue: %s',
+ 'this product id does not exists : %d' => 'l\'id du produit %d n\'existe pas',
+ 'time format' => 'Format d\'heure',
);
diff --git a/core/lib/Thelia/Config/I18n/it_IT.php b/core/lib/Thelia/Config/I18n/it_IT.php
index 188d6f90a..265f136eb 100644
--- a/core/lib/Thelia/Config/I18n/it_IT.php
+++ b/core/lib/Thelia/Config/I18n/it_IT.php
@@ -1,26 +1,201 @@
. */
-/* */
-/*************************************************************************************/
return array(
-
+ '%obj SEO modification' => 'modifiche SEO %obj',
+ '%obj creation' => 'creazione di %obj ',
+ '%obj modification' => 'modifica %obj',
+ 'A currency with code "%name" already exists.' => 'Una moneta con il codice "%name" esiste già.',
+ 'A message with name "%name" already exists.' => 'Un messaggio con il nome "%name" esiste già.',
+ 'A variable with name "%name" already exists.' => 'Una variabile con il nome "%name" esiste già.',
+ 'Activate logs only for these IP Addresses' => 'Attivare log solo per questi indirizzi IP',
+ 'Activate logs only for these files' => 'Attivare log solo per questi file',
+ 'Add to all product templates' => 'Aggiungere a tutti i template di prodotto',
+ 'Additional address' => 'Indirizzo addizionale',
+ 'Address Line 2' => 'Indirizzo linea 2',
+ 'Address Line 3' => 'Indirizzo linea 3',
+ 'Address label' => 'Etichetta dell\'indirizzo',
+ 'Advertise this product as new' => 'Pubblicizzare questo prodotto come nuovo',
+ 'Alerts' => 'Avvisi',
+ 'Alpha code 2 *' => 'Alpha code 2 *',
+ 'Alpha code 3 *' => 'Alpha code 3 *',
+ 'Amount removed from the cart' => 'Importo rimosso dal carrello',
+ 'Apply exchange rates on price in %sym' => 'Applicare i tassi di cambio sui prezzi in %sym',
+ 'Area' => 'Zona',
+ 'Attribute ID:Attribute AV ID' => 'Attribute ID:Attribute AV ID',
+ 'Auth mode' => 'Auth mode',
+ 'Available quantity' => 'Quantità disponibile',
+ 'Available quantity *' => 'Quantità disponibile *',
+ 'Business ID' => 'Business ID',
+ 'Cannot find a default country. Please define one.' => 'Non riusciamo a trovare un paese predefinito. Per favore, definirne uno.',
+ 'Cannot find the shop country. Please select a shop country.' => 'Non riusciamo a trovare il paese di negozio. Si prega di selezionare un paese per il negozio.',
+ 'Category title *' => 'Titolo della categoria *',
+ 'Cellphone' => 'Cellulare',
+ 'Chapo' => 'Chapo',
+ 'City' => 'Città',
+ 'Combination builder' => 'Generatore di combinazione',
+ 'Compagny' => 'Azienda',
+ 'Company' => 'Azienda',
+ 'Company Name' => 'Nome della società',
+ 'Conclusion' => 'Conclusione',
+ 'Constant amount' => 'Importo costante',
+ 'Constant amount found in one of the product\'s feature' => 'Importo costante trovato in una delle caratteristiche del prodotto',
+ 'Content title *' => 'Titolo del contenuto *',
+ 'Country' => 'Paese',
+ 'Country area' => 'Zona del paese',
+ 'Country title *' => 'Titolo del paese *',
+ 'Critical' => 'Critico',
+ 'Current Password' => 'Password attuale',
+ 'Debug' => 'Eseguire il debug',
+ 'Default folder *' => 'Cartella predefinita *',
+ 'Default product category *' => 'Categoria di prodotto predefinita *',
+ 'Default product sale element' => 'Elemento predefinito di vendita per il prodotto',
+ 'Description' => 'Descrizione',
+ 'Detailed description' => 'Descrizione dettagliata',
+ 'Disabled' => 'Disattivato',
+ 'EAN Code' => 'Codice EAN',
+ 'Email Address' => 'Indirizzo email',
+ 'Email address' => 'Indirizzo email',
+ 'Emergency' => 'Emergenza',
+ 'Enable remote SMTP use' => 'Abilitare l\'utilizzo di un SMTP remoto',
+ 'Encryption' => 'Criptaggio',
+ 'Errors' => 'Errori',
+ 'Failed to update language definition: %ex' => 'Impossibile aggiornare la definizione del linguaggio: %ex',
+ 'Fax' => 'Fax',
+ 'Feature value does not match FLOAT format' => 'Il valore della caratteristica non corrisponde al formato FLOAT',
+ 'First Name' => 'Nome',
+ 'Firstname' => 'Nome',
+ 'Folder title *' => 'Titolo della cartella *',
+ 'Full Name' => 'Nome e cognome',
+ 'HTML Message' => 'Messaggio HTML',
+ 'Host' => 'Host',
+ 'I would like to receive the newsletter or the latest news.' => 'Vorrei ricevere la newsletter o le ultime notizie.',
+ 'ISO 4217 code *' => 'Codice ISO 4217 *',
+ 'ISO 639-1 Code' => 'Codice ISO 639-1',
+ 'ISO Code *' => 'Codice ISO *',
+ 'If a translation is missing or incomplete :' => 'Se una traduzione è incompleta o mancante :',
+ 'Information' => 'Informazioni',
+ 'Invalid product_sale_elements' => 'Product_sale_elements non valido',
+ 'Invalid value for walkMode parameter: %value' => 'Valore non valido per il parametro walkMode: %value',
+ 'Is it the default product sale element ?' => 'È l\'elemento predefinito di vendita del prodotto?',
+ 'Language name' => 'Nome della lingua',
+ 'Last Name' => 'Cognome',
+ 'Lastname' => 'Cognome',
+ 'Log format *' => 'Formato di registro *',
+ 'Log level *' => 'Livello del registro *',
+ 'Login' => 'Login',
+ 'Login failed. Please check your username and password.' => 'Accesso non riuscito. Si prega di controllare il nome dell\'utente e la password.',
+ 'Make this address as my primary address' => 'Fare questo indirizzo come mio indirizzo primario',
+ 'Message subject' => 'Oggetto del messaggio',
+ 'Meta Description' => 'Meta descrizione',
+ 'Meta Keywords' => 'Meta Keywords',
+ 'Name' => 'Nome',
+ 'Name *' => 'Nome *',
+ 'Name of the HTML layout file' => 'Nome del layout HTML',
+ 'Name of the HTML template file' => 'Nome del file del template HTML',
+ 'Name of the text layout file' => 'Nome del file del layout del testo',
+ 'Name of the text template file' => 'Nome del testo del file del template',
+ 'New Password' => 'Nuova Password',
+ 'No %obj was created.' => 'È stato creato nessuno %obj.',
+ 'No %obj was updated.' => 'Nessun %obj è stato aggiornato.',
+ 'No, I am a new customer.' => 'No, sono un nuovo cliente.',
+ 'Notices' => 'Avvisi',
+ 'Page Title' => 'Titolo della pagina',
+ 'Parent category *' => 'Categoria superiore *',
+ 'Parent folder *' => 'Cartella superiore *',
+ 'Password' => 'Password',
+ 'Password *' => 'Password *',
+ 'Password confirmation' => 'Conferma della password',
+ 'Percentage of the product price' => 'Percentuale del prezzo del prodotto',
+ 'Percentage removed from the cart' => 'Percentuale rimosso dal carrello',
+ 'Phone' => 'Telefono',
+ 'Please enter your email address' => 'Inserisci il tuo indirizzo email',
+ 'Please enter your password' => 'Per favore inserisci la password',
+ 'Please specify either \'path\' or \'file\' parameter in {url} function.' => 'Specificare il parametro \'percorso\' o \'file\' nella funzione {url}.',
+ 'Port' => 'Spedizione',
+ 'Post Scriptum' => 'Post Scriptum',
+ 'Postage' => 'Spese di spedizione',
+ 'Preferred locale' => 'Impostazioni internazionali preferite',
+ 'Prevent mailing template modification or deletion, except for super-admin' => 'Prevenire modifiche o cancellazione del template di mailing, ad eccezione del super-admin',
+ 'Prevent variable modification or deletion, except for super-admin' => 'Prevenire modifiche o cancellazione della variabile, ad eccezione del super-admin',
+ 'Price' => 'Prezzo',
+ 'Price currency *' => 'Prezzo della moneta *',
+ 'Prodcut ID *' => 'ID prodotto *',
+ 'Product ID' => 'ID prodotto',
+ 'Product ID *' => 'ID Prodotto *',
+ 'Product base price excluding taxes *' => 'Prezzo di base del prodotto escluse le tasse *',
+ 'Product price excluding taxes' => 'Prezzo del prodotto escluse le tasse',
+ 'Product price excluding taxes *' => 'Prezzo del prodotto escluse le tasse *',
+ 'Product price including taxes' => 'Prezzo del prodotto tasse incluse',
+ 'Product reference *' => 'Riferimento del prodotto *',
+ 'Product sale element ID *' => 'ID del prodotto venduto *',
+ 'Product template' => 'Template del prodotto',
+ 'Product title *' => 'Titolo del prodotto *',
+ 'ProductSaleElement modification' => 'modifica del ProductSaleElement',
+ 'Profile' => 'Profilo',
+ 'Profile Code' => 'Codice del profilo',
+ 'Purpose *' => 'Scopo *',
+ 'Quantity' => 'Quantità',
+ 'Rate from € *' => 'Tasso da € *',
+ 'Redirecting ...' => 'Reindirizzamento ...',
+ 'Redirecting to %url' => 'Reindirizzamento a %url',
+ 'Reference' => 'Riferimento',
+ 'Reference *' => 'Riferimento *',
+ 'Remember me ?' => 'Ricordati di me?',
+ 'Remove X amount to total cart' => 'Rimuovere una quantità di X al totale del carrello',
+ 'Remove X percent to total cart' => 'Rimuovi X percento al totale del carrello',
+ 'Replace by the default language' => 'Sostituire la lingua predefinita',
+ 'Replace current document by this file' => 'Sostituire l\'attuale documento da questo file',
+ 'Replace current image by this file' => 'Sostituire l\'immagine per questo file',
+ 'Rewriten URL' => 'URL riscritta',
+ 'Rotated Text File' => 'File di testo ruotato',
+ 'Sale price excluding taxes' => 'Prezzo di vendita escluse le tasse',
+ 'Sale price including taxes' => 'Prezzo di vendita tasse incluse',
+ 'Show redirections *' => 'Visualizza redirezioni *',
+ 'Sorry, an error occured: %msg' => 'Siamo spiacenti, errore: %msg',
+ 'Sorry, you are not allowed to perform this action.' => 'Siamo spiacenti, non è consentito eseguire questa azione.',
+ 'Sorry, you\'re not allowed to perform this action' => 'Siamo spiacenti, non sei autorizzato ad eseguire questa azione',
+ 'Source IP' => 'IP di origine',
+ 'Store configuration failed.' => 'La registrazione della configurazione è fallita.',
+ 'Store email address' => 'Indirizzo email del negozio',
+ 'Store logs into text file' => 'Archiviare i log in un file di testo',
+ 'Store logs into text file, up to a certian size, then a new file is created' => 'Archiviare i log in un file di testo, fino ad una certa dimensione, dopo viene creato un nuovo file',
+ 'Store name' => 'Nome del negozio',
+ 'Street Address' => 'Indirizzo',
+ 'Street Address ' => 'Indirizzo ',
+ 'Strictly use the requested language' => 'Utilizzare rigorosamente la lingua richiesta',
+ 'Subject' => 'Oggetto',
+ 'Summary' => 'Riassunto',
+ 'Symbol *' => 'Simbolo *',
+ 'System log configuration failed.' => 'Non e riuscito la configurazione del registro di sistema.',
+ 'Tax rule for this product *' => 'Regola fiscale per questo prodotto *',
+ 'Template Name *' => 'Nome del template *',
+ 'Template file %file cannot be found.' => 'File del template %file non vengono trovati.',
+ 'Text File' => 'File di testo',
+ 'Text Message' => 'Messaggio di testo',
+ 'This category is online.' => 'Questa categoria è online.',
+ 'This content is online.' => 'Questo contenuto è online.',
+ 'This extension must be installed and loaded' => 'Questa estensione deve essere installata e caricata',
+ 'This folder is online.' => 'Questa cartella è online.',
+ 'This product is on sale' => 'Questo prodotto è in vendita',
+ 'This product is online' => 'Questo prodotto è online',
+ 'Timeout' => 'Timeout',
+ 'Title' => 'Titolo',
+ 'Title *' => 'Titolo *',
+ 'Type' => 'Tipo',
+ 'Username' => 'Nome dell\'utente',
+ 'Username *' => 'Nome dell\'utente *',
+ 'Value' => 'Valore',
+ 'Value *' => 'Valore *',
+ 'Warnings' => 'Avvertenze',
+ 'Weight' => 'Peso',
+ 'Weight *' => 'Peso *',
+ 'Yes, I have a password :' => 'Sì, ho una password :',
+ 'Your Email Address' => 'Indirizzo Email',
+ 'Your Message' => 'Il tuo messaggio',
+ 'Zip code' => 'Codice postale',
+ 'date format' => 'Formato della data',
+ 'language locale' => 'Impostazione regionale della lingua',
+ 'mailing system modification' => 'modifica del sistema di mailing',
+ 'shipping area name' => 'nome dell\'area di spedizione',
+ 'time format' => 'Formato dell\'ora',
);
diff --git a/core/lib/Thelia/Config/I18n/ru_RU.php b/core/lib/Thelia/Config/I18n/ru_RU.php
new file mode 100644
index 000000000..634c0e768
--- /dev/null
+++ b/core/lib/Thelia/Config/I18n/ru_RU.php
@@ -0,0 +1,4 @@
+
+
diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml
index 9657f80e0..614364294 100644
--- a/core/lib/Thelia/Config/Resources/config.xml
+++ b/core/lib/Thelia/Config/Resources/config.xml
@@ -96,6 +96,10 @@
+
+
+
+
diff --git a/core/lib/Thelia/Config/Resources/form.xml b/core/lib/Thelia/Config/Resources/form.xml
index ec281266e..27e169b7c 100644
--- a/core/lib/Thelia/Config/Resources/form.xml
+++ b/core/lib/Thelia/Config/Resources/form.xml
@@ -122,6 +122,11 @@
+
+
+
+
+
diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml
index 703dcb33b..348c1d7ec 100644
--- a/core/lib/Thelia/Config/Resources/routing/admin.xml
+++ b/core/lib/Thelia/Config/Resources/routing/admin.xml
@@ -16,10 +16,20 @@
Thelia\Controller\Admin\HomeController::defaultAction
+
+ Thelia\Controller\Admin\HomeController::getLatestTheliaVersion
+
+
Thelia\Controller\Admin\HomeController::loadStatsAjaxAction
+
+ Thelia\Controller\Admin\AdminController::processTemplateAction
+ ajax/thelia_news_feed
+ 1
+
+
@@ -340,6 +350,10 @@
Thelia\Controller\Admin\ProductController::priceCaclulator
+
+ Thelia\Controller\Admin\ProductController::calculatePrice
+
+
Thelia\Controller\Admin\ProductController::loadConvertedPrices
@@ -498,10 +512,6 @@
Thelia\Controller\Admin\CouponController::updateAction\d+
-
- Thelia\Controller\Admin\CouponController::readAction
- \d+
- Thelia\Controller\Admin\CouponController::getBackOfficeInputsAjaxAction.*
@@ -535,6 +545,10 @@
+
+ Thelia\Controller\Admin\ConfigurationController::indexAction
+
+
Thelia\Controller\Admin\ConfigController::defaultAction
@@ -763,9 +777,9 @@
Thelia\Controller\Admin\ShippingZoneController::indexAction
-
+ Thelia\Controller\Admin\ShippingZoneController::updateAction
- \d+
+ \d+
@@ -977,6 +991,25 @@
+
+
+ Thelia\Controller\Admin\AdvancedConfigurationController::defaultAction
+
+
+
+ Thelia\Controller\Admin\AdvancedConfigurationController::flushCacheAction
+
+
+
+ Thelia\Controller\Admin\AdvancedConfigurationController::flushAssetsAction
+
+
+
+ Thelia\Controller\Admin\AdvancedConfigurationController::flushImagesAndDocumentsAction
+
+
+
+
@@ -1125,6 +1158,16 @@
Thelia\Controller\Admin\TranslationsController::updateAction
+
+
+
+ Thelia\Controller\Admin\ExportController::indexAction
+
+
+
+ Thelia\Controller\Admin\CustomerExportController::NewsletterExportAction
+
+
diff --git a/core/lib/Thelia/Config/Resources/smarty-plugin.xml b/core/lib/Thelia/Config/Resources/smarty-plugin.xml
index 903bb114e..222874903 100644
--- a/core/lib/Thelia/Config/Resources/smarty-plugin.xml
+++ b/core/lib/Thelia/Config/Resources/smarty-plugin.xml
@@ -38,6 +38,11 @@
+
+
+
+
+
diff --git a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php
index eeafe6a6c..8fd720c64 100644
--- a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php
+++ b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -335,15 +324,17 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage();
}
- $this->setupFormErrorContext(
- $this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)),
- $error_msg,
- $creationForm,
- $ex
- );
+ if (false !== $error_msg) {
+ $this->setupFormErrorContext(
+ $this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)),
+ $error_msg,
+ $creationForm,
+ $ex
+ );
- // At this point, the form has error, and should be redisplayed.
- return $this->renderList();
+ // At this point, the form has error, and should be redisplayed.
+ return $this->renderList();
+ }
}
/**
@@ -435,15 +426,17 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage();*/
}
- // At this point, the form has errors, and should be redisplayed.
- $this->setupFormErrorContext(
- $this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)),
- $error_msg,
- $changeForm,
- $ex
- );
+ if (false !== $error_msg) {
+ // At this point, the form has errors, and should be redisplayed.
+ $this->setupFormErrorContext(
+ $this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)),
+ $error_msg,
+ $changeForm,
+ $ex
+ );
- return $this->renderEditionTemplate();
+ return $this->renderEditionTemplate();
+ }
}
/**
diff --git a/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php
index 52c4bbda4..f4e59c4e8 100644
--- a/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php
+++ b/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -157,13 +146,14 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
/**
* Update SEO modification, and either go back to the object list, or stay on the edition page.
*
- * @return Thelia\Core\HttpFoundation\Response the response
+ * @return \Thelia\Core\HttpFoundation\Response the response
*/
public function processUpdateSeoAction()
{
// Check current user authorization
- if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE))
+ if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
return $response;
+ }
// Error (Default: false)
$error_msg = false;
@@ -221,14 +211,16 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
$this->getParserContext()->addForm($changeForm);
}
- $this->setupFormErrorContext(
- $this->getTranslator()->trans("%obj SEO modification", array('%obj' => $this->objectName)),
- $error_msg,
- $updateSeoForm,
- $ex
- );
+ if (false !== $error_msg) {
+ $this->setupFormErrorContext(
+ $this->getTranslator()->trans("%obj SEO modification", array('%obj' => $this->objectName)),
+ $error_msg,
+ $updateSeoForm,
+ $ex
+ );
- // At this point, the form has errors, and should be redisplayed.
- return $this->renderEditionTemplate();
+ // At this point, the form has errors, and should be redisplayed.
+ return $this->renderEditionTemplate();
+ }
}
}
diff --git a/core/lib/Thelia/Controller/Admin/AddressController.php b/core/lib/Thelia/Controller/Admin/AddressController.php
index c818ba492..658db4293 100644
--- a/core/lib/Thelia/Controller/Admin/AddressController.php
+++ b/core/lib/Thelia/Controller/Admin/AddressController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/AdminController.php b/core/lib/Thelia/Controller/Admin/AdminController.php
index 0b76c79ff..ddffbb960 100644
--- a/core/lib/Thelia/Controller/Admin/AdminController.php
+++ b/core/lib/Thelia/Controller/Admin/AdminController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/AdminLogsController.php b/core/lib/Thelia/Controller/Admin/AdminLogsController.php
index 5f3fadb0f..afd2cf910 100644
--- a/core/lib/Thelia/Controller/Admin/AdminLogsController.php
+++ b/core/lib/Thelia/Controller/Admin/AdminLogsController.php
@@ -1,38 +1,26 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
use Thelia\Core\Security\AccessManager;
+use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Model\AdminLogQuery;
class AdminLogsController extends BaseAdminController
{
- const RESOURCE_CODE = "admin.admin-logs";
-
public function defaultAction()
{
- if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
+ if (null !== $response = $this->checkAuth(AdminResources::ADMIN_LOG, array(), AccessManager::VIEW)) return $response;
// Render the edition template.
return $this->render('admin-logs');
diff --git a/core/lib/Thelia/Controller/Admin/AdministratorController.php b/core/lib/Thelia/Controller/Admin/AdministratorController.php
index eabc62c13..03458a91f 100644
--- a/core/lib/Thelia/Controller/Admin/AdministratorController.php
+++ b/core/lib/Thelia/Controller/Admin/AdministratorController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/AdvancedConfigurationController.php b/core/lib/Thelia/Controller/Admin/AdvancedConfigurationController.php
new file mode 100644
index 000000000..32dee27fe
--- /dev/null
+++ b/core/lib/Thelia/Controller/Admin/AdvancedConfigurationController.php
@@ -0,0 +1,104 @@
+
+ */
+class AdvancedConfigurationController extends BaseAdminController
+{
+
+ public function defaultAction()
+ {
+ if (null !== $result = $this->checkAuth(AdminResources::ADVANCED_CONFIGURATION, [], AccessManager::VIEW)) {
+ return $result;
+ }
+
+ return $this->render('advanced-configuration');
+ }
+
+ public function flushCacheAction()
+ {
+ if (null !== $result = $this->checkAuth(AdminResources::ADVANCED_CONFIGURATION, [], AccessManager::UPDATE)) {
+ return $result;
+ }
+
+ $form = new CacheFlushForm($this->getRequest());
+ try {
+ $this->validateForm($form);
+
+ $event = new CacheEvent($this->container->getParameter("kernel.cache_dir"));
+ $this->dispatch(TheliaEvents::CACHE_CLEAR, $event);
+
+ } catch (\Exception $e) {
+ Tlog::getInstance()->addError(sprintf("Flush cache error: %s", $e->getMessage()));
+ }
+
+ $this->redirectToRoute('admin.configuration.advanced');
+ }
+
+ public function flushAssetsAction()
+ {
+ if (null !== $result = $this->checkAuth(AdminResources::ADVANCED_CONFIGURATION, [], AccessManager::UPDATE)) {
+ return $result;
+ }
+
+ $form = new AssetsFlushForm($this->getRequest());
+ try {
+ $this->validateForm($form);
+
+ $event = new CacheEvent(THELIA_WEB_DIR . "assets");
+ $this->dispatch(TheliaEvents::CACHE_CLEAR, $event);
+
+ } catch (\Exception $e) {
+ Tlog::getInstance()->addError(sprintf("Flush assets error: %s", $e->getMessage()));
+ }
+
+ $this->redirectToRoute('admin.configuration.advanced');
+ }
+
+ public function flushImagesAndDocumentsAction()
+ {
+ if (null !== $result = $this->checkAuth(AdminResources::ADVANCED_CONFIGURATION, [], AccessManager::UPDATE)) {
+ return $result;
+ }
+
+ $form = new ImagesAndDocumentsCacheFlushForm($this->getRequest());
+ try {
+ $this->validateForm($form);
+
+ $event = new CacheEvent(THELIA_WEB_DIR . ConfigQuery::read('image_cache_dir_from_web_root', 'cache'));
+ $this->dispatch(TheliaEvents::CACHE_CLEAR, $event);
+
+ $event = new CacheEvent(THELIA_WEB_DIR . ConfigQuery::read('document_cache_dir_from_web_root', 'cache'));
+ $this->dispatch(TheliaEvents::CACHE_CLEAR, $event);
+
+ } catch (\Exception $e) {
+ Tlog::getInstance()->addError(sprintf("Flush images and document error: %s", $e->getMessage()));
+ }
+
+ $this->redirectToRoute('admin.configuration.advanced');
+ }
+}
diff --git a/core/lib/Thelia/Controller/Admin/AreaController.php b/core/lib/Thelia/Controller/Admin/AreaController.php
index 2464ad0cb..af0045f7c 100644
--- a/core/lib/Thelia/Controller/Admin/AreaController.php
+++ b/core/lib/Thelia/Controller/Admin/AreaController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -275,7 +264,7 @@ class AreaController extends AbstractCrudController
// Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response;
$request = $this->getRequest();
- $removeCountryEvent = new AreaRemoveCountryEvent($request->request->get('areai_id', 0), $request->request->get('country_id', 0));
+ $removeCountryEvent = new AreaRemoveCountryEvent($request->request->get('area_id', 0), $request->request->get('country_id', 0));
$this->dispatch(TheliaEvents::AREA_REMOVE_COUNTRY, $removeCountryEvent);
diff --git a/core/lib/Thelia/Controller/Admin/AttributeAvController.php b/core/lib/Thelia/Controller/Admin/AttributeAvController.php
index 4ddf439a2..abf8cb5e0 100644
--- a/core/lib/Thelia/Controller/Admin/AttributeAvController.php
+++ b/core/lib/Thelia/Controller/Admin/AttributeAvController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -141,7 +130,7 @@ class AttributeAvController extends AbstractCrudController
->findOneById($this->getRequest()->get('attributeav_id', 0));
if (null !== $attributeAv) {
- $attribute->setLocale($this->getCurrentEditionLocale());
+ $attributeAv->setLocale($this->getCurrentEditionLocale());
}
return $attributeAv;
diff --git a/core/lib/Thelia/Controller/Admin/AttributeController.php b/core/lib/Thelia/Controller/Admin/AttributeController.php
index 75da59ec3..71c479360 100644
--- a/core/lib/Thelia/Controller/Admin/AttributeController.php
+++ b/core/lib/Thelia/Controller/Admin/AttributeController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php
index 30ee37104..deba32d56 100644
--- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php
+++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php
@@ -1,27 +1,18 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Controller\Admin;
+use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Exception\InvalidParameterException;
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
@@ -266,9 +257,9 @@ class BaseAdminController extends BaseController
/**
* Redirect to à route ID related URL
*
- * @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
- * @param array|\Thelia\Controller\Admin\unknown $urlParameters the URL parametrs, as a var/value pair array
- * @param array $routeParameters
+ * @param string $routeId the route ID, as found in Config/Resources/routing/admin.xml
+ * @param array $urlParameters the URL parameters, as a var/value pair array
+ * @param array $routeParameters
*/
public function redirectToRoute($routeId, array $urlParameters = array(), array $routeParameters = array())
{
@@ -405,14 +396,20 @@ class BaseAdminController extends BaseController
/**
* Render the given template, and returns the result as an Http Response.
*
- * @param $templateName the complete template name, with extension
- * @param array $args the template arguments
- * @param int $status http code status
+ * @param string $templateName the complete template name, with extension
+ * @param array $args the template arguments
+ * @param int $status http code status
* @return \Thelia\Core\HttpFoundation\Response
*/
protected function render($templateName, $args = array(), $status = 200)
{
- return Response::create($this->renderRaw($templateName, $args), $status);
+ $response = $this->renderRaw($templateName, $args);
+
+ if (!$response instanceof \Symfony\Component\HttpFoundation\Response) {
+ $response = Response::create($response, $status);
+ }
+
+ return $response;
}
/**
@@ -422,7 +419,7 @@ class BaseAdminController extends BaseController
* @param array $args the template arguments
* @param null $templateDir
*
- * @return \Thelia\Core\HttpFoundation\Response
+ * @return string|\Symfony\Component\HttpFoundation\RedirectResponse
*/
protected function renderRaw($templateName, $args = array(), $templateDir = null)
{
@@ -460,16 +457,17 @@ class BaseAdminController extends BaseController
// Render the template.
try {
- $data = $this->getParser($templateDir)->render($templateName, $args);
+ $content = $this->getParser($templateDir)->render($templateName, $args);
- return $data;
} catch (AuthenticationException $ex) {
// User is not authenticated, and templates requires authentication -> redirect to login page
// We user login_tpl as a path, not a template.
- Redirect::exec(URL::getInstance()->absoluteUrl($ex->getLoginTemplate()));
+ $content = RedirectResponse::create(URL::getInstance()->absoluteUrl($ex->getLoginTemplate()));
} catch (AuthorizationException $ex) {
// User is not allowed to perform the required action. Return the error page instead of the requested page.
- return $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action."), 403);
+ $content = $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action."), 403);
}
+
+ return $content;
}
}
diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php
index 3557c5075..ad5b2bd36 100644
--- a/core/lib/Thelia/Controller/Admin/CategoryController.php
+++ b/core/lib/Thelia/Controller/Admin/CategoryController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php
index 8e4e0d43c..fbd97a283 100644
--- a/core/lib/Thelia/Controller/Admin/ConfigController.php
+++ b/core/lib/Thelia/Controller/Admin/ConfigController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/ConfigStoreController.php b/core/lib/Thelia/Controller/Admin/ConfigStoreController.php
index ff339ded9..e76959864 100644
--- a/core/lib/Thelia/Controller/Admin/ConfigStoreController.php
+++ b/core/lib/Thelia/Controller/Admin/ConfigStoreController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/ConfigurationController.php b/core/lib/Thelia/Controller/Admin/ConfigurationController.php
new file mode 100644
index 000000000..88c828561
--- /dev/null
+++ b/core/lib/Thelia/Controller/Admin/ConfigurationController.php
@@ -0,0 +1,33 @@
+
+ */
+class ConfigurationController extends BaseAdminController
+{
+ public function indexAction()
+ {
+ if (null !== $response = $this->checkAuth([AdminResources::CONFIG], [], [AccessManager::VIEW])) {
+ return $response;
+ }
+
+ return $this->render('configuration');
+ }
+}
diff --git a/core/lib/Thelia/Controller/Admin/ContentController.php b/core/lib/Thelia/Controller/Admin/ContentController.php
index f6fd4b7a1..209d4ea19 100644
--- a/core/lib/Thelia/Controller/Admin/ContentController.php
+++ b/core/lib/Thelia/Controller/Admin/ContentController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/CountryController.php b/core/lib/Thelia/Controller/Admin/CountryController.php
index 43959b909..888e8943a 100644
--- a/core/lib/Thelia/Controller/Admin/CountryController.php
+++ b/core/lib/Thelia/Controller/Admin/CountryController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php
index 62bbff786..16771b78b 100644
--- a/core/lib/Thelia/Controller/Admin/CouponController.php
+++ b/core/lib/Thelia/Controller/Admin/CouponController.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -45,6 +34,7 @@ use Thelia\Log\Tlog;
use Thelia\Model\Coupon;
use Thelia\Model\CouponQuery;
use Thelia\Model\Lang;
+use Thelia\Model\LangQuery;
use Thelia\Tools\I18n;
use Thelia\Tools\Rest\ResponseRest;
@@ -64,54 +54,13 @@ class CouponController extends BaseAdminController
*/
public function browseAction()
{
- $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
-
- $args['urlReadCoupon'] = $this->getRoute(
- 'admin.coupon.read',
- array('couponId' => 0),
- Router::ABSOLUTE_URL
- );
-
- $args['urlEditCoupon'] = $this->getRoute(
- 'admin.coupon.update',
- array('couponId' => 0),
- Router::ABSOLUTE_URL
- );
-
- $args['urlCreateCoupon'] = $this->getRoute(
- 'admin.coupon.create',
- array(),
- Router::ABSOLUTE_URL
- );
-
- return $this->render('coupon-list', $args);
- }
-
- /**
- * Manage Coupons read display
- *
- * @param int $couponId Coupon Id
- *
- * @return \Thelia\Core\HttpFoundation\Response
- */
- public function readAction($couponId)
- {
- $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
-
- $coupon = CouponQuery::create()->findPk($couponId);
-
- if ($coupon === null) {
- return $this->pageNotFound();
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
+ return $response;
}
- $args['couponId'] = $couponId;
- $args['urlEditCoupon'] = $this->getRoute(
- 'admin.coupon.update',
- array('couponId' => $couponId),
- Router::ABSOLUTE_URL
- );
+ $args['coupon_order'] = $this->getListOrderFromSession('coupon', 'coupon_order', 'code');
- return $this->render('coupon-read', $args);
+ return $this->render('coupon-list', $args);
}
/**
@@ -121,24 +70,17 @@ class CouponController extends BaseAdminController
*/
public function createAction()
{
- // Check current user authorization
- $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::CREATE);
- if ($response !== null) {
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::CREATE)) {
return $response;
}
// Parameters given to the template
- $args = array();
+ $args = [];
- $i18n = new I18n();
- /** @var Lang $lang */
- $lang = $this->getSession()->getLang();
$eventToDispatch = TheliaEvents::COUPON_CREATE;
if ($this->getRequest()->isMethod('POST')) {
$this->validateCreateOrUpdateForm(
- $i18n,
- $lang,
$eventToDispatch,
'created',
'creation'
@@ -146,15 +88,14 @@ class CouponController extends BaseAdminController
} else {
// If no input for expirationDate, now + 2 months
$defaultDate = new \DateTime();
- $args['defaultDate'] = $defaultDate->modify('+2 month')
- ->format('Y-m-d');
+ $args['defaultDate'] = $defaultDate->modify('+2 month')->format($this->getDefaultDateFormat());
}
- $args['dateFormat'] = $this->getSession()->getLang()->getDateFormat();
+ $args['dateFormat'] = $this->getDefaultDateFormat();
$args['availableCoupons'] = $this->getAvailableCoupons();
$args['urlAjaxAdminCouponDrawInputs'] = $this->getRoute(
'admin.coupon.draw.inputs.ajax',
- array('couponServiceId' => 'couponServiceId'),
+ ['couponServiceId' => 'couponServiceId'],
Router::ABSOLUTE_URL
);
$args['formAction'] = 'admin/coupon/create';
@@ -174,9 +115,7 @@ class CouponController extends BaseAdminController
*/
public function updateAction($couponId)
{
- // Check current user authorization
- $response = $this->checkAuth(AdminResources::COUPON, array(), AccessManager::UPDATE);
- if ($response !== null) {
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::UPDATE)) {
return $response;
}
@@ -194,18 +133,13 @@ class CouponController extends BaseAdminController
$couponManager = $couponFactory->buildCouponFromModel($coupon);
// Parameters given to the template
- $args = array();
+ $args = [];
- $i18n = new I18n();
- /** @var Lang $lang */
- $lang = $this->getSession()->getLang();
$eventToDispatch = TheliaEvents::COUPON_UPDATE;
// Update
if ($this->getRequest()->isMethod('POST')) {
$this->validateCreateOrUpdateForm(
- $i18n,
- $lang,
$eventToDispatch,
'updated',
'update',
@@ -220,7 +154,7 @@ class CouponController extends BaseAdminController
$coupon->getSerializedConditions()
);
- $data = array(
+ $data = [
'code' => $coupon->getCode(),
'title' => $coupon->getTitle(),
'amount' => $coupon->getAmount(),
@@ -228,14 +162,14 @@ class CouponController extends BaseAdminController
'shortDescription' => $coupon->getShortDescription(),
'description' => $coupon->getDescription(),
'isEnabled' => $coupon->getIsEnabled(),
- 'expirationDate' => $coupon->getExpirationDate('Y-m-d'),
+ 'expirationDate' => $coupon->getExpirationDate($this->getDefaultDateFormat()),
'isAvailableOnSpecialOffers' => $coupon->getIsAvailableOnSpecialOffers(),
'isCumulative' => $coupon->getIsCumulative(),
'isRemovingPostage' => $coupon->getIsRemovingPostage(),
'maxUsage' => $coupon->getMaxUsage(),
'conditions' => $conditions,
'locale' => $this->getCurrentEditionLocale(),
- );
+ ];
$args['conditions'] = $this->cleanConditionForTemplate($conditions);
@@ -245,50 +179,53 @@ class CouponController extends BaseAdminController
// Pass it to the parser
$this->getParserContext()->addForm($changeForm);
}
+
$args['couponCode'] = $coupon->getCode();
$args['availableCoupons'] = $this->getAvailableCoupons();
$args['couponInputsHtml'] = $couponManager->drawBackOfficeInputs();
$args['urlAjaxAdminCouponDrawInputs'] = $this->getRoute(
'admin.coupon.draw.inputs.ajax',
- array('couponServiceId' => 'couponServiceId'),
+ ['couponServiceId' => 'couponServiceId'],
Router::ABSOLUTE_URL
);
$args['availableConditions'] = $this->getAvailableConditions();
$args['urlAjaxGetConditionInputFromServiceId'] = $this->getRoute(
'admin.coupon.draw.condition.read.inputs.ajax',
- array('conditionId' => 'conditionId'),
+ ['conditionId' => 'conditionId'],
Router::ABSOLUTE_URL
);
$args['urlAjaxGetConditionInputFromConditionInterface'] = $this->getRoute(
'admin.coupon.draw.condition.update.inputs.ajax',
- array(
+ [
'couponId' => $couponId,
'conditionIndex' => 8888888
- ),
+ ],
Router::ABSOLUTE_URL
);
$args['urlAjaxSaveConditions'] = $this->getRoute(
'admin.coupon.condition.save',
- array('couponId' => $couponId),
+ ['couponId' => $couponId],
Router::ABSOLUTE_URL
);
$args['urlAjaxDeleteConditions'] = $this->getRoute(
'admin.coupon.condition.delete',
- array(
+ [
'couponId' => $couponId,
'conditionIndex' => 8888888
- ),
+ ],
Router::ABSOLUTE_URL
);
$args['urlAjaxGetConditionSummaries'] = $this->getRoute(
'admin.coupon.draw.condition.summaries.ajax',
- array('couponId' => $couponId),
+ ['couponId' => $couponId],
Router::ABSOLUTE_URL
);
$args['formAction'] = 'admin/coupon/update/' . $couponId;
+ $args['dateFormat'] = $this->getDefaultDateFormat();
+
return $this->render('coupon-update', $args);
}
@@ -301,31 +238,44 @@ class CouponController extends BaseAdminController
*/
public function getConditionEmptyInputAjaxAction($conditionId)
{
- $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
+ return $response;
+ }
$this->checkXmlHttpRequest();
- /** @var ConditionFactory $conditionFactory */
- $conditionFactory = $this->container->get('thelia.condition.factory');
- $inputs = $conditionFactory->getInputsFromServiceId($conditionId);
- if (!$this->container->has($conditionId)) {
- return false;
+ if (! empty($conditionId)) {
+
+ /** @var ConditionFactory $conditionFactory */
+ $conditionFactory = $this->container->get('thelia.condition.factory');
+ $inputs = $conditionFactory->getInputsFromServiceId($conditionId);
+
+ if (!$this->container->has($conditionId)) {
+ return false;
+ }
+
+ if ($inputs === null) {
+ return $this->pageNotFound();
+ }
+
+ /** @var ConditionInterface $condition */
+ $condition = $this->container->get($conditionId);
+
+ $html = $condition->drawBackOfficeInputs();
+ $serviceId = $condition->getServiceId();
}
-
- /** @var ConditionInterface $condition */
- $condition = $this->container->get($conditionId);
-
- if ($inputs === null) {
- return $this->pageNotFound();
+ else {
+ $html = '';
+ $serviceId = '';
}
return $this->render(
'coupon/condition-input-ajax',
- array(
- 'inputsDrawn' => $condition->drawBackOfficeInputs(),
- 'conditionServiceId' => $condition->getServiceId(),
- 'conditionIndex' => -1,
- )
+ [
+ 'inputsDrawn' => $html,
+ 'conditionServiceId' => $serviceId,
+ 'conditionIndex' => ''
+ ]
);
}
@@ -339,7 +289,9 @@ class CouponController extends BaseAdminController
*/
public function getConditionToUpdateInputAjaxAction($couponId, $conditionIndex)
{
- $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
+ return $response;
+ }
$this->checkXmlHttpRequest();
@@ -374,13 +326,11 @@ class CouponController extends BaseAdminController
}
return $this->render(
- 'coupon/condition-input-ajax',
- array(
+ 'coupon/condition-input-ajax', [
'inputsDrawn' => $condition->drawBackOfficeInputs(),
'conditionServiceId' => $condition->getServiceId(),
'conditionIndex' => $conditionIndex,
-
- )
+ ]
);
}
@@ -393,7 +343,9 @@ class CouponController extends BaseAdminController
*/
public function saveConditionsAction($couponId)
{
- $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::UPDATE)) {
+ return $response;
+ }
$this->checkXmlHttpRequest();
@@ -440,7 +392,9 @@ class CouponController extends BaseAdminController
*/
public function deleteConditionsAction($couponId, $conditionIndex)
{
- $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::UPDATE)) {
+ return $response;
+ }
$this->checkXmlHttpRequest();
@@ -468,41 +422,6 @@ class CouponController extends BaseAdminController
return new Response();
}
- /**
- * Build a Coupon from its form
- *
- * @param array $data Form data
- *
- * @return Coupon
- */
- protected function buildCouponFromForm(array $data)
- {
- $couponBeingCreated = new Coupon();
- $couponBeingCreated->setCode($data['code']);
- $couponBeingCreated->setType($data['type']);
- $couponBeingCreated->setTitle($data['title']);
- $couponBeingCreated->setShortDescription($data['shortDescription']);
- $couponBeingCreated->setDescription($data['description']);
- $couponBeingCreated->setAmount($data['amount']);
- $couponBeingCreated->setIsEnabled($data['isEnabled']);
- $couponBeingCreated->setExpirationDate($data['expirationDate']);
- $couponBeingCreated->setSerializedConditions(
- new ConditionCollection(
- array()
- )
- );
- $couponBeingCreated->setIsCumulative($data['isCumulative']);
- $couponBeingCreated->setIsRemovingPostage(
- $data['isRemovingPostage']
- );
- $couponBeingCreated->setMaxUsage($data['maxUsage']);
- $couponBeingCreated->setIsAvailableOnSpecialOffers(
- $data['isAvailableOnSpecialOffers']
- );
-
- return $couponBeingCreated;
- }
-
/**
* Log error message
*
@@ -528,8 +447,6 @@ class CouponController extends BaseAdminController
/**
* Validate the CreateOrUpdate form
*
- * @param I18n $i18n Local code (fr_FR)
- * @param Lang $lang Local variables container
* @param string $eventToDispatch Event which will activate actions
* @param string $log created|edited
* @param string $action creation|edition
@@ -537,15 +454,15 @@ class CouponController extends BaseAdminController
*
* @return $this
*/
- protected function validateCreateOrUpdateForm(I18n $i18n, Lang $lang, $eventToDispatch, $log, $action, Coupon $model = null)
+ protected function validateCreateOrUpdateForm($eventToDispatch, $log, $action, Coupon $model = null)
{
// Create the form from the request
- $creationForm = new CouponCreationForm($this->getRequest());
+ $couponForm = new CouponCreationForm($this->getRequest());
$message = false;
try {
// Check the form against conditions violations
- $form = $this->validateForm($creationForm, 'POST');
+ $form = $this->validateForm($couponForm, 'POST');
$couponEvent = $this->feedCouponCreateOrUpdateEvent($form, $model);
@@ -564,31 +481,39 @@ class CouponController extends BaseAdminController
)
);
- $this->redirect(
- str_replace(
- '{id}',
- $couponEvent->getCouponModel()->getId(),
- $creationForm->getSuccessUrl()
- )
- );
+ if ($this->getRequest()->get('save_mode') == 'stay') {
+ $this->redirect(
+ str_replace(
+ '{id}',
+ $couponEvent->getCouponModel()->getId(),
+ $couponForm->getSuccessUrl()
+ )
+ );
- } catch (FormValidationException $e) {
+ exit();
+ }
+
+ // Redirect to the success URL
+ $this->redirectToRoute('admin.coupon.list');
+
+ } catch (FormValidationException $ex) {
// Invalid data entered
- $message = 'Please check your input:';
+ $message = $this->createStandardFormValidationErrorMessage($ex);
- } catch (\Exception $e) {
+ } catch (\Exception $ex) {
// Any other error
- $message = 'Sorry, an error occurred:';
- $this->logError($action, $message, $e);
+ $message = $this->getTranslator()->trans('Sorry, an error occurred: %err', ['%err' => $ex->getMessage()]);
+
+ $this->logError($action, $message, $ex);
}
if ($message !== false) {
// Mark the form as with error
- $creationForm->setErrorMessage($message);
+ $couponForm->setErrorMessage($message);
// Send the form and the error to the parser
$this->getParserContext()
- ->addForm($creationForm)
+ ->addForm($couponForm)
->setGeneralError($message);
}
@@ -605,10 +530,10 @@ class CouponController extends BaseAdminController
/** @var CouponManager $couponManager */
$couponManager = $this->container->get('thelia.coupon.manager');
$availableConditions = $couponManager->getAvailableConditions();
- $cleanedConditions = array();
+ $cleanedConditions = [];
/** @var ConditionInterface $availableCondition */
foreach ($availableConditions as $availableCondition) {
- $condition = array();
+ $condition = [];
$condition['serviceId'] = $availableCondition->getServiceId();
$condition['name'] = $availableCondition->getName();
$condition['toolTip'] = $availableCondition->getToolTip();
@@ -628,10 +553,10 @@ class CouponController extends BaseAdminController
/** @var CouponManager $couponManager */
$couponManager = $this->container->get('thelia.coupon.manager');
$availableCoupons = $couponManager->getAvailableCoupons();
- $cleanedCoupons = array();
+ $cleanedCoupons = [];
/** @var CouponInterface $availableCoupon */
foreach ($availableCoupons as $availableCoupon) {
- $condition = array();
+ $condition = [];
$condition['serviceId'] = $availableCoupon->getServiceId();
$condition['name'] = $availableCoupon->getName();
$condition['toolTip'] = $availableCoupon->getToolTip();
@@ -651,17 +576,17 @@ class CouponController extends BaseAdminController
*/
protected function cleanConditionForTemplate(ConditionCollection $conditions)
{
- $cleanedConditions = array();
+ $cleanedConditions = [];
/** @var $condition ConditionInterface */
foreach ($conditions as $index => $condition) {
- $temp = array(
+ $temp = [
'serviceId' => $condition->getServiceId(),
'index' => $index,
'name' => $condition->getName(),
'toolTip' => $condition->getToolTip(),
'summary' => $condition->getSummary(),
'validators' => $condition->getValidators()
- );
+ ];
$cleanedConditions[] = $temp;
}
@@ -678,7 +603,10 @@ class CouponController extends BaseAdminController
*/
public function getBackOfficeInputsAjaxAction($couponServiceId)
{
- $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
+ return $response;
+ }
+
$this->checkXmlHttpRequest();
/** @var CouponInterface $coupon */
@@ -703,7 +631,10 @@ class CouponController extends BaseAdminController
*/
public function getBackOfficeConditionSummariesAjaxAction($couponId)
{
- $this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
+ if (null !== $response = $this->checkAuth(AdminResources::COUPON, [], AccessManager::VIEW)) {
+ return $response;
+ }
+
$this->checkXmlHttpRequest();
/** @var Coupon $coupon */
@@ -721,7 +652,7 @@ class CouponController extends BaseAdminController
return $this->pageNotFound();
}
- $args = array();
+ $args = [];
$args['conditions'] = $this->cleanConditionForTemplate($couponManager->getConditions());
return $this->render('coupon/conditions', $args);
@@ -772,7 +703,7 @@ class CouponController extends BaseAdminController
$serviceId = $data['type'];
/** @var CouponInterface $couponManager */
$couponManager = $this->container->get($serviceId);
- $effects = array(CouponAbstract::INPUT_AMOUNT_NAME => $data[CouponAbstract::INPUT_AMOUNT_NAME]);
+ $effects = [CouponAbstract::INPUT_AMOUNT_NAME => $data[CouponAbstract::INPUT_AMOUNT_NAME]];
$effects = $this->addExtendedLogic($effects, $couponManager->getExtendedInputs());
$couponEvent = new CouponCreateOrUpdateEvent(
@@ -783,7 +714,7 @@ class CouponController extends BaseAdminController
$data['shortDescription'],
$data['description'],
$data['isEnabled'],
- \DateTime::createFromFormat('Y-m-d', $data['expirationDate']),
+ \DateTime::createFromFormat($this->getDefaultDateFormat(), $data['expirationDate']),
$data['isAvailableOnSpecialOffers'],
$data['isCumulative'],
$data['isRemovingPostage'],
@@ -809,8 +740,8 @@ class CouponController extends BaseAdminController
$request = $this->getRequest();
$post = $request->request->getIterator();
$serviceId = $request->request->get('categoryCondition');
- $operators = array();
- $values = array();
+ $operators = [];
+ $values = [];
foreach ($post as $key => $input) {
if (isset($input['operator']) && isset($input['value'])) {
$operators[$key] = $input['operator'];
@@ -868,4 +799,8 @@ class CouponController extends BaseAdminController
);
}
+ protected function getDefaultDateFormat()
+ {
+ return LangQuery::create()->findOneByByDefault(true)->getDateFormat();
+ }
}
diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php
index a9212c0d4..158d8f2b5 100644
--- a/core/lib/Thelia/Controller/Admin/CurrencyController.php
+++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php
index cf655a30e..895490cb2 100644
--- a/core/lib/Thelia/Controller/Admin/CustomerController.php
+++ b/core/lib/Thelia/Controller/Admin/CustomerController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -101,6 +90,7 @@ class CustomerController extends AbstractCrudController
'lastname' => $object->getLastname(),
'email' => $object->getEmail(),
'title' => $object->getTitleId(),
+ 'discount' => $object->getDiscount(),
);
if ($address !== null) {
@@ -182,7 +172,6 @@ class CustomerController extends AbstractCrudController
{
return $this->render('customers', array_merge(array(
'customer_order' => $currentOrder,
- 'display_customer' => 20,
'page' => $this->getRequest()->get('page', 1)
), $customParams)
);
diff --git a/core/lib/Thelia/Controller/Admin/CustomerExportController.php b/core/lib/Thelia/Controller/Admin/CustomerExportController.php
new file mode 100644
index 000000000..5e9900dba
--- /dev/null
+++ b/core/lib/Thelia/Controller/Admin/CustomerExportController.php
@@ -0,0 +1,66 @@
+
+ */
+class CustomerExportController extends BaseAdminController
+{
+
+ public function NewsletterExportAction()
+ {
+ if (null !== $response = $this->checkAuth([AdminResources::EXPORT_CUSTOMER_NEWSLETTER], [], [AccessManager::VIEW])) {
+ return $response;
+ }
+
+ $data = NewsletterQuery::create()
+ ->select([
+ 'email',
+ 'firstname',
+ 'lastname',
+ 'locale'
+ ])
+ ->find();
+
+ $handle = fopen('php://memory', 'r+');
+
+ fputcsv($handle, ['email','firstname','lastname','locale'], ';', '"');
+
+ foreach ($data->toArray() as $customer) {
+ fputcsv($handle, $customer, ';', '"');
+ }
+
+ rewind($handle);
+ $content = stream_get_contents($handle);
+ fclose($handle);
+
+ return Response::create(
+ $content,
+ 200,
+ array(
+ "Content-Type"=>"application/csv-tab-delimited-table",
+ "Content-disposition"=>"filename=export_customer_newsletter.csv"
+ )
+ );
+
+ }
+
+}
diff --git a/core/lib/Thelia/Controller/Admin/ExportController.php b/core/lib/Thelia/Controller/Admin/ExportController.php
new file mode 100644
index 000000000..279ed8b4c
--- /dev/null
+++ b/core/lib/Thelia/Controller/Admin/ExportController.php
@@ -0,0 +1,34 @@
+
+ */
+class ExportController extends BaseAdminController
+{
+
+ public function indexAction()
+ {
+ if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::VIEW])) {
+ return $response;
+ }
+
+ return $this->render('export');
+ }
+}
diff --git a/core/lib/Thelia/Controller/Admin/FeatureAvController.php b/core/lib/Thelia/Controller/Admin/FeatureAvController.php
index 9eea87b32..22dbbedcd 100644
--- a/core/lib/Thelia/Controller/Admin/FeatureAvController.php
+++ b/core/lib/Thelia/Controller/Admin/FeatureAvController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/FeatureController.php b/core/lib/Thelia/Controller/Admin/FeatureController.php
index 1a149e248..a923e0803 100644
--- a/core/lib/Thelia/Controller/Admin/FeatureController.php
+++ b/core/lib/Thelia/Controller/Admin/FeatureController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/FileController.php b/core/lib/Thelia/Controller/Admin/FileController.php
index 4e8fb6403..8494d833a 100644
--- a/core/lib/Thelia/Controller/Admin/FileController.php
+++ b/core/lib/Thelia/Controller/Admin/FileController.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -88,8 +77,8 @@ class FileController extends BaseAdminController
$message = $this->getTranslator()
->trans(
'File is too heavy, please retry with a file having a size less than %size%.',
- array('%size%' => ini_get('post_max_size')),
- 'image'
+ array('%size%' => ini_get('upload_max_filesize')),
+ 'core'
);
return new ResponseRest($message, 'text', 403);
diff --git a/core/lib/Thelia/Controller/Admin/FolderController.php b/core/lib/Thelia/Controller/Admin/FolderController.php
index 9ae826173..a4d64ebfe 100644
--- a/core/lib/Thelia/Controller/Admin/FolderController.php
+++ b/core/lib/Thelia/Controller/Admin/FolderController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/HomeController.php b/core/lib/Thelia/Controller/Admin/HomeController.php
index d4458843d..d30d8000c 100644
--- a/core/lib/Thelia/Controller/Admin/HomeController.php
+++ b/core/lib/Thelia/Controller/Admin/HomeController.php
@@ -1,28 +1,18 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
+use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\AccessManager;
use Thelia\Model\CustomerQuery;
use Thelia\Model\OrderQuery;
@@ -39,13 +29,33 @@ class HomeController extends BaseAdminController
return $this->render('home');
}
+ /**
+ * Get the latest available Thelia version from the Thelia web site.
+ *
+ * @return Thelia\Core\HttpFoundation\Response the response
+ */
+ public function getLatestTheliaVersion()
+ {
+ if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
+
+ // get the latest version
+ $version = @file_get_contents("http://thelia.net/version.php");
+
+ if ($version === false)
+ $version = $this->getTranslator()->trans("Not found");
+ else if (! preg_match("/^[0-9.]*$/", $version))
+ $version = $this->getTranslator()->trans("Unavailable");
+
+ return Response::create($version);
+ }
+
public function loadStatsAjaxAction()
{
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
$data = new \stdClass();
- $data->title = "Stats on " . $this->getRequest()->query->get('month', date('m')) . "/" . $this->getRequest()->query->get('year', date('Y'));
+ $data->title = $this->getTranslator()->trans("Stats on %month/%year", array('%month' => $this->getRequest()->query->get('month', date('m')), '%year' => $this->getRequest()->query->get('year', date('Y'))));
/* sales */
$saleSeries = new \stdClass();
diff --git a/core/lib/Thelia/Controller/Admin/LangController.php b/core/lib/Thelia/Controller/Admin/LangController.php
index 543f09047..a3957b6e0 100644
--- a/core/lib/Thelia/Controller/Admin/LangController.php
+++ b/core/lib/Thelia/Controller/Admin/LangController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -85,7 +74,10 @@ class LangController extends BaseAdminController
'code' => $lang->getCode(),
'locale' => $lang->getLocale(),
'date_format' => $lang->getDateFormat(),
- 'time_format' => $lang->getTimeFormat()
+ 'time_format' => $lang->getTimeFormat(),
+ 'decimal_separator' => $lang->getDecimalSeparator(),
+ 'thousands_separator' => $lang->getThousandsSeparator(),
+ 'decimals' => $lang->getDecimals(),
));
$this->getParserContext()->addForm($langForm);
@@ -135,6 +127,9 @@ class LangController extends BaseAdminController
->setLocale($form->get('locale')->getData())
->setDateFormat($form->get('date_format')->getData())
->setTimeFormat($form->get('time_format')->getData())
+ ->setDecimalSeparator($form->get('decimal_separator')->getData())
+ ->setThousandsSeparator($form->get('thousands_separator')->getData())
+ ->setDecimals($form->get('decimals')->getData())
;
}
diff --git a/core/lib/Thelia/Controller/Admin/LanguageController.php b/core/lib/Thelia/Controller/Admin/LanguageController.php
index b91124277..f9c8ef865 100644
--- a/core/lib/Thelia/Controller/Admin/LanguageController.php
+++ b/core/lib/Thelia/Controller/Admin/LanguageController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/MailingSystemController.php b/core/lib/Thelia/Controller/Admin/MailingSystemController.php
index 1fe79c353..420cfada8 100644
--- a/core/lib/Thelia/Controller/Admin/MailingSystemController.php
+++ b/core/lib/Thelia/Controller/Admin/MailingSystemController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php
index e6b50c96d..80a1dd669 100644
--- a/core/lib/Thelia/Controller/Admin/MessageController.php
+++ b/core/lib/Thelia/Controller/Admin/MessageController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/ModuleController.php b/core/lib/Thelia/Controller/Admin/ModuleController.php
index 2eedc8f44..d9225b01b 100644
--- a/core/lib/Thelia/Controller/Admin/ModuleController.php
+++ b/core/lib/Thelia/Controller/Admin/ModuleController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/OrderController.php b/core/lib/Thelia/Controller/Admin/OrderController.php
index b532ae102..4c1c48b5b 100644
--- a/core/lib/Thelia/Controller/Admin/OrderController.php
+++ b/core/lib/Thelia/Controller/Admin/OrderController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php
index 38cd917ea..7ca94d73f 100644
--- a/core/lib/Thelia/Controller/Admin/ProductController.php
+++ b/core/lib/Thelia/Controller/Admin/ProductController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -73,6 +62,7 @@ use Thelia\Form\ProductSaleElementUpdateForm;
use Thelia\Form\ProductDefaultSaleElementUpdateForm;
use Thelia\Form\ProductCombinationGenerationForm;
+use Thelia\Model\TaxRuleQuery;
use Thelia\TaxEngine\Calculator;
use Thelia\Tools\NumberFormat;
@@ -1155,10 +1145,10 @@ class ProductController extends AbstractSeoCrudController
{
$return_price = 0;
- $price = floatval($this->getRequest()->get('price', 0));
- $product_id = intval($this->getRequest()->get('product_id', 0));
- $action = $this->getRequest()->get('action', ''); // With ot without tax
- $convert = intval($this->getRequest()->get('convert_from_default_currency', 0));
+ $price = floatval($this->getRequest()->query->get('price', 0));
+ $product_id = intval($this->getRequest()->query->get('product_id', 0));
+ $action = $this->getRequest()->query->get('action', ''); // With ot without tax
+ $convert = intval($this->getRequest()->query->get('convert_from_default_currency', 0));
if (null !== $product = ProductQuery::create()->findPk($product_id)) {
@@ -1171,7 +1161,46 @@ class ProductController extends AbstractSeoCrudController
}
if ($convert != 0) {
- $return_price = $prix * Currency::getDefaultCurrency()->getRate();
+ $return_price = $price * Currency::getDefaultCurrency()->getRate();
+ }
+ }
+
+ return new JsonResponse(array('result' => $return_price));
+ }
+
+ /**
+ *
+ * Calculate tax or untax price for a non existing product.
+ *
+ * For an existing product, use self::priceCaclulator
+ *
+ * @return JsonResponse
+ */
+ public function calculatePrice()
+ {
+ $return_price = 0;
+
+ $price = floatval($this->getRequest()->query->get('price'));
+ $tax_rule_id = intval($this->getRequest()->query->get('tax_rule'));
+ $action = $this->getRequest()->query->get('action'); // With ot without tax
+
+ $taxRule = TaxRuleQuery::create()->findPk($tax_rule_id);
+
+ if (null !== $price && null !== $taxRule) {
+
+ $calculator = new Calculator();
+
+ $calculator->loadTaxRuleWithoutProduct(
+ $taxRule,
+ Country::getShopLocation()
+ );
+
+ if ($action == 'to_tax') {
+ $return_price = $calculator->getTaxedPrice($price);
+ } elseif ($action == 'from_tax') {
+ $return_price = $calculator->getUntaxedPrice($price);
+ } else {
+ $return_price = $price;
}
}
@@ -1251,7 +1280,7 @@ class ProductController extends AbstractSeoCrudController
}
if ($convert != 0) {
- $return_price = $prix * Currency::getDefaultCurrency()->getRate();
+ $return_price = $price * Currency::getDefaultCurrency()->getRate();
}
// Format the number using '.', to perform further calculation
diff --git a/core/lib/Thelia/Controller/Admin/ProfileController.php b/core/lib/Thelia/Controller/Admin/ProfileController.php
index 22794789f..261376f21 100644
--- a/core/lib/Thelia/Controller/Admin/ProfileController.php
+++ b/core/lib/Thelia/Controller/Admin/ProfileController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/SessionController.php b/core/lib/Thelia/Controller/Admin/SessionController.php
index b896e9a7b..07e716354 100644
--- a/core/lib/Thelia/Controller/Admin/SessionController.php
+++ b/core/lib/Thelia/Controller/Admin/SessionController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/ShippingZoneController.php b/core/lib/Thelia/Controller/Admin/ShippingZoneController.php
index 82b630398..b0de2b79a 100644
--- a/core/lib/Thelia/Controller/Admin/ShippingZoneController.php
+++ b/core/lib/Thelia/Controller/Admin/ShippingZoneController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
@@ -46,11 +35,11 @@ class ShippingZoneController extends BaseAdminController
return $this->render("shipping-zones", array("display_shipping_zone" => 20));
}
- public function updateAction($shipping_zones_id)
+ public function updateAction($delivery_module_id)
{
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, array(), AccessManager::VIEW)) return $response;
return $this->render("shipping-zones-edit", array(
- "shipping_zones_id" => $shipping_zones_id
+ "delivery_module_id" => $delivery_module_id
));
}
@@ -133,13 +122,13 @@ class ShippingZoneController extends BaseAdminController
protected function renderEditionTemplate()
{
return $this->render("shipping-zones-edit", array(
- "shipping_zones_id" => $this->getShippingZoneId()
+ "delivery_module_id" => $this->getDeliveryModuleId()
));
}
- protected function getShippingZoneId()
+ protected function getDeliveryModuleId()
{
- return $this->getRequest()->get('shipping_zone_id', 0);
+ return $this->getRequest()->get('delivery_module_id', 0);
}
}
diff --git a/core/lib/Thelia/Controller/Admin/SystemLogController.php b/core/lib/Thelia/Controller/Admin/SystemLogController.php
index 37d27a7be..9dc45f3c9 100644
--- a/core/lib/Thelia/Controller/Admin/SystemLogController.php
+++ b/core/lib/Thelia/Controller/Admin/SystemLogController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/TaxController.php b/core/lib/Thelia/Controller/Admin/TaxController.php
index e89ffba9c..19670b15b 100644
--- a/core/lib/Thelia/Controller/Admin/TaxController.php
+++ b/core/lib/Thelia/Controller/Admin/TaxController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/TaxRuleController.php b/core/lib/Thelia/Controller/Admin/TaxRuleController.php
index 5ae75c8ec..dbbbd3eb8 100644
--- a/core/lib/Thelia/Controller/Admin/TaxRuleController.php
+++ b/core/lib/Thelia/Controller/Admin/TaxRuleController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/TemplateController.php b/core/lib/Thelia/Controller/Admin/TemplateController.php
index bd2d9bf9c..82f22f241 100644
--- a/core/lib/Thelia/Controller/Admin/TemplateController.php
+++ b/core/lib/Thelia/Controller/Admin/TemplateController.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
diff --git a/core/lib/Thelia/Controller/Admin/ToolsController.php b/core/lib/Thelia/Controller/Admin/ToolsController.php
new file mode 100644
index 000000000..9d19cccd9
--- /dev/null
+++ b/core/lib/Thelia/Controller/Admin/ToolsController.php
@@ -0,0 +1,33 @@
+
+ */
+class ToolsController extends BaseAdminController
+{
+ public function indexAction()
+ {
+ if (null !== $response = $this->checkAuth([AdminResources::TOOLS], [], [AccessManager::VIEW])) {
+ return $response;
+ }
+
+ return $this->render('tools');
+ }
+}
diff --git a/core/lib/Thelia/Controller/Admin/TranslationsController.php b/core/lib/Thelia/Controller/Admin/TranslationsController.php
index 453e32485..93aab31cb 100644
--- a/core/lib/Thelia/Controller/Admin/TranslationsController.php
+++ b/core/lib/Thelia/Controller/Admin/TranslationsController.php
@@ -1,30 +1,22 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
+use Symfony\Component\Finder\Finder;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
+use Thelia\Core\Translation\Translator;
+use Thelia\Model\Module;
use Thelia\Model\ModuleQuery;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Core\Template\TemplateDefinition;
@@ -36,13 +28,47 @@ use Thelia\Tools\URL;
*/
class TranslationsController extends BaseAdminController
{
+ /**
+ * @param string $item_name the modume code
+ * @return Module the module object
+ * @throws \InvalidArgumentException if module was not found
+ */
+ protected function getModule($item_name)
+ {
+ if (null !== $module = ModuleQuery::create()->findPk($item_name))
+ return $module;
+
+ throw new \InvalidArgumentException(
+ $this->getTranslator()->trans("No module found for code '%item'", ['%item' => $item_name])
+ );
+ }
+
+ protected function getModuleTemplateNames(Module $module, $template_type)
+ {
+ $templates =
+ TemplateHelper::getInstance()->getList(
+ $template_type,
+ $module->getAbsoluteTemplateBasePath()
+ );
+
+ $names = [];
+
+ foreach($templates as $template) $names[] = $template->getName();
+
+ return $names;
+ }
+
protected function renderTemplate()
{
-
// Get related strings, if all input data are here
$item_to_translate = $this->getRequest()->get('item_to_translate');
- $item_id = $this->getRequest()->get('item_id', '');
+ $item_name = $this->getRequest()->get('item_name', '');
+
+ if ($item_to_translate == 'mo' && ! empty($item_name))
+ $module_part = $this->getRequest()->get('module_part', '');
+ else
+ $module_part = false;
$all_strings = array();
@@ -52,55 +78,134 @@ class TranslationsController extends BaseAdminController
$templateArguments = array(
'item_to_translate' => $item_to_translate,
- 'item_id' => $item_id,
+ 'item_name' => $item_name,
+ 'module_part' => $module_part,
'view_missing_traductions_only' => $this->getRequest()->get('view_missing_traductions_only', 0),
'max_input_vars_warning' => false,
);
// Find the i18n directory, and the directory to examine.
- if (! empty($item_id) || $item_to_translate == 'co') {
+ if (! empty($item_name) || $item_to_translate == 'co') {
switch ($item_to_translate) {
+ // Module core
case 'mo' :
- if (null !== $module = ModuleQuery::create()->findPk($item_id)) {
+ $module = $this->getModule($item_name);
+
+ if ($module_part == 'core') {
$directory = $module->getAbsoluteBaseDir();
+ $domain = $module->getTranslationDomain();
$i18n_directory = $module->getAbsoluteI18nPath();
$walkMode = TemplateHelper::WALK_MODE_PHP;
+ } elseif ($module_part == 'admin-includes') {
+ $directory = $module->getAbsoluteAdminIncludesPath();
+ $domain = $module->getAdminIncludesTranslationDomain();
+ $i18n_directory = $module->getAbsoluteAdminIncludesI18nPath();
+ $walkMode = TemplateHelper::WALK_MODE_TEMPLATE;
+ } elseif (! empty($module_part)) {
+ // Front or back office template, form of $module_part is [bo|fo].subdir-name
+ list($type, $subdir) = explode('.', $module_part);
+
+ if ($type == 'bo') {
+ $directory = $module->getAbsoluteBackOfficeTemplatePath($subdir);
+ $domain = $module->getBackOfficeTemplateTranslationDomain($subdir);
+ $i18n_directory = $module->getAbsoluteBackOfficeI18nTemplatePath($subdir);
+ } elseif ($type == 'fo') {
+ $directory = $module->getAbsoluteFrontOfficeTemplatePath($subdir);
+ $domain = $module->getFrontOfficeTemplateTranslationDomain($subdir);
+ $i18n_directory = $module->getAbsoluteFrontOfficeI18nTemplatePath($subdir);
+ } else {
+ throw new \InvalidArgumentException("Undefined module template type: '$type'.");
+ }
+
+ $walkMode = TemplateHelper::WALK_MODE_TEMPLATE;
}
+
+ // If the module is not active, load the translation file,
+ // as it is not already loaded in Thelia.php
+ if (! empty ($domain) && ! $module->getActivate()) {
+ $this->loadTranslation($i18n_directory, $domain);
+ }
+
+ // List front and back office templates defined by this module
+ $templateArguments['back_office_templates'] =
+ implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::BACK_OFFICE));
+
+ $templateArguments['front_office_templates'] =
+ implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::FRONT_OFFICE));
+
+ // Check if we have admin-include files
+ try {
+ $finder = Finder::create()
+ ->files()
+ ->depth(0)
+ ->in($module->getAbsoluteAdminIncludesPath())
+ ->name('/\.html$/i')
+ ;
+
+ $hasAdminIncludes = $finder->count() > 0;
+ } catch (\InvalidArgumentException $ex) {
+ $hasAdminIncludes = false;
+ }
+
+ $templateArguments['has_admin_includes'] = $hasAdminIncludes;
+
break;
+ // Thelia Core
case 'co' :
$directory = THELIA_ROOT . 'core/lib/Thelia';
+ $domain = 'core';
$i18n_directory = THELIA_ROOT . 'core/lib/Thelia/Config/I18n';
$walkMode = TemplateHelper::WALK_MODE_PHP;
break;
+ // Front-office template
case 'fo' :
- $template = new TemplateDefinition($item_id, TemplateDefinition::FRONT_OFFICE);
+ $template = new TemplateDefinition($item_name, TemplateDefinition::FRONT_OFFICE);
break;
+ // Back-office template
case 'bo' :
- $template = new TemplateDefinition($item_id, TemplateDefinition::BACK_OFFICE);
+ $template = new TemplateDefinition($item_name, TemplateDefinition::BACK_OFFICE);
break;
+ // PDF templates
case 'pf' :
- $template = new TemplateDefinition($item_id, TemplateDefinition::PDF);
+ $template = new TemplateDefinition($item_name, TemplateDefinition::PDF);
break;
+ // Email templates
case 'ma' :
- $template = new TemplateDefinition($item_id, TemplateDefinition::EMAIL);
+ $template = new TemplateDefinition($item_name, TemplateDefinition::EMAIL);
break;
+
+ default:
+ /*
+ throw new \InvalidArgumentException(
+ $this->getTranslator()->trans("Undefined translation type: %item", ['%item' => $item_to_translate])
+ );
+ */
}
if ($template) {
$directory = $template->getAbsolutePath();
+
$i18n_directory = $template->getAbsoluteI18nPath();
+
+ $domain = $template->getTranslationDomain();
+
+ // Load translations files is this template is not the current template
+ // as it is not loaded in Thelia.php
+ if (! TemplateHelper::getInstance()->isActive($template)) {
+ $this->loadTranslation($i18n_directory, $domain);
+ }
}
// Load strings to translate
- if ($directory) {
+ if ($directory && ! empty($domain)) {
// Save the string set, if the form was submitted
if ($i18n_directory) {
@@ -113,11 +218,11 @@ class TranslationsController extends BaseAdminController
if (! empty($texts)) {
- $file = sprintf("%s/%s.php", $i18n_directory, $this->getCurrentEditionLocale());
+ $file = sprintf("%s".DS."%s.php", $i18n_directory, $this->getCurrentEditionLocale());
$translations = $this->getRequest()->get('translation', array());
- TemplateHelper::getInstance()->writeTranslation($file, $texts, $translations);
+ TemplateHelper::getInstance()->writeTranslation($file, $texts, $translations, true);
if ($save_mode == 'stay')
$this->redirectToRoute("admin.configuration.translations", $templateArguments);
@@ -133,6 +238,7 @@ class TranslationsController extends BaseAdminController
$walkMode,
$this->getTranslator(),
$this->getCurrentEditionLocale(),
+ $domain,
$all_strings
);
@@ -163,4 +269,24 @@ class TranslationsController extends BaseAdminController
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response;
return $this->renderTemplate();
}
+
+ private function loadTranslation($directory, $domain)
+ {
+ try {
+ $finder = Finder::create()
+ ->files()
+ ->depth(0)
+ ->in($directory);
+
+ /** @var \DirectoryIterator $file */
+ foreach ($finder as $file) {
+ list($locale, $format) = explode('.', $file->getBaseName(), 2);
+
+ Translator::getInstance()->addResource($format, $file->getPathname(), $locale, $domain);
+ }
+ } catch (\InvalidArgumentException $ex) {
+ // Ignore missing I18n directories
+ }
+ }
+
}
diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php
index e8243d0e4..162b5a814 100644
--- a/core/lib/Thelia/Controller/BaseController.php
+++ b/core/lib/Thelia/Controller/BaseController.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Controller;
use Thelia\Core\Event\PdfEvent;
diff --git a/core/lib/Thelia/Controller/Front/BaseFrontController.php b/core/lib/Thelia/Controller/Front/BaseFrontController.php
index 00ac8143d..e9bc4754b 100644
--- a/core/lib/Thelia/Controller/Front/BaseFrontController.php
+++ b/core/lib/Thelia/Controller/Front/BaseFrontController.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Controller\Front;
use Symfony\Component\Routing\Router;
@@ -48,13 +38,13 @@ class BaseFrontController extends BaseController
/**
* Redirect to à route ID related URL
*
- * @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
- * @param array|\Thelia\Controller\Front\unknown $urlParameters the URL parametrs, as a var/value pair array
- * @param bool $referenceType
+ * @param string $routeId the route ID, as found in Config/Resources/routing/admin.xml
+ * @param array $urlParameters the URL parametrs, as a var/value pair array
+ * @param bool $referenceType
*/
- public function redirectToRoute($routeId, $urlParameters = array(), $referenceType = Router::ABSOLUTE_PATH)
+ public function redirectToRoute($routeId, array $urlParameters = [], array $routeParameters = [], $referenceType = Router::ABSOLUTE_PATH)
{
- $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, array(), $referenceType), $urlParameters));
+ $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, $routeParameters, $referenceType), $urlParameters));
}
public function checkAuth()
@@ -104,9 +94,9 @@ class BaseFrontController extends BaseController
/**
* Render the given template, and returns the result as an Http Response.
*
- * @param $templateName the complete template name, with extension
- * @param array $args the template arguments
- * @param int $status http code status
+ * @param string $templateName the complete template name, with extension
+ * @param array $args the template arguments
+ * @param int $status http code status
* @return \Thelia\Core\HttpFoundation\Response
*/
protected function render($templateName, $args = array(), $status = 200)
diff --git a/core/lib/Thelia/Controller/Front/DefaultController.php b/core/lib/Thelia/Controller/Front/DefaultController.php
index bd2b31fa5..a7ec4d999 100644
--- a/core/lib/Thelia/Controller/Front/DefaultController.php
+++ b/core/lib/Thelia/Controller/Front/DefaultController.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Controller\Front;
use Symfony\Component\HttpFoundation\Request;
diff --git a/core/lib/Thelia/Core/Application.php b/core/lib/Thelia/Core/Application.php
index bb0eec79a..be0e5c6e5 100644
--- a/core/lib/Thelia/Core/Application.php
+++ b/core/lib/Thelia/Core/Application.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core;
diff --git a/core/lib/Thelia/Core/Bundle/TheliaBundle.php b/core/lib/Thelia/Core/Bundle/TheliaBundle.php
index 4678bae88..bb476c402 100644
--- a/core/lib/Thelia/Core/Bundle/TheliaBundle.php
+++ b/core/lib/Thelia/Core/Bundle/TheliaBundle.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Bundle;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
diff --git a/core/lib/Thelia/Core/Controller/ControllerResolver.php b/core/lib/Thelia/Core/Controller/ControllerResolver.php
index c58961ebe..8a6174fd5 100644
--- a/core/lib/Thelia/Core/Controller/ControllerResolver.php
+++ b/core/lib/Thelia/Core/Controller/ControllerResolver.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Controller;
diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponConditionPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponConditionPass.php
index 127d0e334..123a881b2 100644
--- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponConditionPass.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponConditionPass.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Core\DependencyInjection\Compiler;
diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponPass.php
index a499c8ed1..3da3a293d 100644
--- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponPass.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponPass.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Core\DependencyInjection\Compiler;
diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php
index 08fcd777b..5bfdca4de 100644
--- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\DependencyInjection\Compiler;
diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php
index 71d96ca40..621f5a7e0 100644
--- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\DependencyInjection\Compiler;
diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php
index 845a659d2..ccb52f9ee 100644
--- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php
index 43f84ebd5..9e53540e6 100644
--- a/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\DependencyInjection\Compiler;
diff --git a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php
index 294c9b671..a8808372d 100644
--- a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\DependencyInjection\Loader;
diff --git a/core/lib/Thelia/Core/Event/AccessoryEvent.php b/core/lib/Thelia/Core/Event/AccessoryEvent.php
index afb0a9861..b47369526 100644
--- a/core/lib/Thelia/Core/Event/AccessoryEvent.php
+++ b/core/lib/Thelia/Core/Event/AccessoryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/ActionEvent.php b/core/lib/Thelia/Core/Event/ActionEvent.php
index 41886fd82..3fefb3cd0 100644
--- a/core/lib/Thelia/Core/Event/ActionEvent.php
+++ b/core/lib/Thelia/Core/Event/ActionEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php
index 15ef944d7..08e05bf31 100644
--- a/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Address;
diff --git a/core/lib/Thelia/Core/Event/Address/AddressEvent.php b/core/lib/Thelia/Core/Event/Address/AddressEvent.php
index 2ef553326..c4d6f4c24 100644
--- a/core/lib/Thelia/Core/Event/Address/AddressEvent.php
+++ b/core/lib/Thelia/Core/Event/Address/AddressEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Address;
diff --git a/core/lib/Thelia/Core/Event/Administrator/AdministratorEvent.php b/core/lib/Thelia/Core/Event/Administrator/AdministratorEvent.php
index 54716aada..23faa0187 100644
--- a/core/lib/Thelia/Core/Event/Administrator/AdministratorEvent.php
+++ b/core/lib/Thelia/Core/Event/Administrator/AdministratorEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Administrator;
diff --git a/core/lib/Thelia/Core/Event/Administrator/AdministratorUpdatePasswordEvent.php b/core/lib/Thelia/Core/Event/Administrator/AdministratorUpdatePasswordEvent.php
index 5c310d7cb..081c87d91 100644
--- a/core/lib/Thelia/Core/Event/Administrator/AdministratorUpdatePasswordEvent.php
+++ b/core/lib/Thelia/Core/Event/Administrator/AdministratorUpdatePasswordEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Administrator;
diff --git a/core/lib/Thelia/Core/Event/Area/AreaAddCountryEvent.php b/core/lib/Thelia/Core/Event/Area/AreaAddCountryEvent.php
index 5c98c071c..29d71897b 100644
--- a/core/lib/Thelia/Core/Event/Area/AreaAddCountryEvent.php
+++ b/core/lib/Thelia/Core/Event/Area/AreaAddCountryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Area;
diff --git a/core/lib/Thelia/Core/Event/Area/AreaCreateEvent.php b/core/lib/Thelia/Core/Event/Area/AreaCreateEvent.php
index d833b4128..636208317 100644
--- a/core/lib/Thelia/Core/Event/Area/AreaCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Area/AreaCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Area;
diff --git a/core/lib/Thelia/Core/Event/Area/AreaDeleteEvent.php b/core/lib/Thelia/Core/Event/Area/AreaDeleteEvent.php
index 2a83c98a4..f06143bb1 100644
--- a/core/lib/Thelia/Core/Event/Area/AreaDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Area/AreaDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Area;
diff --git a/core/lib/Thelia/Core/Event/Area/AreaEvent.php b/core/lib/Thelia/Core/Event/Area/AreaEvent.php
index 6c951335a..be4919a18 100644
--- a/core/lib/Thelia/Core/Event/Area/AreaEvent.php
+++ b/core/lib/Thelia/Core/Event/Area/AreaEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Area;
diff --git a/core/lib/Thelia/Core/Event/Area/AreaRemoveCountryEvent.php b/core/lib/Thelia/Core/Event/Area/AreaRemoveCountryEvent.php
index 92cfd57d3..8cfa11b4e 100644
--- a/core/lib/Thelia/Core/Event/Area/AreaRemoveCountryEvent.php
+++ b/core/lib/Thelia/Core/Event/Area/AreaRemoveCountryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Area;
diff --git a/core/lib/Thelia/Core/Event/Area/AreaUpdateEvent.php b/core/lib/Thelia/Core/Event/Area/AreaUpdateEvent.php
index 361607f42..f9b6cb89f 100644
--- a/core/lib/Thelia/Core/Event/Area/AreaUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Area/AreaUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Area;
diff --git a/core/lib/Thelia/Core/Event/Area/AreaUpdatePostageEvent.php b/core/lib/Thelia/Core/Event/Area/AreaUpdatePostageEvent.php
index b9cb825c4..c3181467b 100644
--- a/core/lib/Thelia/Core/Event/Area/AreaUpdatePostageEvent.php
+++ b/core/lib/Thelia/Core/Event/Area/AreaUpdatePostageEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Area;
diff --git a/core/lib/Thelia/Core/Event/Attribute/AttributeAvCreateEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeAvCreateEvent.php
index d61299142..4481f19ff 100644
--- a/core/lib/Thelia/Core/Event/Attribute/AttributeAvCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Attribute/AttributeAvCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Attribute;
diff --git a/core/lib/Thelia/Core/Event/Attribute/AttributeAvDeleteEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeAvDeleteEvent.php
index 574446f80..6dc341e72 100644
--- a/core/lib/Thelia/Core/Event/Attribute/AttributeAvDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Attribute/AttributeAvDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Attribute;
diff --git a/core/lib/Thelia/Core/Event/Attribute/AttributeAvEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeAvEvent.php
index 3dcf1e889..8779f833e 100644
--- a/core/lib/Thelia/Core/Event/Attribute/AttributeAvEvent.php
+++ b/core/lib/Thelia/Core/Event/Attribute/AttributeAvEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Attribute;
diff --git a/core/lib/Thelia/Core/Event/Attribute/AttributeAvUpdateEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeAvUpdateEvent.php
index 70f85e1e5..4a4cecfb6 100644
--- a/core/lib/Thelia/Core/Event/Attribute/AttributeAvUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Attribute/AttributeAvUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Attribute;
diff --git a/core/lib/Thelia/Core/Event/Attribute/AttributeCreateEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeCreateEvent.php
index cbbab5f1a..ad3b420c4 100644
--- a/core/lib/Thelia/Core/Event/Attribute/AttributeCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Attribute/AttributeCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Attribute;
diff --git a/core/lib/Thelia/Core/Event/Attribute/AttributeDeleteEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeDeleteEvent.php
index 30b1e8941..00cabb939 100644
--- a/core/lib/Thelia/Core/Event/Attribute/AttributeDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Attribute/AttributeDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Attribute;
diff --git a/core/lib/Thelia/Core/Event/Attribute/AttributeEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeEvent.php
index 471505270..ce4dfb070 100644
--- a/core/lib/Thelia/Core/Event/Attribute/AttributeEvent.php
+++ b/core/lib/Thelia/Core/Event/Attribute/AttributeEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Attribute;
diff --git a/core/lib/Thelia/Core/Event/Attribute/AttributeUpdateEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeUpdateEvent.php
index 636cf6784..41089e203 100644
--- a/core/lib/Thelia/Core/Event/Attribute/AttributeUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Attribute/AttributeUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Attribute;
diff --git a/core/lib/Thelia/Core/Event/Cache/CacheEvent.php b/core/lib/Thelia/Core/Event/Cache/CacheEvent.php
index 7b21db53d..f4b821a8c 100644
--- a/core/lib/Thelia/Core/Event/Cache/CacheEvent.php
+++ b/core/lib/Thelia/Core/Event/Cache/CacheEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Cache;
diff --git a/core/lib/Thelia/Core/Event/CachedFileEvent.php b/core/lib/Thelia/Core/Event/CachedFileEvent.php
index 8f3a026d9..fc7f52c15 100644
--- a/core/lib/Thelia/Core/Event/CachedFileEvent.php
+++ b/core/lib/Thelia/Core/Event/CachedFileEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/Cart/CartEvent.php b/core/lib/Thelia/Core/Event/Cart/CartEvent.php
index d7b8705be..1c719c0ae 100644
--- a/core/lib/Thelia/Core/Event/Cart/CartEvent.php
+++ b/core/lib/Thelia/Core/Event/Cart/CartEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Cart;
diff --git a/core/lib/Thelia/Core/Event/Cart/CartItemDuplicationItem.php b/core/lib/Thelia/Core/Event/Cart/CartItemDuplicationItem.php
new file mode 100644
index 000000000..c33a484d7
--- /dev/null
+++ b/core/lib/Thelia/Core/Event/Cart/CartItemDuplicationItem.php
@@ -0,0 +1,57 @@
+
+ */
+class CartItemDuplicationItem extends ActionEvent
+{
+ /**
+ * @var \Thelia\Model\CartItem
+ */
+ protected $oldItem;
+
+ /**
+ * @var \Thelia\Model\CartItem
+ */
+ protected $newItem;
+
+ public function __construct(CartItem $newItem, CartItem $oldItem)
+ {
+ $this->newItem = $newItem;
+ $this->oldItem = $oldItem;
+ }
+
+ /**
+ * @return \Thelia\Model\CartItem
+ */
+ public function getNewItem()
+ {
+ return $this->newItem;
+ }
+
+ /**
+ * @return \Thelia\Model\CartItem
+ */
+ public function getOldItem()
+ {
+ return $this->oldItem;
+ }
+
+}
diff --git a/core/lib/Thelia/Core/Event/Cart/CartItemEvent.php b/core/lib/Thelia/Core/Event/Cart/CartItemEvent.php
index 83cbd17c0..f6222659e 100644
--- a/core/lib/Thelia/Core/Event/Cart/CartItemEvent.php
+++ b/core/lib/Thelia/Core/Event/Cart/CartItemEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Cart;
diff --git a/core/lib/Thelia/Core/Event/Category/CategoryAddContentEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryAddContentEvent.php
index 87b912f99..92085affc 100644
--- a/core/lib/Thelia/Core/Event/Category/CategoryAddContentEvent.php
+++ b/core/lib/Thelia/Core/Event/Category/CategoryAddContentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Category;
diff --git a/core/lib/Thelia/Core/Event/Category/CategoryAssociatedContentEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryAssociatedContentEvent.php
index 6593419ef..6efd75173 100644
--- a/core/lib/Thelia/Core/Event/Category/CategoryAssociatedContentEvent.php
+++ b/core/lib/Thelia/Core/Event/Category/CategoryAssociatedContentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Category;
diff --git a/core/lib/Thelia/Core/Event/Category/CategoryCreateEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryCreateEvent.php
index d574c8cf1..b55104e9c 100644
--- a/core/lib/Thelia/Core/Event/Category/CategoryCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Category/CategoryCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Category;
diff --git a/core/lib/Thelia/Core/Event/Category/CategoryDeleteContentEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryDeleteContentEvent.php
index 5b723cf4f..7b2f77c12 100644
--- a/core/lib/Thelia/Core/Event/Category/CategoryDeleteContentEvent.php
+++ b/core/lib/Thelia/Core/Event/Category/CategoryDeleteContentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Category;
diff --git a/core/lib/Thelia/Core/Event/Category/CategoryDeleteEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryDeleteEvent.php
index 013e2aef5..7a96e82a6 100644
--- a/core/lib/Thelia/Core/Event/Category/CategoryDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Category/CategoryDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Category;
diff --git a/core/lib/Thelia/Core/Event/Category/CategoryEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryEvent.php
index ae0cb3b4a..f7685c124 100644
--- a/core/lib/Thelia/Core/Event/Category/CategoryEvent.php
+++ b/core/lib/Thelia/Core/Event/Category/CategoryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Category;
diff --git a/core/lib/Thelia/Core/Event/Category/CategoryToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryToggleVisibilityEvent.php
index dc644b4f9..17f2ce6d2 100644
--- a/core/lib/Thelia/Core/Event/Category/CategoryToggleVisibilityEvent.php
+++ b/core/lib/Thelia/Core/Event/Category/CategoryToggleVisibilityEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Category;
diff --git a/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php
index 120c41bc2..6166046f2 100644
--- a/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Category;
diff --git a/core/lib/Thelia/Core/Event/Config/ConfigCreateEvent.php b/core/lib/Thelia/Core/Event/Config/ConfigCreateEvent.php
index cca6c59cd..7b17582e4 100644
--- a/core/lib/Thelia/Core/Event/Config/ConfigCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Config/ConfigCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Config;
diff --git a/core/lib/Thelia/Core/Event/Config/ConfigDeleteEvent.php b/core/lib/Thelia/Core/Event/Config/ConfigDeleteEvent.php
index 285df3cfd..a681a7e5c 100644
--- a/core/lib/Thelia/Core/Event/Config/ConfigDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Config/ConfigDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Config;
diff --git a/core/lib/Thelia/Core/Event/Config/ConfigEvent.php b/core/lib/Thelia/Core/Event/Config/ConfigEvent.php
index d2dab3f87..3145117af 100644
--- a/core/lib/Thelia/Core/Event/Config/ConfigEvent.php
+++ b/core/lib/Thelia/Core/Event/Config/ConfigEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Config;
diff --git a/core/lib/Thelia/Core/Event/Config/ConfigUpdateEvent.php b/core/lib/Thelia/Core/Event/Config/ConfigUpdateEvent.php
index 71feba6ed..5ea436718 100644
--- a/core/lib/Thelia/Core/Event/Config/ConfigUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Config/ConfigUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Config;
diff --git a/core/lib/Thelia/Core/Event/Content/ContentAddFolderEvent.php b/core/lib/Thelia/Core/Event/Content/ContentAddFolderEvent.php
index dac4317ba..7bdc8bdc7 100644
--- a/core/lib/Thelia/Core/Event/Content/ContentAddFolderEvent.php
+++ b/core/lib/Thelia/Core/Event/Content/ContentAddFolderEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Content;
diff --git a/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php b/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php
index 7763fd359..17434989d 100644
--- a/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Content;
diff --git a/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php b/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php
index 8ad5b1c6f..828cb5f26 100644
--- a/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Content;
diff --git a/core/lib/Thelia/Core/Event/Content/ContentEvent.php b/core/lib/Thelia/Core/Event/Content/ContentEvent.php
index aebda8d28..e1902ad7d 100644
--- a/core/lib/Thelia/Core/Event/Content/ContentEvent.php
+++ b/core/lib/Thelia/Core/Event/Content/ContentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Content;
diff --git a/core/lib/Thelia/Core/Event/Content/ContentRemoveFolderEvent.php b/core/lib/Thelia/Core/Event/Content/ContentRemoveFolderEvent.php
index 1733ec893..41d7df445 100644
--- a/core/lib/Thelia/Core/Event/Content/ContentRemoveFolderEvent.php
+++ b/core/lib/Thelia/Core/Event/Content/ContentRemoveFolderEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Content;
diff --git a/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php
index b2b7e46e9..8630de5d7 100644
--- a/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php
+++ b/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Content;
diff --git a/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php b/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php
index 3cab32425..95f3d413b 100644
--- a/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Content;
diff --git a/core/lib/Thelia/Core/Event/Country/CountryCreateEvent.php b/core/lib/Thelia/Core/Event/Country/CountryCreateEvent.php
index 92d6632ae..8bc0b7195 100644
--- a/core/lib/Thelia/Core/Event/Country/CountryCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Country/CountryCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
diff --git a/core/lib/Thelia/Core/Event/Country/CountryDeleteEvent.php b/core/lib/Thelia/Core/Event/Country/CountryDeleteEvent.php
index 5d658ebc0..be95c34da 100644
--- a/core/lib/Thelia/Core/Event/Country/CountryDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Country/CountryDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
diff --git a/core/lib/Thelia/Core/Event/Country/CountryEvent.php b/core/lib/Thelia/Core/Event/Country/CountryEvent.php
index 505ead8ec..42be6096a 100644
--- a/core/lib/Thelia/Core/Event/Country/CountryEvent.php
+++ b/core/lib/Thelia/Core/Event/Country/CountryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
diff --git a/core/lib/Thelia/Core/Event/Country/CountryToggleDefaultEvent.php b/core/lib/Thelia/Core/Event/Country/CountryToggleDefaultEvent.php
index a414c70e8..56b08d43b 100644
--- a/core/lib/Thelia/Core/Event/Country/CountryToggleDefaultEvent.php
+++ b/core/lib/Thelia/Core/Event/Country/CountryToggleDefaultEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
diff --git a/core/lib/Thelia/Core/Event/Country/CountryUpdateEvent.php b/core/lib/Thelia/Core/Event/Country/CountryUpdateEvent.php
index 2f82b17d0..8854a67b4 100644
--- a/core/lib/Thelia/Core/Event/Country/CountryUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Country/CountryUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
diff --git a/core/lib/Thelia/Core/Event/Coupon/CouponConsumeEvent.php b/core/lib/Thelia/Core/Event/Coupon/CouponConsumeEvent.php
index 70b656b92..a6875105a 100644
--- a/core/lib/Thelia/Core/Event/Coupon/CouponConsumeEvent.php
+++ b/core/lib/Thelia/Core/Event/Coupon/CouponConsumeEvent.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Core\Event\Coupon;
use Thelia\Core\Event\ActionEvent;
diff --git a/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php
index f50a9264d..b5a79ba36 100644
--- a/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Core\Event\Coupon;
use Thelia\Core\Event\ActionEvent;
diff --git a/core/lib/Thelia/Core/Event/Currency/CurrencyChangeEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyChangeEvent.php
new file mode 100644
index 000000000..75058d45a
--- /dev/null
+++ b/core/lib/Thelia/Core/Event/Currency/CurrencyChangeEvent.php
@@ -0,0 +1,52 @@
+
+ */
+class CurrencyChangeEvent extends CurrencyEvent
+{
+ /** @var Request $request */
+ protected $request;
+
+ public function __construct(Currency $currency = null, Request $request = null)
+ {
+ parent::__construct($currency);
+ $this->setRequest($request);
+ }
+
+ /**
+ * @param Request $request
+ */
+ public function setRequest(Request $request)
+ {
+ $this->request = $request;
+
+ return $this;
+ }
+
+ /**
+ * @return Request
+ */
+ public function getRequest()
+ {
+ return $this->request;
+ }
+
+}
diff --git a/core/lib/Thelia/Core/Event/Currency/CurrencyCreateEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyCreateEvent.php
index e28f88ec2..56163f1af 100644
--- a/core/lib/Thelia/Core/Event/Currency/CurrencyCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Currency/CurrencyCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Currency;
diff --git a/core/lib/Thelia/Core/Event/Currency/CurrencyDeleteEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyDeleteEvent.php
index 7ae1e44e1..df44c8469 100644
--- a/core/lib/Thelia/Core/Event/Currency/CurrencyDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Currency/CurrencyDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Currency;
diff --git a/core/lib/Thelia/Core/Event/Currency/CurrencyEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyEvent.php
index 47f91b81d..7333de6e4 100644
--- a/core/lib/Thelia/Core/Event/Currency/CurrencyEvent.php
+++ b/core/lib/Thelia/Core/Event/Currency/CurrencyEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Currency;
diff --git a/core/lib/Thelia/Core/Event/Currency/CurrencyUpdateEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyUpdateEvent.php
index 75011adfa..f88bcc8b6 100644
--- a/core/lib/Thelia/Core/Event/Currency/CurrencyUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Currency/CurrencyUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Currency;
diff --git a/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php
index 86d42e2f4..3865b8a25 100644
--- a/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Event\Customer;
/**
diff --git a/core/lib/Thelia/Core/Event/Customer/CustomerEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerEvent.php
index e76f23955..da83a4c62 100644
--- a/core/lib/Thelia/Core/Event/Customer/CustomerEvent.php
+++ b/core/lib/Thelia/Core/Event/Customer/CustomerEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Customer;
diff --git a/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php
index 654039435..ea0e6f49e 100644
--- a/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php
+++ b/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Customer;
diff --git a/core/lib/Thelia/Core/Event/DefaultActionEvent.php b/core/lib/Thelia/Core/Event/DefaultActionEvent.php
index 51e507a56..a4d4af46a 100644
--- a/core/lib/Thelia/Core/Event/DefaultActionEvent.php
+++ b/core/lib/Thelia/Core/Event/DefaultActionEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php
index a374bd43a..0e639b069 100644
--- a/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Document;
diff --git a/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php b/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php
index 28a51a208..493fb0432 100644
--- a/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Document;
diff --git a/core/lib/Thelia/Core/Event/Document/DocumentEvent.php b/core/lib/Thelia/Core/Event/Document/DocumentEvent.php
index dd3fe86b1..8ba6dd3cc 100644
--- a/core/lib/Thelia/Core/Event/Document/DocumentEvent.php
+++ b/core/lib/Thelia/Core/Event/Document/DocumentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Document;
diff --git a/core/lib/Thelia/Core/Event/Feature/FeatureAvCreateEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureAvCreateEvent.php
index 4a515f8ef..af8e4a4b7 100644
--- a/core/lib/Thelia/Core/Event/Feature/FeatureAvCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Feature/FeatureAvCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Feature;
diff --git a/core/lib/Thelia/Core/Event/Feature/FeatureAvDeleteEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureAvDeleteEvent.php
index 06bafc2ec..57881e495 100644
--- a/core/lib/Thelia/Core/Event/Feature/FeatureAvDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Feature/FeatureAvDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Feature;
diff --git a/core/lib/Thelia/Core/Event/Feature/FeatureAvEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureAvEvent.php
index 42011bfe3..73a120f91 100644
--- a/core/lib/Thelia/Core/Event/Feature/FeatureAvEvent.php
+++ b/core/lib/Thelia/Core/Event/Feature/FeatureAvEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Feature;
diff --git a/core/lib/Thelia/Core/Event/Feature/FeatureAvUpdateEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureAvUpdateEvent.php
index 88235a5a0..afe31d999 100644
--- a/core/lib/Thelia/Core/Event/Feature/FeatureAvUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Feature/FeatureAvUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Feature;
diff --git a/core/lib/Thelia/Core/Event/Feature/FeatureCreateEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureCreateEvent.php
index b5654f6a3..1a0f8536e 100644
--- a/core/lib/Thelia/Core/Event/Feature/FeatureCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Feature/FeatureCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Feature;
diff --git a/core/lib/Thelia/Core/Event/Feature/FeatureDeleteEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureDeleteEvent.php
index ea7a52f0a..201ccfbac 100644
--- a/core/lib/Thelia/Core/Event/Feature/FeatureDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Feature/FeatureDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Feature;
diff --git a/core/lib/Thelia/Core/Event/Feature/FeatureEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureEvent.php
index 7b597acaf..bbe5ff754 100644
--- a/core/lib/Thelia/Core/Event/Feature/FeatureEvent.php
+++ b/core/lib/Thelia/Core/Event/Feature/FeatureEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Feature;
diff --git a/core/lib/Thelia/Core/Event/Feature/FeatureUpdateEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureUpdateEvent.php
index 1dd96f54d..f053cab02 100644
--- a/core/lib/Thelia/Core/Event/Feature/FeatureUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Feature/FeatureUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Feature;
diff --git a/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductDeleteEvent.php b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductDeleteEvent.php
index 7bcab6f4c..868dbd8d5 100644
--- a/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\FeatureProduct;
diff --git a/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php
index aef4b25f5..6091098c2 100644
--- a/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php
+++ b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\FeatureProduct;
diff --git a/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductUpdateEvent.php b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductUpdateEvent.php
index 894783698..8f643fc07 100644
--- a/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\FeatureProduct;
diff --git a/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php
index c45b77632..86e654de4 100644
--- a/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Folder;
diff --git a/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php
index f20a35bdb..042dd2b4c 100644
--- a/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Folder;
diff --git a/core/lib/Thelia/Core/Event/Folder/FolderEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderEvent.php
index 62eaddf39..b027ee638 100644
--- a/core/lib/Thelia/Core/Event/Folder/FolderEvent.php
+++ b/core/lib/Thelia/Core/Event/Folder/FolderEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Folder;
diff --git a/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php
index 2f39e1c7d..7a13e5327 100644
--- a/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php
+++ b/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Folder;
diff --git a/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php
index 258668b16..816675d93 100644
--- a/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Folder;
diff --git a/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php b/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php
index 95604ceb5..54f9f9575 100644
--- a/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php
+++ b/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php
index 1f37ff7af..5a3485abe 100644
--- a/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Image;
diff --git a/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php b/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php
index ad1319f42..cef4982b5 100644
--- a/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Image;
diff --git a/core/lib/Thelia/Core/Event/Image/ImageEvent.php b/core/lib/Thelia/Core/Event/Image/ImageEvent.php
index 2fce2466c..e6f152708 100644
--- a/core/lib/Thelia/Core/Event/Image/ImageEvent.php
+++ b/core/lib/Thelia/Core/Event/Image/ImageEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Image;
diff --git a/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php b/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php
index 3e7c667dd..0b0c35bdc 100644
--- a/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Lang;
@@ -35,6 +24,9 @@ class LangCreateEvent extends LangEvent
protected $locale;
protected $date_format;
protected $time_format;
+ protected $decimal_separator;
+ protected $thousands_separator;
+ protected $decimals;
/**
* @param mixed $code
@@ -136,4 +128,60 @@ class LangCreateEvent extends LangEvent
return $this->title;
}
+ /**
+ * @param mixed $decimal_separator
+ */
+ public function setDecimalSeparator($decimal_separator)
+ {
+ $this->decimal_separator = $decimal_separator;
+
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDecimalSeparator()
+ {
+ return $this->decimal_separator;
+ }
+
+ /**
+ * @param mixed $decimals
+ */
+ public function setDecimals($decimals)
+ {
+ $this->decimals = $decimals;
+
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDecimals()
+ {
+ return $this->decimals;
+ }
+
+ /**
+ * @param mixed $thousands_separator
+ */
+ public function setThousandsSeparator($thousands_separator)
+ {
+ $this->thousands_separator = $thousands_separator;
+
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getThousandsSeparator()
+ {
+ return $this->thousands_separator;
+ }
+
+
+
}
diff --git a/core/lib/Thelia/Core/Event/Lang/LangDefaultBehaviorEvent.php b/core/lib/Thelia/Core/Event/Lang/LangDefaultBehaviorEvent.php
index fff119e96..2800c69e5 100644
--- a/core/lib/Thelia/Core/Event/Lang/LangDefaultBehaviorEvent.php
+++ b/core/lib/Thelia/Core/Event/Lang/LangDefaultBehaviorEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Lang;
diff --git a/core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php b/core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php
index 25190f857..d4d81802a 100644
--- a/core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Lang;
diff --git a/core/lib/Thelia/Core/Event/Lang/LangEvent.php b/core/lib/Thelia/Core/Event/Lang/LangEvent.php
index 1cc7da5e6..ce54e5757 100644
--- a/core/lib/Thelia/Core/Event/Lang/LangEvent.php
+++ b/core/lib/Thelia/Core/Event/Lang/LangEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Lang;
diff --git a/core/lib/Thelia/Core/Event/Lang/LangToggleDefaultEvent.php b/core/lib/Thelia/Core/Event/Lang/LangToggleDefaultEvent.php
index 626396191..2ed55d2ec 100644
--- a/core/lib/Thelia/Core/Event/Lang/LangToggleDefaultEvent.php
+++ b/core/lib/Thelia/Core/Event/Lang/LangToggleDefaultEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Lang;
diff --git a/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php b/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php
index cb6282395..25329c356 100644
--- a/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Lang;
diff --git a/core/lib/Thelia/Core/Event/LostPasswordEvent.php b/core/lib/Thelia/Core/Event/LostPasswordEvent.php
index 78d786b2d..1757e7942 100644
--- a/core/lib/Thelia/Core/Event/LostPasswordEvent.php
+++ b/core/lib/Thelia/Core/Event/LostPasswordEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/MailTransporterEvent.php b/core/lib/Thelia/Core/Event/MailTransporterEvent.php
index 5a133158e..6d7373c8b 100644
--- a/core/lib/Thelia/Core/Event/MailTransporterEvent.php
+++ b/core/lib/Thelia/Core/Event/MailTransporterEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/MailingSystem/MailingSystemEvent.php b/core/lib/Thelia/Core/Event/MailingSystem/MailingSystemEvent.php
index 02cb25e6e..29a034ddb 100644
--- a/core/lib/Thelia/Core/Event/MailingSystem/MailingSystemEvent.php
+++ b/core/lib/Thelia/Core/Event/MailingSystem/MailingSystemEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\MailingSystem;
diff --git a/core/lib/Thelia/Core/Event/Message/MessageCreateEvent.php b/core/lib/Thelia/Core/Event/Message/MessageCreateEvent.php
index 2957d2c2d..f76a58171 100644
--- a/core/lib/Thelia/Core/Event/Message/MessageCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Message/MessageCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Message;
diff --git a/core/lib/Thelia/Core/Event/Message/MessageDeleteEvent.php b/core/lib/Thelia/Core/Event/Message/MessageDeleteEvent.php
index 950daebde..013e4ab9e 100644
--- a/core/lib/Thelia/Core/Event/Message/MessageDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Message/MessageDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Message;
diff --git a/core/lib/Thelia/Core/Event/Message/MessageEvent.php b/core/lib/Thelia/Core/Event/Message/MessageEvent.php
index 82086ed05..e5552142c 100644
--- a/core/lib/Thelia/Core/Event/Message/MessageEvent.php
+++ b/core/lib/Thelia/Core/Event/Message/MessageEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Message;
diff --git a/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php b/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php
index 56e4d57a0..9f39e0b68 100644
--- a/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Message;
diff --git a/core/lib/Thelia/Core/Event/Module/ModuleDeleteEvent.php b/core/lib/Thelia/Core/Event/Module/ModuleDeleteEvent.php
index cf7e0bc41..01e1d5c25 100644
--- a/core/lib/Thelia/Core/Event/Module/ModuleDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Module/ModuleDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Module;
diff --git a/core/lib/Thelia/Core/Event/Module/ModuleEvent.php b/core/lib/Thelia/Core/Event/Module/ModuleEvent.php
index 7dc3f67e8..ee268973a 100644
--- a/core/lib/Thelia/Core/Event/Module/ModuleEvent.php
+++ b/core/lib/Thelia/Core/Event/Module/ModuleEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Module;
diff --git a/core/lib/Thelia/Core/Event/Module/ModuleToggleActivationEvent.php b/core/lib/Thelia/Core/Event/Module/ModuleToggleActivationEvent.php
index c6ece16f4..842600a14 100644
--- a/core/lib/Thelia/Core/Event/Module/ModuleToggleActivationEvent.php
+++ b/core/lib/Thelia/Core/Event/Module/ModuleToggleActivationEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Module;
diff --git a/core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php b/core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php
index 3994d265f..df9264d9e 100644
--- a/core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php
+++ b/core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Newsletter;
diff --git a/core/lib/Thelia/Core/Event/Order/OrderAddressEvent.php b/core/lib/Thelia/Core/Event/Order/OrderAddressEvent.php
index 92c101dd6..4f929fbd4 100644
--- a/core/lib/Thelia/Core/Event/Order/OrderAddressEvent.php
+++ b/core/lib/Thelia/Core/Event/Order/OrderAddressEvent.php
@@ -1,26 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
-
namespace Thelia\Core\Event\Order;
use Thelia\Core\Event\ActionEvent;
diff --git a/core/lib/Thelia/Core/Event/Order/OrderEvent.php b/core/lib/Thelia/Core/Event/Order/OrderEvent.php
index 282a71207..e1e4118c6 100644
--- a/core/lib/Thelia/Core/Event/Order/OrderEvent.php
+++ b/core/lib/Thelia/Core/Event/Order/OrderEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Order;
@@ -40,6 +29,8 @@ class OrderEvent extends ActionEvent
protected $status = null;
protected $deliveryRef = null;
+ protected $cartItemId = null;
+
/**
* @var Response
*/
@@ -61,6 +52,24 @@ class OrderEvent extends ActionEvent
$this->order = $order;
}
+ /**
+ * @param null $cartItemId
+ */
+ public function setCartItemId($cartItemId)
+ {
+ $this->cartItemId = $cartItemId;
+
+ return $this;
+ }
+
+ /**
+ * @return null
+ */
+ public function getCartItemId()
+ {
+ return $this->cartItemId;
+ }
+
/**
* @param Order $order
*/
@@ -118,7 +127,7 @@ class OrderEvent extends ActionEvent
}
/**
- * @param $status
+ * @param int $status
*/
public function setStatus($status)
{
diff --git a/core/lib/Thelia/Core/Event/Order/OrderManualEvent.php b/core/lib/Thelia/Core/Event/Order/OrderManualEvent.php
index dc5f0b155..7ca4a2aa4 100644
--- a/core/lib/Thelia/Core/Event/Order/OrderManualEvent.php
+++ b/core/lib/Thelia/Core/Event/Order/OrderManualEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Order;
diff --git a/core/lib/Thelia/Core/Event/Order/OrderPaymentEvent.php b/core/lib/Thelia/Core/Event/Order/OrderPaymentEvent.php
index 1e15c2dfc..e11815555 100644
--- a/core/lib/Thelia/Core/Event/Order/OrderPaymentEvent.php
+++ b/core/lib/Thelia/Core/Event/Order/OrderPaymentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Order;
diff --git a/core/lib/Thelia/Core/Event/PdfEvent.php b/core/lib/Thelia/Core/Event/PdfEvent.php
index b439c8a23..fb170296b 100644
--- a/core/lib/Thelia/Core/Event/PdfEvent.php
+++ b/core/lib/Thelia/Core/Event/PdfEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductAddAccessoryEvent.php b/core/lib/Thelia/Core/Event/Product/ProductAddAccessoryEvent.php
index d32988b84..1f9fe2325 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductAddAccessoryEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductAddAccessoryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductAddCategoryEvent.php b/core/lib/Thelia/Core/Event/Product/ProductAddCategoryEvent.php
index de11b34cb..617913c0c 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductAddCategoryEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductAddCategoryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductAddContentEvent.php b/core/lib/Thelia/Core/Event/Product/ProductAddContentEvent.php
index 960dbfdf6..9dad4b418 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductAddContentEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductAddContentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductAssociatedContentEvent.php b/core/lib/Thelia/Core/Event/Product/ProductAssociatedContentEvent.php
index 5cdb7c8e1..2fa766ada 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductAssociatedContentEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductAssociatedContentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductCombinationGenerationEvent.php b/core/lib/Thelia/Core/Event/Product/ProductCombinationGenerationEvent.php
index 802ade89b..de845d7b4 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductCombinationGenerationEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductCombinationGenerationEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php
index 9717f171d..0fe389161 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductDeleteAccessoryEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteAccessoryEvent.php
index 0cfd979c2..4ddd2f317 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductDeleteAccessoryEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteAccessoryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductDeleteCategoryEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteCategoryEvent.php
index e83cd087b..af58a568f 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductDeleteCategoryEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteCategoryEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductDeleteContentEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteContentEvent.php
index 6f09411cb..db7190c44 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductDeleteContentEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteContentEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductDeleteEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteEvent.php
index 7a3406e7e..4cb710409 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductEvent.php b/core/lib/Thelia/Core/Event/Product/ProductEvent.php
index 11359c616..c587cdf2f 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php
index 0e95abfba..b0d46166c 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Product/ProductToggleVisibilityEvent.php
index 1d082fd6d..e6f82b222 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductToggleVisibilityEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductToggleVisibilityEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/Product/ProductUpdateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductUpdateEvent.php
index 7bde5599a..1768f3384 100644
--- a/core/lib/Thelia/Core/Event/Product/ProductUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Product/ProductUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Product;
diff --git a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementCreateEvent.php b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementCreateEvent.php
index bbb5d07e7..c1286aa5d 100644
--- a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\ProductSaleElement;
diff --git a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php
index 8f94b254b..22cd7fd61 100644
--- a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\ProductSaleElement;
diff --git a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementEvent.php b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementEvent.php
index 0f34bd62f..4c3f6be85 100644
--- a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementEvent.php
+++ b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\ProductSaleElement;
diff --git a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementUpdateEvent.php b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementUpdateEvent.php
index 5be7156dc..267e53053 100644
--- a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\ProductSaleElement;
diff --git a/core/lib/Thelia/Core/Event/Profile/ProfileEvent.php b/core/lib/Thelia/Core/Event/Profile/ProfileEvent.php
index 423f48654..dd66563ab 100644
--- a/core/lib/Thelia/Core/Event/Profile/ProfileEvent.php
+++ b/core/lib/Thelia/Core/Event/Profile/ProfileEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Profile;
diff --git a/core/lib/Thelia/Core/Event/ShippingZone/ShippingZoneAddAreaEvent.php b/core/lib/Thelia/Core/Event/ShippingZone/ShippingZoneAddAreaEvent.php
index dfe1b33cd..e358573aa 100644
--- a/core/lib/Thelia/Core/Event/ShippingZone/ShippingZoneAddAreaEvent.php
+++ b/core/lib/Thelia/Core/Event/ShippingZone/ShippingZoneAddAreaEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\ShippingZone;
diff --git a/core/lib/Thelia/Core/Event/ShippingZone/ShippingZoneRemoveAreaEvent.php b/core/lib/Thelia/Core/Event/ShippingZone/ShippingZoneRemoveAreaEvent.php
index a3177f522..68da304d2 100644
--- a/core/lib/Thelia/Core/Event/ShippingZone/ShippingZoneRemoveAreaEvent.php
+++ b/core/lib/Thelia/Core/Event/ShippingZone/ShippingZoneRemoveAreaEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\ShippingZone;
diff --git a/core/lib/Thelia/Core/Event/Tax/TaxEvent.php b/core/lib/Thelia/Core/Event/Tax/TaxEvent.php
index 7acc02e32..0a7e254b7 100644
--- a/core/lib/Thelia/Core/Event/Tax/TaxEvent.php
+++ b/core/lib/Thelia/Core/Event/Tax/TaxEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Tax;
diff --git a/core/lib/Thelia/Core/Event/Tax/TaxRuleEvent.php b/core/lib/Thelia/Core/Event/Tax/TaxRuleEvent.php
index 2da4fbf2d..013e03457 100644
--- a/core/lib/Thelia/Core/Event/Tax/TaxRuleEvent.php
+++ b/core/lib/Thelia/Core/Event/Tax/TaxRuleEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Tax;
diff --git a/core/lib/Thelia/Core/Event/Template/TemplateAddAttributeEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateAddAttributeEvent.php
index 03160ffb6..4e1eb90d7 100644
--- a/core/lib/Thelia/Core/Event/Template/TemplateAddAttributeEvent.php
+++ b/core/lib/Thelia/Core/Event/Template/TemplateAddAttributeEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Template;
diff --git a/core/lib/Thelia/Core/Event/Template/TemplateAddFeatureEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateAddFeatureEvent.php
index 900007853..e911767e5 100644
--- a/core/lib/Thelia/Core/Event/Template/TemplateAddFeatureEvent.php
+++ b/core/lib/Thelia/Core/Event/Template/TemplateAddFeatureEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Template;
diff --git a/core/lib/Thelia/Core/Event/Template/TemplateCreateEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateCreateEvent.php
index 4cb676481..8ff1bfab6 100644
--- a/core/lib/Thelia/Core/Event/Template/TemplateCreateEvent.php
+++ b/core/lib/Thelia/Core/Event/Template/TemplateCreateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Template;
diff --git a/core/lib/Thelia/Core/Event/Template/TemplateDeleteAttributeEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateDeleteAttributeEvent.php
index a9c3f978e..3fb591cc2 100644
--- a/core/lib/Thelia/Core/Event/Template/TemplateDeleteAttributeEvent.php
+++ b/core/lib/Thelia/Core/Event/Template/TemplateDeleteAttributeEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Template;
diff --git a/core/lib/Thelia/Core/Event/Template/TemplateDeleteEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateDeleteEvent.php
index b5c2efca6..fcfa10bfd 100644
--- a/core/lib/Thelia/Core/Event/Template/TemplateDeleteEvent.php
+++ b/core/lib/Thelia/Core/Event/Template/TemplateDeleteEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Template;
diff --git a/core/lib/Thelia/Core/Event/Template/TemplateDeleteFeatureEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateDeleteFeatureEvent.php
index 0c5c75eef..fec57a589 100644
--- a/core/lib/Thelia/Core/Event/Template/TemplateDeleteFeatureEvent.php
+++ b/core/lib/Thelia/Core/Event/Template/TemplateDeleteFeatureEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Template;
diff --git a/core/lib/Thelia/Core/Event/Template/TemplateEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateEvent.php
index 1010cfc31..b71ad5001 100644
--- a/core/lib/Thelia/Core/Event/Template/TemplateEvent.php
+++ b/core/lib/Thelia/Core/Event/Template/TemplateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Template;
diff --git a/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php
index 9f2c22a9c..a174253cb 100644
--- a/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php
+++ b/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event\Template;
diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php
index 580fac029..69c12fb73 100644
--- a/core/lib/Thelia/Core/Event/TheliaEvents.php
+++ b/core/lib/Thelia/Core/Event/TheliaEvents.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
@@ -342,6 +331,8 @@ final class TheliaEvents
*/
const CART_DUPLICATE = "cart.duplicate";
+ const CART_ITEM_DUPLICATE = "cart.item.duplicate";
+
/**
* sent when a new item is added to current cart
*/
diff --git a/core/lib/Thelia/Core/Event/ToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/ToggleVisibilityEvent.php
index 996292c8e..72cf41b32 100644
--- a/core/lib/Thelia/Core/Event/ToggleVisibilityEvent.php
+++ b/core/lib/Thelia/Core/Event/ToggleVisibilityEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/UpdateFilePositionEvent.php b/core/lib/Thelia/Core/Event/UpdateFilePositionEvent.php
index 1cd9b6677..8cf2f35c0 100644
--- a/core/lib/Thelia/Core/Event/UpdateFilePositionEvent.php
+++ b/core/lib/Thelia/Core/Event/UpdateFilePositionEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/UpdatePositionEvent.php b/core/lib/Thelia/Core/Event/UpdatePositionEvent.php
index e75e30b98..feb26e9c5 100644
--- a/core/lib/Thelia/Core/Event/UpdatePositionEvent.php
+++ b/core/lib/Thelia/Core/Event/UpdatePositionEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/UpdateSeoEvent.php b/core/lib/Thelia/Core/Event/UpdateSeoEvent.php
index cb287b869..dbd433f09 100644
--- a/core/lib/Thelia/Core/Event/UpdateSeoEvent.php
+++ b/core/lib/Thelia/Core/Event/UpdateSeoEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/EventListener/RequestListener.php b/core/lib/Thelia/Core/EventListener/RequestListener.php
index a3f7aad4e..fff731301 100644
--- a/core/lib/Thelia/Core/EventListener/RequestListener.php
+++ b/core/lib/Thelia/Core/EventListener/RequestListener.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\EventListener;
diff --git a/core/lib/Thelia/Core/EventListener/ResponseListener.php b/core/lib/Thelia/Core/EventListener/ResponseListener.php
new file mode 100644
index 000000000..db2a6e491
--- /dev/null
+++ b/core/lib/Thelia/Core/EventListener/ResponseListener.php
@@ -0,0 +1,72 @@
+
+ */
+class ResponseListener implements EventSubscriberInterface
+{
+
+ public function beforeResponse(FilterResponseEvent $event)
+ {
+ $session = $event->getRequest()->getSession();
+
+ if (null !== $id = $session->get("cart_use_cookie")) {
+ $response = $event->getResponse();
+ $response->headers->setCookie(new Cookie(
+ "thelia_cart",
+ $id,
+ time()+ConfigQuery::read("cart.cookie_lifetime", 60*60*24*365),
+ '/'
+ ));
+
+ $session->set("cart_use_cookie", null);
+ }
+ }
+
+ /**
+ * Returns an array of event names this subscriber wants to listen to.
+ *
+ * The array keys are event names and the value can be:
+ *
+ * * The method name to call (priority defaults to 0)
+ * * An array composed of the method name to call and the priority
+ * * An array of arrays composed of the method names to call and respective
+ * priorities, or 0 if unset
+ *
+ * For instance:
+ *
+ * * array('eventName' => 'methodName')
+ * * array('eventName' => array('methodName', $priority))
+ * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
+ *
+ * @return array The event names to listen to
+ *
+ * @api
+ */
+ public static function getSubscribedEvents()
+ {
+ return [
+ KernelEvents::RESPONSE => ['beforeResponse', 128]
+ ];
+ }
+}
diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php
index 0e57bdaf7..b0ed5ce2f 100644
--- a/core/lib/Thelia/Core/EventListener/ViewListener.php
+++ b/core/lib/Thelia/Core/EventListener/ViewListener.php
@@ -1,28 +1,19 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
@@ -78,7 +69,7 @@ class ViewListener implements EventSubscriberInterface
$parser = $this->container->get('thelia.parser');
$parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate());
$request = $this->container->get('request');
-
+ $response = null;
try {
$content = $parser->render($request->attributes->get('_view').".html");
@@ -88,27 +79,29 @@ class ViewListener implements EventSubscriberInterface
$response = new Response($content, $parser->getStatus() ?: 200);
}
- $event->setResponse($response);
} catch (ResourceNotFoundException $e) {
throw new NotFoundHttpException();
} catch (AuthenticationException $ex) {
// Redirect to the login template
- Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate()));
+ $response = RedirectResponse::create($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate()));
} catch (OrderException $e) {
switch ($e->getCode()) {
case OrderException::CART_EMPTY:
// Redirect to the cart template
- Redirect::exec($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
+ $response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
case OrderException::UNDEFINED_DELIVERY:
// Redirect to the delivery choice template
- Redirect::exec($this->container->get('router.chainRequest')->generate($e->orderDeliveryRoute, $e->arguments, Router::ABSOLUTE_URL));
+ $response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->orderDeliveryRoute, $e->arguments, Router::ABSOLUTE_URL));
break;
}
-
- throw $e;
+ if (null === $response) {
+ throw $e;
+ }
}
+
+ $event->setResponse($response);
}
public function beforeKernelView(GetResponseForControllerResultEvent $event)
diff --git a/core/lib/Thelia/Core/Factory/ActionEventFactory.php b/core/lib/Thelia/Core/Factory/ActionEventFactory.php
index cbbb7caf8..d34838124 100644
--- a/core/lib/Thelia/Core/Factory/ActionEventFactory.php
+++ b/core/lib/Thelia/Core/Factory/ActionEventFactory.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Factory;
diff --git a/core/lib/Thelia/Core/Form/Type/TheliaType.php b/core/lib/Thelia/Core/Form/Type/TheliaType.php
index eaad895be..9b0d33e49 100644
--- a/core/lib/Thelia/Core/Form/Type/TheliaType.php
+++ b/core/lib/Thelia/Core/Form/Type/TheliaType.php
@@ -1,4 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\HttpFoundation;
use Symfony\Component\HttpFoundation\Request as BaseRequest;
diff --git a/core/lib/Thelia/Core/HttpFoundation/Response.php b/core/lib/Thelia/Core/HttpFoundation/Response.php
index e279215b8..b8194d37d 100644
--- a/core/lib/Thelia/Core/HttpFoundation/Response.php
+++ b/core/lib/Thelia/Core/HttpFoundation/Response.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\HttpFoundation;
use Symfony\Component\HttpFoundation\Response as BaseResponse;
diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php
index df5fa6a38..008f0fbfb 100644
--- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php
+++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\HttpFoundation\Session;
diff --git a/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php b/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php
index 41ca0bdc1..4f150a325 100644
--- a/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php
+++ b/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\HttpKernel\Exception;
diff --git a/core/lib/Thelia/Core/HttpKernel/HttpCache/HttpCache.php b/core/lib/Thelia/Core/HttpKernel/HttpCache/HttpCache.php
index aceb6235f..38d3d968c 100644
--- a/core/lib/Thelia/Core/HttpKernel/HttpCache/HttpCache.php
+++ b/core/lib/Thelia/Core/HttpKernel/HttpCache/HttpCache.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\HttpKernel\HttpCache;
diff --git a/core/lib/Thelia/Core/Routing/RewritingRouter.php b/core/lib/Thelia/Core/Routing/RewritingRouter.php
index bdf0a6e03..e416b21e3 100644
--- a/core/lib/Thelia/Core/Routing/RewritingRouter.php
+++ b/core/lib/Thelia/Core/Routing/RewritingRouter.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Routing;
diff --git a/core/lib/Thelia/Core/Security/AccessManager.php b/core/lib/Thelia/Core/Security/AccessManager.php
index 07fc5bcae..5186a7245 100644
--- a/core/lib/Thelia/Core/Security/AccessManager.php
+++ b/core/lib/Thelia/Core/Security/AccessManager.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security;
diff --git a/core/lib/Thelia/Core/Security/Authentication/AdminTokenAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/AdminTokenAuthenticator.php
index 4c6dcec5c..4db122f4e 100644
--- a/core/lib/Thelia/Core/Security/Authentication/AdminTokenAuthenticator.php
+++ b/core/lib/Thelia/Core/Security/Authentication/AdminTokenAuthenticator.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
diff --git a/core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php
index 256649ae0..b380b0eb6 100644
--- a/core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php
+++ b/core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php
@@ -1,25 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
diff --git a/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php b/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php
index 9e2079ce4..5128a3ee7 100644
--- a/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php
+++ b/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
diff --git a/core/lib/Thelia/Core/Security/Authentication/CustomerTokenAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/CustomerTokenAuthenticator.php
index d06400875..3f79f6a39 100644
--- a/core/lib/Thelia/Core/Security/Authentication/CustomerTokenAuthenticator.php
+++ b/core/lib/Thelia/Core/Security/Authentication/CustomerTokenAuthenticator.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
diff --git a/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php
index 7da54e26b..9f426280a 100644
--- a/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php
+++ b/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php
@@ -1,25 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
diff --git a/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php
index 840394d4f..cb800ee40 100644
--- a/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php
+++ b/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
diff --git a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php
index e016233c2..13bed48e7 100644
--- a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php
+++ b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Authentication;
diff --git a/core/lib/Thelia/Core/Security/Exception/AuthenticationException.php b/core/lib/Thelia/Core/Security/Exception/AuthenticationException.php
index 93eed87d5..f316faf0c 100644
--- a/core/lib/Thelia/Core/Security/Exception/AuthenticationException.php
+++ b/core/lib/Thelia/Core/Security/Exception/AuthenticationException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Exception;
diff --git a/core/lib/Thelia/Core/Security/Exception/AuthorizationException.php b/core/lib/Thelia/Core/Security/Exception/AuthorizationException.php
index 60bd0a2d6..1f37f88ad 100644
--- a/core/lib/Thelia/Core/Security/Exception/AuthorizationException.php
+++ b/core/lib/Thelia/Core/Security/Exception/AuthorizationException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Exception;
diff --git a/core/lib/Thelia/Core/Security/Exception/ResourceException.php b/core/lib/Thelia/Core/Security/Exception/ResourceException.php
index 27343bd16..9f4e188d5 100644
--- a/core/lib/Thelia/Core/Security/Exception/ResourceException.php
+++ b/core/lib/Thelia/Core/Security/Exception/ResourceException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Exception;
diff --git a/core/lib/Thelia/Core/Security/Exception/TokenAuthenticationException.php b/core/lib/Thelia/Core/Security/Exception/TokenAuthenticationException.php
index 6af57162d..19ffc28e8 100644
--- a/core/lib/Thelia/Core/Security/Exception/TokenAuthenticationException.php
+++ b/core/lib/Thelia/Core/Security/Exception/TokenAuthenticationException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Exception;
diff --git a/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php b/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php
index 2168e63ca..508339f92 100644
--- a/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php
+++ b/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Exception;
diff --git a/core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php b/core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php
index 6088f43ad..9ddcef286 100644
--- a/core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php
+++ b/core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Exception;
diff --git a/core/lib/Thelia/Core/Security/Resource/AdminResources.php b/core/lib/Thelia/Core/Security/Resource/AdminResources.php
index 314038e67..107aef017 100644
--- a/core/lib/Thelia/Core/Security/Resource/AdminResources.php
+++ b/core/lib/Thelia/Core/Security/Resource/AdminResources.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Resource;
@@ -56,6 +45,8 @@ final class AdminResources
const ADMINISTRATOR = "admin.configuration.administrator";
+ const ADVANCED_CONFIGURATION = "admin.configuration.advanced";
+
const AREA = "admin.configuration.area";
const ATTRIBUTE = "admin.configuration.attribute";
@@ -78,6 +69,8 @@ final class AdminResources
const FOLDER = "admin.folder";
+ const HOME = "admin.home";
+
const LANGUAGE = "admin.configuration.language";
const MAILING_SYSTEM = "admin.configuration.mailing-system";
@@ -98,11 +91,19 @@ final class AdminResources
const TEMPLATE = "admin.configuration.template";
- const SYSTEM_LOG = "admin.configuration.system-log";
+ const SYSTEM_LOG = "admin.configuration.system-logs";
+
+ const ADMIN_LOG = "admin.configuration.admin-logs";
const STORE = "admin.configuration.store";
const TRANSLATIONS = "admin.configuration.translations";
const UPDATE = "admin.configuration.update";
+
+ const EXPORT = "admin.export";
+
+ const EXPORT_CUSTOMER_NEWSLETTER = "admin.export.customer.newsletter";
+
+ const TOOLS = "admin.tools";
}
diff --git a/core/lib/Thelia/Core/Security/SecurityContext.php b/core/lib/Thelia/Core/Security/SecurityContext.php
index 2cbbf069e..4d4e791df 100644
--- a/core/lib/Thelia/Core/Security/SecurityContext.php
+++ b/core/lib/Thelia/Core/Security/SecurityContext.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security;
diff --git a/core/lib/Thelia/Core/Security/Token/CookieTokenProvider.php b/core/lib/Thelia/Core/Security/Token/CookieTokenProvider.php
index ee2d9291a..d2ccfd283 100644
--- a/core/lib/Thelia/Core/Security/Token/CookieTokenProvider.php
+++ b/core/lib/Thelia/Core/Security/Token/CookieTokenProvider.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\Token;
diff --git a/core/lib/Thelia/Core/Security/Token/TokenProvider.php b/core/lib/Thelia/Core/Security/Token/TokenProvider.php
index 32c5b7d6c..39bb75a7e 100644
--- a/core/lib/Thelia/Core/Security/Token/TokenProvider.php
+++ b/core/lib/Thelia/Core/Security/Token/TokenProvider.php
@@ -1,4 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
diff --git a/core/lib/Thelia/Core/Security/UserProvider/AdminUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/AdminUserProvider.php
index 0ed80d556..e97ef15da 100644
--- a/core/lib/Thelia/Core/Security/UserProvider/AdminUserProvider.php
+++ b/core/lib/Thelia/Core/Security/UserProvider/AdminUserProvider.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
diff --git a/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php
index e0ea58b84..bd88fcc81 100644
--- a/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php
+++ b/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
diff --git a/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php
index 3193e3a45..80a5004d3 100644
--- a/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php
+++ b/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
diff --git a/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php
index e58a2e123..780760ac7 100644
--- a/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php
+++ b/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
diff --git a/core/lib/Thelia/Core/Security/UserProvider/UserProviderInterface.php b/core/lib/Thelia/Core/Security/UserProvider/UserProviderInterface.php
index 6fe5e5197..52dd1dd6b 100644
--- a/core/lib/Thelia/Core/Security/UserProvider/UserProviderInterface.php
+++ b/core/lib/Thelia/Core/Security/UserProvider/UserProviderInterface.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Security\UserProvider;
diff --git a/core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php b/core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php
index dedb54d8e..a248d9f1a 100644
--- a/core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php
+++ b/core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Assets;
diff --git a/core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php b/core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
index f7b85c128..273c9bace 100644
--- a/core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
+++ b/core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Assets;
diff --git a/core/lib/Thelia/Core/Template/Element/ArraySearchLoopInterface.php b/core/lib/Thelia/Core/Template/Element/ArraySearchLoopInterface.php
index f33b8505e..d81f70b33 100644
--- a/core/lib/Thelia/Core/Template/Element/ArraySearchLoopInterface.php
+++ b/core/lib/Thelia/Core/Template/Element/ArraySearchLoopInterface.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template\Element;
/**
diff --git a/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php b/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php
index 35912679d..139fdf747 100644
--- a/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php
+++ b/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Element;
diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php
index 7a6e3bf8f..1038541de 100644
--- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php
+++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php
@@ -1,34 +1,26 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Element;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
+use Propel\Runtime\Collection\ObjectCollection;
+use Propel\Runtime\Util\PropelModelPager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Core\Security\SecurityContext;
use Thelia\Core\Template\Element\Exception\LoopException;
use Thelia\Core\Template\Loop\Argument\Argument;
+use Thelia\Core\Translation\Translator;
use Thelia\Type\EnumListType;
use Thelia\Type\EnumType;
use Thelia\Type\TypeCollection;
@@ -64,8 +56,11 @@ abstract class BaseLoop
protected $timestampable = false;
protected $versionable = false;
- private static $cacheLoopResult = array();
- private static $cacheCount = array();
+ /** @var Translator */
+ protected $translator = null;
+
+ private static $cacheLoopResult = [];
+ private static $cacheCount = [];
/**
* Create a new Loop
@@ -81,6 +76,7 @@ abstract class BaseLoop
$this->request = $container->get('request');
$this->dispatcher = $container->get('event_dispatcher');
$this->securityContext = $container->get('thelia.securityContext');
+ $this->translator = $container->get("thelia.translator");
$this->args = $this->getArgDefinitions()->addArguments($this->getDefaultArgs(), false);
}
@@ -92,53 +88,54 @@ abstract class BaseLoop
*/
protected function getDefaultArgs()
{
- $defaultArgs = array(
+ $defaultArgs = [
Argument::createBooleanTypeArgument('backend_context', false),
Argument::createBooleanTypeArgument('force_return', false),
Argument::createAnyTypeArgument('type'),
- );
+ ];
if (true === $this->countable) {
- $defaultArgs = array_merge($defaultArgs, array(
- Argument::createIntTypeArgument('offset', 0),
- Argument::createIntTypeArgument('page'),
- Argument::createIntTypeArgument('limit', PHP_INT_MAX),
- ));
+ $defaultArgs = array_merge($defaultArgs, [
+ Argument::createIntTypeArgument('offset', 0),
+ Argument::createIntTypeArgument('page'),
+ Argument::createIntTypeArgument('limit', PHP_INT_MAX),
+ ]);
}
if ($this instanceof SearchLoopInterface) {
- $defaultArgs = array_merge($defaultArgs, array(
- Argument::createAnyTypeArgument('search_term'),
- new Argument(
- 'search_in',
- new TypeCollection(
- new EnumListType($this->getSearchIn())
- )
- ),
- new Argument(
- 'search_mode',
- new TypeCollection(
- new EnumType(array(
- SearchLoopInterface::MODE_ANY_WORD,
- SearchLoopInterface::MODE_SENTENCE,
- SearchLoopInterface::MODE_STRICT_SENTENCE,
- ))
+
+ $defaultArgs = array_merge($defaultArgs, [
+ Argument::createAnyTypeArgument('search_term'),
+ new Argument(
+ 'search_in',
+ new TypeCollection(
+ new EnumListType($this->getSearchIn())
+ )
),
- SearchLoopInterface::MODE_STRICT_SENTENCE
- )
- ));
+ new Argument(
+ 'search_mode',
+ new TypeCollection(
+ new EnumType([
+ SearchLoopInterface::MODE_ANY_WORD,
+ SearchLoopInterface::MODE_SENTENCE,
+ SearchLoopInterface::MODE_STRICT_SENTENCE,
+ ])
+ ),
+ SearchLoopInterface::MODE_STRICT_SENTENCE
+ )
+ ]);
}
return $defaultArgs;
}
/**
- * Provides a getter to loop parameters
+ * Provides a getter to loop parameter values
*
- * @param string $name the methode name (only getArgname is supported)
- * @param $arguments this parameter is ignored
+ * @param string $name the method name (only getArgname is supported)
+ * @param mixed $arguments this parameter is ignored
*
- * @return null
+ * @return mixed the argument value
* @throws \InvalidArgumentException if the parameter is unknown or the method name is not supported.
*/
public function __call($name, $arguments)
@@ -148,10 +145,12 @@ abstract class BaseLoop
// camelCase to underscore: getNotEmpty -> not_empty
$argName = strtolower(preg_replace('/([^A-Z])([A-Z])/', "$1_$2", substr($name, 3)));
- return $this->getArg($argName)->getValue();
+ return $this->getArgValue($argName);
}
- throw new \InvalidArgumentException(sprintf("Unsupported magic method %s. only getArgname() is supported.", $name));
+ throw new \InvalidArgumentException(
+ $this->translator->trans("Unsupported magic method %name. only getArgname() is supported.", ['%name' => $name])
+ );
}
/**
@@ -159,12 +158,12 @@ abstract class BaseLoop
*
* @param array $nameValuePairs a array of name => value pairs. The name is the name of the argument.
*
- * @throws \InvalidArgumentException if somùe argument values are missing, or invalid
+ * @throws \InvalidArgumentException if some argument values are missing, or invalid
*/
public function initializeArgs(array $nameValuePairs)
{
- $faultActor = array();
- $faultDetails = array();
+ $faultActor = [];
+ $faultDetails = [];
$loopType = isset($nameValuePairs['type']) ? $nameValuePairs['type'] : "undefined";
$loopName = isset($nameValuePairs['name']) ? $nameValuePairs['name'] : "undefined";
@@ -178,19 +177,38 @@ abstract class BaseLoop
/* check if mandatory */
if ($value === null && $argument->mandatory) {
$faultActor[] = $argument->name;
- $faultDetails[] = sprintf('"%s" parameter is missing in loop type: %s, name: %s', $argument->name, $loopType, $loopName);
- } else if ($value === '') {
+ $faultDetails[] = $this->translator->trans(
+ '"%param" parameter is missing in loop type: %type, name: %name', [
+ '%param' => $argument->name,
+ '%type' => $loopType,
+ '%name' => $loopName
+ ]
+ );
+ } elseif ($value === '') {
if (!$argument->empty) {
/* check if empty */
$faultActor[] = $argument->name;
- $faultDetails[] = sprintf('"%s" parameter cannot be empty in loop type: %s, name: %s', $argument->name, $loopType, $loopName);
+ $faultDetails[] = $this->translator->trans(
+ '"%param" parameter cannot be empty in loop type: %type, name: %name', [
+ '%param' => $argument->name,
+ '%type' => $loopType,
+ '%name' => $loopName
+ ]
+ );
}
} elseif ($value !== null && !$argument->type->isValid($value)) {
/* check type */
$faultActor[] = $argument->name;
- $faultDetails[] = sprintf('Invalid value "%s" for "%s" argument in loop type: %s, name: %s', $value, $argument->name, $loopType, $loopName);
+ $faultDetails[] = $this->translator->trans(
+ 'Invalid value "%value" for "%param" parameter in loop type: %type, name: %name', [
+ '%value' => $value,
+ '%param' => $argument->name,
+ '%type' => $loopType,
+ '%name' => $loopName
+ ]
+ );
} else {
- /* set default */
+ /* set default value */
/* did it as last checking for we consider default value is acceptable no matter type or empty restriction */
if ($value === null) {
$value = $argument->default;
@@ -200,9 +218,9 @@ abstract class BaseLoop
}
}
- if (!empty($faultActor)) {
-
+ if (! empty($faultActor)) {
$complement = sprintf('[%s]', implode(', ', $faultDetails));
+
throw new \InvalidArgumentException($complement);
}
}
@@ -212,15 +230,17 @@ abstract class BaseLoop
*
* @param string $argumentName the argument name
*
- * @throws \InvalidArgumentException if argument is not found in loop argument list
* @return Argument the loop argument.
+ * @throws \InvalidArgumentException if argument is not found in loop argument list
*/
protected function getArg($argumentName)
{
$arg = $this->args->get($argumentName);
if ($arg === null)
- throw new \InvalidArgumentException("Undefined loop argument '$argumentName'");
+ throw new \InvalidArgumentException(
+ $this->translator->trans('Undefined loop argument "%name"', ['%name' => $argumentName])
+ );
return $arg;
}
@@ -231,7 +251,7 @@ abstract class BaseLoop
* @param string $argumentName the argument name
*
* @throws \InvalidArgumentException if argument is not found in loop argument list
- * @return Argument the loop argument.
+ * @return mixed the loop argument value
*/
protected function getArgValue($argumentName)
{
@@ -239,20 +259,24 @@ abstract class BaseLoop
}
/**
- * @param ModelCriteria $search
- * @param null $pagination
+ * @param ModelCriteria $search the search request
+ * @param PropelModelPager $pagination the pagination part
*
- * @return array|mixed|\PropelModelPager|\PropelObjectCollection
+ * @return array|PropelModelPager|ObjectCollection
+ * @throws \InvalidArgumentException if the search mode is undefined.
*/
protected function search(ModelCriteria $search, &$pagination = null)
{
if (false === $this->countable) {
return $search->find();
}
+
if ($this instanceof SearchLoopInterface) {
- $searchTerm = $this->getSearch_term();
- $searchIn = $this->getSearch_in();
- $searchMode = $this->getSearch_mode();
+
+ $searchTerm = $this->getArgValue('search_term');
+ $searchIn = $this->getArgValue('search_in');
+ $searchMode = $this->getArgValue('search_mode');
+
if (null !== $searchTerm && null !== $searchIn) {
switch ($searchMode) {
@@ -267,6 +291,10 @@ abstract class BaseLoop
case SearchLoopInterface::MODE_STRICT_SENTENCE:
$searchCriteria = Criteria::EQUAL;
break;
+ default:
+ throw new \InvalidArgumentException(
+ $this->translator->trans("Undefined search mode '%mode'", ['%mode' => $searchMode])
+ );
}
$this->doSearch($search, $searchTerm, $searchIn, $searchCriteria);
@@ -280,24 +308,31 @@ abstract class BaseLoop
}
}
- protected function searchArray(array $search, &$pagination = null)
+ protected function searchArray(array $search)
{
if (false === $this->countable) {
return $search;
}
+
+ $limit = intval($this->getArgValue('limit'));
+ $offset = intval($this->getArgValue('offset'));
+
if ($this->getArgValue('page') !== null) {
- $nbPage = ceil(count($search)/$this->getArgValue('limit'));
- if ($this->getArgValue('page') > $nbPage || $this->getArgValue('page') <= 0) {
- return array();
+ $pageNum = intval($this->getArgValue('page'));
+
+ $totalPageCount = ceil(count($search) / $limit);
+
+ if ($pageNum > $totalPageCount || $pageNum <= 0) {
+ return [];
}
- $firstItem = ($this->getArgValue('page')-1) * $this->getArgValue('limit') + 1;
+ $firstItem = ($pageNum - 1) * $limit + 1;
- return array_slice($search, $firstItem, $firstItem + $this->getArgValue('limit'), false);
+ return array_slice($search, $firstItem, $firstItem + $limit, false);
} else {
- return array_slice($search, $this->getArgValue('offset'), $this->getArgValue('limit'), false);
+ return array_slice($search, $offset, $limit, false);
}
}
@@ -305,30 +340,36 @@ abstract class BaseLoop
/**
* @param ModelCriteria $search
*
- * @return array|mixed|\PropelObjectCollection
+ * @return ObjectCollection
*/
protected function searchWithOffset(ModelCriteria $search)
{
- if ($this->getArgValue('limit') >= 0) {
- $search->limit($this->getArgValue('limit'));
+ $limit = intval($this->getArgValue('limit'));
+
+ if ($limit >= 0) {
+ $search->limit($limit);
}
- $search->offset($this->getArgValue('offset'));
+
+ $search->offset(intval($this->getArgValue('offset')));
return $search->find();
}
/**
- * @param ModelCriteria $search
- * @param $pagination
+ * @param ModelCriteria $search
+ * @param PropelModelPager $pagination
*
- * @return array|\Propel\Runtime\Util\PropelModelPager
+ * @return array|PropelModelPager
*/
protected function searchWithPagination(ModelCriteria $search, &$pagination)
{
- $pagination = $search->paginate($this->getArgValue('page'), $this->getArgValue('limit'));
+ $page = intval($this->getArgValue('page'));
+ $limit = intval($this->getArgValue('limit'));
- if ($this->getArgValue('page') > $pagination->getLastPage()) {
- return array();
+ $pagination = $search->paginate($page, $limit);
+
+ if ($page > $pagination->getLastPage()) {
+ return [];
} else {
return $pagination;
}
@@ -361,18 +402,21 @@ abstract class BaseLoop
}
/**
- * @param $pagination
+ * @param PropelModelPager $pagination
+ *
* @return LoopResult
*/
public function exec(&$pagination)
{
$hash = $this->args->getHash();
if (false === isset(self::$cacheLoopResult[$hash])) {
+
+ $results = [];
+
if ($this instanceof PropelSearchLoopInterface) {
$searchModelCriteria = $this->buildModelCriteria();
- if (null === $searchModelCriteria) {
- $results = array();
- } else {
+
+ if (null !== $searchModelCriteria) {
$results = $this->search(
$searchModelCriteria,
$pagination
@@ -380,13 +424,9 @@ abstract class BaseLoop
}
} elseif ($this instanceof ArraySearchLoopInterface) {
$searchArray = $this->buildArray();
- if (null === $searchArray) {
- $results = array();
- } else {
- $results = $this->searchArray(
- $searchArray,
- $pagination
- );
+
+ if (null !== $searchArray) {
+ $results = $this->searchArray($searchArray);
}
}
@@ -416,30 +456,49 @@ abstract class BaseLoop
* - ArraySearchLoopInterface
*/
$searchInterface = false;
+
if ($this instanceof PropelSearchLoopInterface) {
if (true === $searchInterface) {
- throw new LoopException('Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::MULTIPLE_SEARCH_INTERFACE);
+ throw new LoopException(
+ $this->translator->trans(
+ 'Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`'
+ ),
+ LoopException::MULTIPLE_SEARCH_INTERFACE);
}
$searchInterface = true;
}
+
if ($this instanceof ArraySearchLoopInterface) {
if (true === $searchInterface) {
- throw new LoopException('Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::MULTIPLE_SEARCH_INTERFACE);
+ throw new LoopException(
+ $this->translator->trans(
+ 'Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`'
+ ),
+ LoopException::MULTIPLE_SEARCH_INTERFACE);
}
$searchInterface = true;
}
if (false === $searchInterface) {
- throw new LoopException('Loop must implements one of the following interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::SEARCH_INTERFACE_NOT_FOUND);
+ throw new LoopException(
+ $this->translator->trans(
+ 'Loop must implements one of the following interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`'
+ ),
+ LoopException::SEARCH_INTERFACE_NOT_FOUND);
}
/* Only PropelSearch allows timestamp and version */
if (!$this instanceof PropelSearchLoopInterface) {
if (true === $this->timestampable) {
- throw new LoopException("Loop must implements 'PropelSearchLoopInterface' to be timestampable", LoopException::NOT_TIMESTAMPED);
+ throw new LoopException(
+ $this->translator->trans("Loop must implements 'PropelSearchLoopInterface' to be timestampable"),
+ LoopException::NOT_TIMESTAMPED);
}
+
if (true === $this->versionable) {
- throw new LoopException("Loop must implements 'PropelSearchLoopInterface' to be versionable", LoopException::NOT_VERSIONED);
+ throw new LoopException(
+ $this->translator->trans("Loop must implements 'PropelSearchLoopInterface' to be versionable"),
+ LoopException::NOT_VERSIONED);
}
}
}
@@ -452,15 +511,14 @@ abstract class BaseLoop
abstract public function parseResults(LoopResult $loopResult);
/**
- *
- * define all args used in your loop
- *
+ * Definition of loop arguments
*
* example :
*
* public function getArgDefinitions()
* {
* return new ArgumentCollection(
+ *
* Argument::createIntListTypeArgument('id'),
* new Argument(
* 'ref',
@@ -470,14 +528,7 @@ abstract class BaseLoop
* ),
* Argument::createIntListTypeArgument('category'),
* Argument::createBooleanTypeArgument('new'),
- * Argument::createBooleanTypeArgument('promo'),
- * Argument::createFloatTypeArgument('min_price'),
- * Argument::createFloatTypeArgument('max_price'),
- * Argument::createIntTypeArgument('min_stock'),
- * Argument::createFloatTypeArgument('min_weight'),
- * Argument::createFloatTypeArgument('max_weight'),
- * Argument::createBooleanTypeArgument('current'),
- *
+ * ...
* );
* }
*
diff --git a/core/lib/Thelia/Core/Template/Element/Exception/ElementNotFoundException.php b/core/lib/Thelia/Core/Template/Element/Exception/ElementNotFoundException.php
index 0f9972e97..1d8359c6c 100644
--- a/core/lib/Thelia/Core/Template/Element/Exception/ElementNotFoundException.php
+++ b/core/lib/Thelia/Core/Template/Element/Exception/ElementNotFoundException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Element\Exception;
diff --git a/core/lib/Thelia/Core/Template/Element/Exception/InvalidElementException.php b/core/lib/Thelia/Core/Template/Element/Exception/InvalidElementException.php
index b77f76a09..244da4c5f 100644
--- a/core/lib/Thelia/Core/Template/Element/Exception/InvalidElementException.php
+++ b/core/lib/Thelia/Core/Template/Element/Exception/InvalidElementException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Element\Exception;
diff --git a/core/lib/Thelia/Core/Template/Element/Exception/LoopException.php b/core/lib/Thelia/Core/Template/Element/Exception/LoopException.php
index cc6340df3..79648e331 100644
--- a/core/lib/Thelia/Core/Template/Element/Exception/LoopException.php
+++ b/core/lib/Thelia/Core/Template/Element/Exception/LoopException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Element\Exception;
diff --git a/core/lib/Thelia/Core/Template/Element/Exception/SearchLoopException.php b/core/lib/Thelia/Core/Template/Element/Exception/SearchLoopException.php
index f1ce6657f..ed972b16b 100644
--- a/core/lib/Thelia/Core/Template/Element/Exception/SearchLoopException.php
+++ b/core/lib/Thelia/Core/Template/Element/Exception/SearchLoopException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Element\Exception;
diff --git a/core/lib/Thelia/Core/Template/Element/LoopResult.php b/core/lib/Thelia/Core/Template/Element/LoopResult.php
index 66a972872..bd658e02c 100644
--- a/core/lib/Thelia/Core/Template/Element/LoopResult.php
+++ b/core/lib/Thelia/Core/Template/Element/LoopResult.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Element;
diff --git a/core/lib/Thelia/Core/Template/Element/LoopResultRow.php b/core/lib/Thelia/Core/Template/Element/LoopResultRow.php
index d908c92c3..5d30e4609 100644
--- a/core/lib/Thelia/Core/Template/Element/LoopResultRow.php
+++ b/core/lib/Thelia/Core/Template/Element/LoopResultRow.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Element;
diff --git a/core/lib/Thelia/Core/Template/Element/PropelSearchLoopInterface.php b/core/lib/Thelia/Core/Template/Element/PropelSearchLoopInterface.php
index 7bcb5614c..5c794b68d 100644
--- a/core/lib/Thelia/Core/Template/Element/PropelSearchLoopInterface.php
+++ b/core/lib/Thelia/Core/Template/Element/PropelSearchLoopInterface.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template\Element;
/**
diff --git a/core/lib/Thelia/Core/Template/Element/SearchLoopInterface.php b/core/lib/Thelia/Core/Template/Element/SearchLoopInterface.php
index 26a154e15..290a59995 100644
--- a/core/lib/Thelia/Core/Template/Element/SearchLoopInterface.php
+++ b/core/lib/Thelia/Core/Template/Element/SearchLoopInterface.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template\Element;
/**
diff --git a/core/lib/Thelia/Core/Template/Exception/ResourceNotFoundException.php b/core/lib/Thelia/Core/Template/Exception/ResourceNotFoundException.php
index 37856c620..1a733efbd 100644
--- a/core/lib/Thelia/Core/Template/Exception/ResourceNotFoundException.php
+++ b/core/lib/Thelia/Core/Template/Exception/ResourceNotFoundException.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template\Exception;
class ResourceNotFoundException extends \RuntimeException
diff --git a/core/lib/Thelia/Core/Template/Loop/Accessory.php b/core/lib/Thelia/Core/Template/Loop/Accessory.php
index 5238b6fbb..d96208eb8 100644
--- a/core/lib/Thelia/Core/Template/Loop/Accessory.php
+++ b/core/lib/Thelia/Core/Template/Loop/Accessory.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Address.php b/core/lib/Thelia/Core/Template/Loop/Address.php
index 8bb4f4f9c..6daf7029f 100644
--- a/core/lib/Thelia/Core/Template/Loop/Address.php
+++ b/core/lib/Thelia/Core/Template/Loop/Address.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Admin.php b/core/lib/Thelia/Core/Template/Loop/Admin.php
index b5ac7d8b8..36125b401 100644
--- a/core/lib/Thelia/Core/Template/Loop/Admin.php
+++ b/core/lib/Thelia/Core/Template/Loop/Admin.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Area.php b/core/lib/Thelia/Core/Template/Loop/Area.php
index 6ac3b1518..5653c787e 100644
--- a/core/lib/Thelia/Core/Template/Loop/Area.php
+++ b/core/lib/Thelia/Core/Template/Loop/Area.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -77,7 +66,8 @@ class Area extends BaseLoop implements PropelSearchLoopInterface
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createIntTypeArgument('with_zone'),
- Argument::createIntTypeArgument('without_zone')
+ Argument::createIntTypeArgument('without_zone'),
+ Argument::createBooleanOrBothTypeArgument('unassigned')
);
}
@@ -106,6 +96,14 @@ class Area extends BaseLoop implements PropelSearchLoopInterface
->where('`without_zone`.delivery_module_id '.Criteria::ISNULL);
}
+ $notAssigned = $this->getUnassigned();
+
+ if ($notAssigned) {
+ $search
+ ->joinAreaDeliveryModule('unassigned', Criteria::LEFT_JOIN)
+ ->where('`unassigned`.delivery_module_id ' . Criteria::ISNULL);
+ }
+
return $search;
}
diff --git a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php
index 56100e490..9de14b6a8 100644
--- a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php
+++ b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop\Argument;
diff --git a/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php b/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php
index c272592eb..5cb91ebf4 100644
--- a/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php
+++ b/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template\Loop\Argument;
/**
diff --git a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php
index 1184210ea..d1e8fc97d 100644
--- a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php
+++ b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Attribute.php b/core/lib/Thelia/Core/Template/Loop/Attribute.php
index a973aade0..451993de0 100644
--- a/core/lib/Thelia/Core/Template/Loop/Attribute.php
+++ b/core/lib/Thelia/Core/Template/Loop/Attribute.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php b/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php
index 81f01f6da..933ebcdce 100644
--- a/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php
+++ b/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php b/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php
index 7fad6bd34..f39adb95b 100644
--- a/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php
+++ b/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Auth.php b/core/lib/Thelia/Core/Template/Loop/Auth.php
index 667d5dfd2..b81601c14 100644
--- a/core/lib/Thelia/Core/Template/Loop/Auth.php
+++ b/core/lib/Thelia/Core/Template/Loop/Auth.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -71,8 +60,7 @@ class Auth extends BaseLoop implements ArraySearchLoopInterface
new TypeCollection(
new EnumListType(array(AccessManager::VIEW, AccessManager::CREATE, AccessManager::UPDATE, AccessManager::DELETE))
)
- ),
- Argument::createAnyTypeArgument('context', 'front', false)
+ )
);
}
diff --git a/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php b/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php
index ae7226152..de7a66454 100644
--- a/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php
+++ b/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Cart.php b/core/lib/Thelia/Core/Template/Loop/Cart.php
index 02a3fada6..d01cb3df0 100644
--- a/core/lib/Thelia/Core/Template/Loop/Cart.php
+++ b/core/lib/Thelia/Core/Template/Loop/Cart.php
@@ -1,11 +1,14 @@
set("TITLE", $product->getTitle());
$loopResultRow->set("REF", $product->getRef());
$loopResultRow->set("QUANTITY", $cartItem->getQuantity());
- $loopResultRow->set("PRICE", $cartItem->getPrice());
$loopResultRow->set("PRODUCT_ID", $product->getId());
$loopResultRow->set("PRODUCT_URL", $product->getUrl($this->request->getSession()->getLang()->getLocale()))
->set("STOCK", $productSaleElement->getQuantity())
diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php
index b5dbd4de0..9dbb3ea2a 100644
--- a/core/lib/Thelia/Core/Template/Loop/Category.php
+++ b/core/lib/Thelia/Core/Template/Loop/Category.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/CategoryPath.php b/core/lib/Thelia/Core/Template/Loop/CategoryPath.php
index d70654d0b..4610949b8 100644
--- a/core/lib/Thelia/Core/Template/Loop/CategoryPath.php
+++ b/core/lib/Thelia/Core/Template/Loop/CategoryPath.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -65,7 +54,6 @@ class CategoryPath extends BaseI18nLoop implements ArraySearchLoopInterface
return new ArgumentCollection(
Argument::createIntTypeArgument('category', null, true),
Argument::createIntTypeArgument('depth'),
- Argument::createIntTypeArgument('level'),
Argument::createBooleanOrBothTypeArgument('visible', true, false)
);
}
diff --git a/core/lib/Thelia/Core/Template/Loop/CategoryTree.php b/core/lib/Thelia/Core/Template/Loop/CategoryTree.php
index 35a9569f9..2cc4435b7 100644
--- a/core/lib/Thelia/Core/Template/Loop/CategoryTree.php
+++ b/core/lib/Thelia/Core/Template/Loop/CategoryTree.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Config.php b/core/lib/Thelia/Core/Template/Loop/Config.php
index f656c6d51..8cbfea5e7 100644
--- a/core/lib/Thelia/Core/Template/Loop/Config.php
+++ b/core/lib/Thelia/Core/Template/Loop/Config.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php
index ee028e16d..377737088 100644
--- a/core/lib/Thelia/Core/Template/Loop/Content.php
+++ b/core/lib/Thelia/Core/Template/Loop/Content.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -64,6 +53,7 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
Argument::createIntListTypeArgument('folder_default'),
Argument::createBooleanTypeArgument('current'),
Argument::createBooleanTypeArgument('current_folder'),
+ Argument::createBooleanTypeArgument('with_prev_next_info', false),
Argument::createIntTypeArgument('depth', 1),
Argument::createBooleanOrBothTypeArgument('visible', 1),
Argument::createAnyTypeArgument('title'),
@@ -212,9 +202,10 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
public function parseResults(LoopResult $loopResult)
{
+ /** @var \Thelia\Model\Content $content */
foreach ($loopResult->getResultDataCollection() as $content) {
$loopResultRow = new LoopResultRow($content);
-
+ $defaultFolderId = $content->getDefaultFolderId();
$loopResultRow->set("ID" , $content->getId())
->set("IS_TRANSLATED" , $content->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $this->locale)
@@ -227,16 +218,54 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
->set("META_DESCRIPTION" , $content->getVirtualColumn('i18n_META_DESCRIPTION'))
->set("META_KEYWORDS" , $content->getVirtualColumn('i18n_META_KEYWORDS'))
->set("POSITION" , $content->getPosition())
- ->set("DEFAULT_FOLDER" , $content->getDefaultFolderId())
+ ->set("DEFAULT_FOLDER" , $defaultFolderId)
->set("VISIBLE" , $content->getVisible())
;
- $loopResult->addRow($loopResultRow);
+ $loopResult->addRow($this->findNextPrev($loopResultRow, $content, $defaultFolderId));
}
return $loopResult;
}
+ /**
+ * @param LoopResultRow $loopResultRow
+ * @param \Thelia\Model\Content $content
+ * @param $defaultFolderId
+ * @return LoopResultRow
+ */
+ private function findNextPrev(LoopResultRow $loopResultRow, \Thelia\Model\Content $content, $defaultFolderId)
+ {
+ if ($this->getBackend_context() || $this->getWithPrevNextInfo()) {
+
+ // Find previous and next category
+ $previous = ContentQuery::create()
+ ->joinContentFolder()
+ ->where('ContentFolder.folder_id = ?', $defaultFolderId)
+ ->filterByPosition($content->getPosition(), Criteria::LESS_THAN)
+ ->orderByPosition(Criteria::DESC)
+ ->findOne()
+ ;
+
+ $next = ContentQuery::create()
+ ->joinContentFolder()
+ ->where('ContentFolder.folder_id = ?', $defaultFolderId)
+ ->filterByPosition($content->getPosition(), Criteria::GREATER_THAN)
+ ->orderByPosition(Criteria::ASC)
+ ->findOne()
+ ;
+
+ $loopResultRow
+ ->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
+ ->set("HAS_NEXT" , $next != null ? 1 : 0)
+ ->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
+ ->set("NEXT" , $next != null ? $next->getId() : -1)
+ ;
+ }
+
+ return $loopResultRow;
+ }
+
}
diff --git a/core/lib/Thelia/Core/Template/Loop/Country.php b/core/lib/Thelia/Core/Template/Loop/Country.php
index 8676e03af..16d2f5da4 100644
--- a/core/lib/Thelia/Core/Template/Loop/Country.php
+++ b/core/lib/Thelia/Core/Template/Loop/Country.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Coupon.php b/core/lib/Thelia/Core/Template/Loop/Coupon.php
index 53ecfa5c3..6885463eb 100644
--- a/core/lib/Thelia/Core/Template/Loop/Coupon.php
+++ b/core/lib/Thelia/Core/Template/Loop/Coupon.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -36,6 +25,9 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Coupon\Type\CouponInterface;
use Thelia\Model\Coupon as MCoupon;
use Thelia\Model\CouponQuery;
+use Thelia\Model\Map\CouponTableMap;
+use Thelia\Type\EnumListType;
+use Thelia\Type\TypeCollection;
/**
* Coupon Loop
@@ -55,7 +47,23 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
- Argument::createBooleanOrBothTypeArgument('is_enabled')
+ Argument::createBooleanOrBothTypeArgument('is_enabled'),
+ new Argument(
+ 'order',
+ new TypeCollection(
+ new EnumListType(array(
+ 'id', 'id-reverse',
+ 'code', 'code-reverse',
+ 'title', 'title-reverse',
+ 'enabled', 'enabled-reverse',
+ 'expiration-date', 'expiration-date-reverse',
+ 'days-left', 'days-left-reverse',
+ 'usages-left', 'usages-left-reverse'
+ )
+ )
+ ),
+ 'code'
+ )
);
}
@@ -77,6 +85,63 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
$search->filterByIsEnabled($isEnabled ? true : false);
}
+ $search->addAsColumn('days_left', 'DATEDIFF('.CouponTableMap::EXPIRATION_DATE.', CURDATE()) - 1');
+
+ $orders = $this->getOrder();
+
+ foreach ($orders as $order) {
+ switch ($order) {
+ case 'id':
+ $search->orderById(Criteria::ASC);
+ break;
+ case 'id-reverse':
+ $search->orderById(Criteria::DESC);
+ break;
+
+ case 'code':
+ $search->orderByCode(Criteria::ASC);
+ break;
+ case 'code-reverse':
+ $search->orderByCode(Criteria::DESC);
+ break;
+
+ case 'title':
+ $search->addAscendingOrderByColumn('i18n_TITLE');
+ break;
+ case 'title-reverse':
+ $search->addDescendingOrderByColumn('i18n_TITLE');
+ break;
+
+ case 'enabled':
+ $search->orderByIsEnabled(Criteria::ASC);
+ break;
+ case 'enabled-reverse':
+ $search->orderByIsEnabled(Criteria::DESC);
+ break;
+
+ case 'expiration-date':
+ $search->orderByExpirationDate(Criteria::ASC);
+ break;
+ case 'expiration-date-reverse':
+ $search->orderByExpirationDate(Criteria::DESC);
+ break;
+
+ case 'usages-left':
+ $search->orderByMaxUsage(Criteria::ASC);
+ break;
+ case 'usages-left-reverse':
+ $search->orderByMaxUsage(Criteria::DESC);
+ break;
+
+ case 'days-left':
+ $search->addAscendingOrderByColumn('days_left');
+ break;
+ case 'days-left-reverse':
+ $search->addDescendingOrderByColumn('days_left');
+ break;
+ }
+ }
+
return $search;
}
@@ -92,7 +157,9 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
/** @var MCoupon $coupon */
foreach ($loopResult->getResultDataCollection() as $coupon) {
+
$loopResultRow = new LoopResultRow($coupon);
+
$conditions = $conditionFactory->unserializeConditionCollection(
$coupon->getSerializedConditions()
);
@@ -114,10 +181,6 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
$coupon->getExpirationDate()
);
- $now = time();
- $datediff = $coupon->getExpirationDate()->getTimestamp() - $now;
- $daysLeftBeforeExpiration = floor($datediff/(60*60*24));
-
$cleanedConditions = array();
/** @var ConditionInterface $condition */
foreach ($conditions as $condition) {
@@ -127,14 +190,16 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
);
$cleanedConditions[] = $temp;
}
- $loopResultRow->set("ID", $coupon->getId())
+
+ $loopResultRow
+ ->set("ID", $coupon->getId())
->set("IS_TRANSLATED", $coupon->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE", $this->locale)
->set("CODE", $coupon->getCode())
->set("TITLE", $coupon->getVirtualColumn('i18n_TITLE'))
->set("SHORT_DESCRIPTION", $coupon->getVirtualColumn('i18n_SHORT_DESCRIPTION'))
->set("DESCRIPTION", $coupon->getVirtualColumn('i18n_DESCRIPTION'))
- ->set("EXPIRATION_DATE", $coupon->getExpirationDate($lang->getDateFormat()))
+ ->set("EXPIRATION_DATE", $coupon->getExpirationDate())
->set("USAGE_LEFT", $coupon->getMaxUsage())
->set("IS_CUMULATIVE", $coupon->getIsCumulative())
->set("IS_REMOVING_POSTAGE", $coupon->getIsRemovingPostage())
@@ -143,7 +208,7 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
->set("AMOUNT", $coupon->getAmount())
->set("APPLICATION_CONDITIONS", $cleanedConditions)
->set("TOOLTIP", $couponManager->getToolTip())
- ->set("DAY_LEFT_BEFORE_EXPIRATION", $daysLeftBeforeExpiration)
+ ->set("DAY_LEFT_BEFORE_EXPIRATION", max(0, $coupon->getVirtualColumn('days_left')))
->set("SERVICE_ID", $couponManager->getServiceId());
$loopResult->addRow($loopResultRow);
}
diff --git a/core/lib/Thelia/Core/Template/Loop/Currency.php b/core/lib/Thelia/Core/Template/Loop/Currency.php
index 3d7a5631e..9eb6aa970 100644
--- a/core/lib/Thelia/Core/Template/Loop/Currency.php
+++ b/core/lib/Thelia/Core/Template/Loop/Currency.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Customer.php b/core/lib/Thelia/Core/Template/Loop/Customer.php
index d4b8effb0..99886113e 100644
--- a/core/lib/Thelia/Core/Template/Loop/Customer.php
+++ b/core/lib/Thelia/Core/Template/Loop/Customer.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -67,19 +56,26 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop
Argument::createBooleanTypeArgument('reseller'),
Argument::createIntTypeArgument('sponsor'),
new Argument(
- 'order',
- new TypeCollection(
- new Type\EnumListType(array(
- 'id', 'id_reverse',
- 'reference', 'reference_reverse',
- 'firstname', 'firstname_reverse',
- 'lastname', 'lastname_reverse',
- 'last_order', 'last_order_reverse',
- 'order_amount', 'order_amount_reverse',
- 'registration_date', 'registration_date_reverse'
- ))
- ),
- 'lastname'
+ 'order',
+ new TypeCollection(
+ new Type\EnumListType(array(
+ 'id',
+ 'id_reverse',
+ 'reference',
+ 'reference_reverse',
+ 'firstname',
+ 'firstname_reverse',
+ 'lastname',
+ 'lastname_reverse',
+ 'last_order',
+ 'last_order_reverse',
+ 'order_amount',
+ 'order_amount_reverse',
+ 'registration_date',
+ 'registration_date_reverse'
+ ))
+ ),
+ 'lastname'
)
);
}
@@ -166,7 +162,7 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop
$search->filterBySponsor($sponsor, Criteria::EQUAL);
}
- $orders = $this->getOrder();
+ $orders = $this->getOrder();
foreach ($orders as $order) {
switch ($order) {
@@ -219,19 +215,15 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop
$loopResultRow = new LoopResultRow($customer);
$loopResultRow
- ->set("ID" , $customer->getId())
- ->set("REF" , $customer->getRef())
- ->set("TITLE" , $customer->getTitleId())
- ->set("FIRSTNAME" , $customer->getFirstname())
- ->set("LASTNAME" , $customer->getLastname())
- ->set("EMAIL" , $customer->getEmail())
- ->set("RESELLER" , $customer->getReseller())
- ->set("SPONSOR" , $customer->getSponsor())
- ->set("DISCOUNT" , $customer->getDiscount())
-
- ->set("LAST_ORDER_DATE" , $lastOrder != null ? $lastOrder->getCreatedAt() : '')
- ->set("LAST_ORDER_AMOUNT" , $lastOrder != null ? $lastOrder->getCreatedAt() : '')
- ->set("LAST_ORDER_CURRENCY" , $lastOrder != null ? $lastOrder->getCreatedAt() : '')
+ ->set("ID", $customer->getId())
+ ->set("REF", $customer->getRef())
+ ->set("TITLE", $customer->getTitleId())
+ ->set("FIRSTNAME", $customer->getFirstname())
+ ->set("LASTNAME", $customer->getLastname())
+ ->set("EMAIL", $customer->getEmail())
+ ->set("RESELLER", $customer->getReseller())
+ ->set("SPONSOR", $customer->getSponsor())
+ ->set("DISCOUNT", $customer->getDiscount())
;
$loopResult->addRow($loopResultRow);
diff --git a/core/lib/Thelia/Core/Template/Loop/Delivery.php b/core/lib/Thelia/Core/Template/Loop/Delivery.php
index 2e7391c95..6bdcf1a6e 100644
--- a/core/lib/Thelia/Core/Template/Loop/Delivery.php
+++ b/core/lib/Thelia/Core/Template/Loop/Delivery.php
@@ -1,34 +1,25 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
-use Thelia\Exception\OrderException;
+use Thelia\Model\AreaDeliveryModuleQuery;
use Thelia\Model\CountryQuery;
+use Thelia\Model\Module;
use Thelia\Module\BaseModule;
use Thelia\Module\DeliveryModuleInterface;
+use Thelia\Module\Exception\DeliveryException;
/**
* Class Delivery
@@ -62,9 +53,17 @@ class Delivery extends BaseSpecificModule
$country = $this->container->get('thelia.taxEngine')->getDeliveryCountry();
}
+ /** @var Module $deliveryModule */
foreach ($loopResult->getResultDataCollection() as $deliveryModule) {
+
+ $areaDeliveryModule = AreaDeliveryModuleQuery::create()
+ ->findByCountryAndModule($country, $deliveryModule);
+
+ if (null === $areaDeliveryModule) continue;
+
$loopResultRow = new LoopResultRow($deliveryModule);
+ /** @var DeliveryModuleInterface $moduleInstance */
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
if (false === $moduleInstance instanceof DeliveryModuleInterface) {
@@ -72,28 +71,27 @@ class Delivery extends BaseSpecificModule
}
try {
- $postage = $moduleInstance->getPostage($country);
- } catch (OrderException $e) {
- switch ($e->getCode()) {
- case OrderException::DELIVERY_MODULE_UNAVAILABLE:
- /* do not show this delivery module */
- continue(2);
- break;
- default:
- throw $e;
+ // Check if module is valid, by calling isValidDelivery(),
+ // or catching a DeliveryException.
+
+ if ($moduleInstance->isValidDelivery($country)) {
+
+ $postage = $moduleInstance->getPostage($country);
+
+ $loopResultRow
+ ->set('ID', $deliveryModule->getId())
+ ->set('TITLE', $deliveryModule->getVirtualColumn('i18n_TITLE'))
+ ->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
+ ->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
+ ->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
+ ->set('POSTAGE', $postage)
+ ;
+
+ $loopResult->addRow($loopResultRow);
}
+ } catch (DeliveryException $ex) {
+ // Module is not available
}
-
- $loopResultRow
- ->set('ID', $deliveryModule->getId())
- ->set('TITLE', $deliveryModule->getVirtualColumn('i18n_TITLE'))
- ->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
- ->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
- ->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
- ->set('POSTAGE', $postage)
- ;
-
- $loopResult->addRow($loopResultRow);
}
return $loopResult;
diff --git a/core/lib/Thelia/Core/Template/Loop/Document.php b/core/lib/Thelia/Core/Template/Loop/Document.php
index 0353b8df6..3e4063d7b 100644
--- a/core/lib/Thelia/Core/Template/Loop/Document.php
+++ b/core/lib/Thelia/Core/Template/Loop/Document.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -83,7 +72,8 @@ class Document extends BaseI18nLoop implements PropelSearchLoopInterface
new EnumType($this->possible_sources)
)
),
- Argument::createIntTypeArgument('source_id')
+ Argument::createIntTypeArgument('source_id'),
+ Argument::createBooleanTypeArgument('force_return', true)
);
// Add possible document sources
@@ -262,7 +252,7 @@ class Document extends BaseI18nLoop implements PropelSearchLoopInterface
$loopResult->addRow($loopResultRow);
} catch (\Exception $ex) {
// Ignore the result and log an error
- Tlog::getInstance()->addError(sprintf("Failed to process document in document loop: %s", $ex->getMessage()), $this->args);
+ Tlog::getInstance()->addError(sprintf("Failed to process document in document loop: %s", $ex->getMessage()));
}
}
diff --git a/core/lib/Thelia/Core/Template/Loop/Feature.php b/core/lib/Thelia/Core/Template/Loop/Feature.php
index 74d165562..838f427ce 100644
--- a/core/lib/Thelia/Core/Template/Loop/Feature.php
+++ b/core/lib/Thelia/Core/Template/Loop/Feature.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php b/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php
index 96c65713d..dbf7a97d7 100644
--- a/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php
+++ b/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php
index 2341db00a..d8f25d04b 100644
--- a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php
+++ b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Feed.php b/core/lib/Thelia/Core/Template/Loop/Feed.php
index 90a6ffa41..8effe48a6 100644
--- a/core/lib/Thelia/Core/Template/Loop/Feed.php
+++ b/core/lib/Thelia/Core/Template/Loop/Feed.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php
index fa561b3fb..7b6906e32 100644
--- a/core/lib/Thelia/Core/Template/Loop/Folder.php
+++ b/core/lib/Thelia/Core/Template/Loop/Folder.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/FolderPath.php b/core/lib/Thelia/Core/Template/Loop/FolderPath.php
index b50d7c55d..e8b7dc451 100644
--- a/core/lib/Thelia/Core/Template/Loop/FolderPath.php
+++ b/core/lib/Thelia/Core/Template/Loop/FolderPath.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -75,7 +64,6 @@ class FolderPath extends BaseI18nLoop implements ArraySearchLoopInterface
return new ArgumentCollection(
Argument::createIntTypeArgument('folder', null, true),
Argument::createIntTypeArgument('depth'),
- Argument::createIntTypeArgument('level'),
Argument::createBooleanOrBothTypeArgument('visible', true, false)
);
}
diff --git a/core/lib/Thelia/Core/Template/Loop/FolderTree.php b/core/lib/Thelia/Core/Template/Loop/FolderTree.php
index 851b6d8ff..1cb7b487c 100644
--- a/core/lib/Thelia/Core/Template/Loop/FolderTree.php
+++ b/core/lib/Thelia/Core/Template/Loop/FolderTree.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Image.php b/core/lib/Thelia/Core/Template/Loop/Image.php
index 157259f30..2a94655b3 100644
--- a/core/lib/Thelia/Core/Template/Loop/Image.php
+++ b/core/lib/Thelia/Core/Template/Loop/Image.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -316,7 +305,7 @@ class Image extends BaseI18nLoop implements PropelSearchLoopInterface
$loopResult->addRow($loopResultRow);
} catch (\Exception $ex) {
// Ignore the result and log an error
- Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args);
+ Tlog::getInstance()->addError(sprintf("Failed to process image in image loop: %s", $ex->getMessage()));
}
}
diff --git a/core/lib/Thelia/Core/Template/Loop/Lang.php b/core/lib/Thelia/Core/Template/Loop/Lang.php
index 64066ab89..6cafddb45 100644
--- a/core/lib/Thelia/Core/Template/Loop/Lang.php
+++ b/core/lib/Thelia/Core/Template/Loop/Lang.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Message.php b/core/lib/Thelia/Core/Template/Loop/Message.php
index 4594dd4d2..987bf2469 100644
--- a/core/lib/Thelia/Core/Template/Loop/Message.php
+++ b/core/lib/Thelia/Core/Template/Loop/Message.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Module.php b/core/lib/Thelia/Core/Template/Loop/Module.php
index 8c4703c24..b10c1f1ad 100644
--- a/core/lib/Thelia/Core/Template/Loop/Module.php
+++ b/core/lib/Thelia/Core/Template/Loop/Module.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -177,65 +166,81 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
public function parseResults(LoopResult $loopResult)
{
+ /** @var \Thelia\Model\Module $module */
foreach ($loopResult->getResultDataCollection() as $module) {
- $loopResultRow = new LoopResultRow($module);
- $loopResultRow->set("ID", $module->getId())
- ->set("IS_TRANSLATED",$module->getVirtualColumn('IS_TRANSLATED'))
- ->set("LOCALE",$this->locale)
- ->set("TITLE",$module->getVirtualColumn('i18n_TITLE'))
- ->set("CHAPO", $module->getVirtualColumn('i18n_CHAPO'))
- ->set("DESCRIPTION", $module->getVirtualColumn('i18n_DESCRIPTION'))
- ->set("POSTSCRIPTUM", $module->getVirtualColumn('i18n_POSTSCRIPTUM'))
- ->set("CODE", $module->getCode())
- ->set("TYPE", $module->getType())
- ->set("ACTIVE", $module->getActivate())
- ->set("CLASS", $module->getFullNamespace())
- ->set("POSITION", $module->getPosition());
- $hasConfigurationInterface = false;
+ try {
+ new \ReflectionClass($module->getFullNamespace());
- /* first test if module defines it's own config route */
- if ($module->getActivate()) {
- // Works only fo activated modules - see Thelia\Core\DependencyInjection\Compiler\RegisterRouterPass
- $routerId = "router." . $module->getBaseDir();
- if ($this->container->has($routerId)) {
- try {
- if ($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) {
+ $exists = true;
+ } catch (\ReflectionException $ex) {
+ $exists = false;
+ }
+
+ if ($exists || $this->getBackendContext()) {
+ $loopResultRow = new LoopResultRow($module);
+
+ $loopResultRow
+ ->set("ID" , $module->getId())
+ ->set("IS_TRANSLATED", $module->getVirtualColumn('IS_TRANSLATED'))
+ ->set("LOCALE" , $this->locale)
+ ->set("TITLE" , $module->getVirtualColumn('i18n_TITLE'))
+ ->set("CHAPO" , $module->getVirtualColumn('i18n_CHAPO'))
+ ->set("DESCRIPTION" , $module->getVirtualColumn('i18n_DESCRIPTION'))
+ ->set("POSTSCRIPTUM" , $module->getVirtualColumn('i18n_POSTSCRIPTUM'))
+ ->set("CODE" , $module->getCode())
+ ->set("TYPE" , $module->getType())
+ ->set("ACTIVE" , $module->getActivate())
+ ->set("CLASS" , $module->getFullNamespace())
+ ->set("POSITION" , $module->getPosition())
+ ->set("EXISTS" , $exists)
+ ;
+
+ $hasConfigurationInterface = false;
+
+ /* first test if module defines it's own config route */
+ if ($module->getActivate()) {
+ // Works only fo activated modules - see Thelia\Core\DependencyInjection\Compiler\RegisterRouterPass
+ $routerId = "router." . $module->getBaseDir();
+ if ($this->container->has($routerId)) {
+ try {
+ if ($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) {
+ $hasConfigurationInterface = true;
+ }
+ } catch (ResourceNotFoundException $e) {
+ /* $hasConfigurationInterface stays false */
+ }
+ }
+
+ /* if not ; test if it uses admin inclusion : module_configuration.html */
+ if (false === $hasConfigurationInterface) {
+ if (file_exists($module->getAbsoluteAdminIncludesPath() . DS . "module_configuration.html")) {
$hasConfigurationInterface = true;
}
- } catch (ResourceNotFoundException $e) {
- /* $hasConfigurationInterface stays false */
}
- }
+ } else {
+ // Make a quick and dirty test on the module's routing.xml file
+ $routing = @file_get_contents($module->getAbsoluteConfigPath() . DS . "routing.xml");
- /* if not ; test if it uses admin inclusion : module_configuration.html */
- if (false === $hasConfigurationInterface) {
- if (file_exists( sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), "module_configuration"))) {
+ if ($routing && strpos($routing, '/admin/module/') !== false) {
$hasConfigurationInterface = true;
}
}
- } else {
- // Make a quick and dirty test on the module's routing.xml file
- $routing = @file_get_contents($module->getAbsoluteBaseDir() . DS . "Config" . DS . "routing.xml");
- if ($routing && strpos($routing, '/admin/module/') !== false) {
- $hasConfigurationInterface = true;
+ $loopResultRow->set("CONFIGURABLE", $hasConfigurationInterface ? 1 : 0);
+
+ if (null !== $this->getProfile()) {
+ $accessValue = $module->getVirtualColumn('access');
+ $manager = new AccessManager($accessValue);
+
+ $loopResultRow->set("VIEWABLE", $manager->can(AccessManager::VIEW)? 1 : 0)
+ ->set("CREATABLE", $manager->can(AccessManager::CREATE) ? 1 : 0)
+ ->set("UPDATABLE", $manager->can(AccessManager::UPDATE)? 1 : 0)
+ ->set("DELETABLE", $manager->can(AccessManager::DELETE)? 1 : 0);
}
+
+ $loopResult->addRow($loopResultRow);
}
-
- $loopResultRow->set("CONFIGURABLE", $hasConfigurationInterface ? 1 : 0);
-
- if (null !== $this->getProfile()) {
- $accessValue = $module->getVirtualColumn('access');
- $manager = new AccessManager($accessValue);
-
- $loopResultRow->set("VIEWABLE", $manager->can(AccessManager::VIEW)? 1 : 0)
- ->set("CREATABLE", $manager->can(AccessManager::CREATE) ? 1 : 0)
- ->set("UPDATABLE", $manager->can(AccessManager::UPDATE)? 1 : 0)
- ->set("DELETABLE", $manager->can(AccessManager::DELETE)? 1 : 0);
- }
-
- $loopResult->addRow($loopResultRow);
}
return $loopResult;
diff --git a/core/lib/Thelia/Core/Template/Loop/Order.php b/core/lib/Thelia/Core/Template/Loop/Order.php
index 870ce2121..b717ea46c 100644
--- a/core/lib/Thelia/Core/Template/Loop/Order.php
+++ b/core/lib/Thelia/Core/Template/Loop/Order.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -92,11 +81,11 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
public function getSearchIn()
{
return array(
- "ref",
- "customer_ref",
- "customer_firstname",
- "customer_lastname",
- "customer_email",
+ 'ref',
+ 'customer_ref',
+ 'customer_firstname',
+ 'customer_lastname',
+ 'customer_email',
);
}
@@ -115,25 +104,25 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
$search->_or();
}
switch ($searchInElement) {
- case "ref":
+ case 'ref':
$search->filterByRef($searchTerm, $searchCriteria);
break;
- case "customer_ref":
+ case 'customer_ref':
$search->filterByCustomer(
CustomerQuery::create()->filterByRef($searchTerm, $searchCriteria)->find()
);
break;
- case "customer_firstname":
+ case 'customer_firstname':
$search->filterByOrderAddressRelatedByInvoiceOrderAddressId(
OrderAddressQuery::create()->filterByFirstname($searchTerm, $searchCriteria)->find()
);
break;
- case "customer_lastname":
+ case 'customer_lastname':
$search->filterByOrderAddressRelatedByInvoiceOrderAddressId(
OrderAddressQuery::create()->filterByLastname($searchTerm, $searchCriteria)->find()
);
break;
- case "customer_email":
+ case 'customer_email':
$search->filterByCustomer(
CustomerQuery::create()->filterByEmail($searchTerm, $searchCriteria)->find()
);
@@ -178,28 +167,28 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
case 'id':
$search->orderById(Criteria::ASC);
break;
- case 'id_reverse':
+ case 'id-reverse':
$search->orderById(Criteria::DESC);
break;
case 'reference':
$search->orderByRef(Criteria::ASC);
break;
- case 'reference_reverse':
+ case 'reference-reverse':
$search->orderByRef(Criteria::DESC);
break;
- case "create-date":
+ case 'create-date':
$search->orderByCreatedAt(Criteria::ASC);
break;
- case "create-date-reverse":
+ case 'create-date-reverse':
$search->orderByCreatedAt(Criteria::DESC);
break;
- case "status":
+ case 'status':
$search->orderByStatusId(Criteria::ASC);
break;
- case "status":
+ case 'status-reverse':
$search->orderByStatusId(Criteria::DESC);
break;
@@ -210,7 +199,7 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
->orderBy('company', Criteria::ASC)
;
break;
- case 'companyreverse' :
+ case 'company-reverse' :
$search
->joinOrderAddressRelatedByDeliveryOrderAddressId()
->withColumn(OrderAddressTableMap::COMPANY, 'company')
@@ -244,31 +233,32 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt
public function parseResults(LoopResult $loopResult)
{
+ /** @var \Thelia\Model\Order $order */
foreach ($loopResult->getResultDataCollection() as $order) {
$tax = 0;
$amount = $order->getTotalAmount($tax);
$loopResultRow = new LoopResultRow($order);
$loopResultRow
- ->set("ID", $order->getId())
- ->set("REF", $order->getRef())
- ->set("CUSTOMER", $order->getCustomerId())
- ->set("DELIVERY_ADDRESS", $order->getDeliveryOrderAddressId())
- ->set("INVOICE_ADDRESS", $order->getInvoiceOrderAddressId())
- ->set("INVOICE_DATE", $order->getInvoiceDate())
- ->set("CURRENCY", $order->getCurrencyId())
- ->set("CURRENCY_RATE", $order->getCurrencyRate())
- ->set("TRANSACTION_REF", $order->getTransactionRef())
- ->set("DELIVERY_REF", $order->getDeliveryRef())
- ->set("INVOICE_REF", $order->getInvoiceRef())
- ->set("POSTAGE", $order->getPostage())
- ->set("PAYMENT_MODULE", $order->getPaymentModuleId())
- ->set("DELIVERY_MODULE", $order->getDeliveryModuleId())
- ->set("STATUS", $order->getStatusId())
- ->set("LANG", $order->getLangId())
- ->set("DISCOUNT", $order->getDiscount())
- ->set("TOTAL_TAX", $tax)
- ->set("TOTAL_AMOUNT", $amount - $tax)
- ->set("TOTAL_TAXED_AMOUNT", $amount)
+ ->set('ID', $order->getId())
+ ->set('REF', $order->getRef())
+ ->set('CUSTOMER', $order->getCustomerId())
+ ->set('DELIVERY_ADDRESS', $order->getDeliveryOrderAddressId())
+ ->set('INVOICE_ADDRESS', $order->getInvoiceOrderAddressId())
+ ->set('INVOICE_DATE', $order->getInvoiceDate())
+ ->set('CURRENCY', $order->getCurrencyId())
+ ->set('CURRENCY_RATE', $order->getCurrencyRate())
+ ->set('TRANSACTION_REF', $order->getTransactionRef())
+ ->set('DELIVERY_REF', $order->getDeliveryRef())
+ ->set('INVOICE_REF', $order->getInvoiceRef())
+ ->set('POSTAGE', $order->getPostage())
+ ->set('PAYMENT_MODULE', $order->getPaymentModuleId())
+ ->set('DELIVERY_MODULE', $order->getDeliveryModuleId())
+ ->set('STATUS', $order->getStatusId())
+ ->set('LANG', $order->getLangId())
+ ->set('DISCOUNT', $order->getDiscount())
+ ->set('TOTAL_TAX', $tax)
+ ->set('TOTAL_AMOUNT', $amount - $tax)
+ ->set('TOTAL_TAXED_AMOUNT', $amount)
;
$loopResult->addRow($loopResultRow);
diff --git a/core/lib/Thelia/Core/Template/Loop/OrderAddress.php b/core/lib/Thelia/Core/Template/Loop/OrderAddress.php
index 4898a7217..4e78d05e6 100644
--- a/core/lib/Thelia/Core/Template/Loop/OrderAddress.php
+++ b/core/lib/Thelia/Core/Template/Loop/OrderAddress.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php b/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php
index 264d7be4e..25bf4a614 100644
--- a/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php
+++ b/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/OrderProduct.php b/core/lib/Thelia/Core/Template/Loop/OrderProduct.php
index 8e201f31c..889f3704e 100644
--- a/core/lib/Thelia/Core/Template/Loop/OrderProduct.php
+++ b/core/lib/Thelia/Core/Template/Loop/OrderProduct.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php b/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php
index bb018ec98..881714553 100644
--- a/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php
+++ b/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/OrderStatus.php b/core/lib/Thelia/Core/Template/Loop/OrderStatus.php
index f45a1d99b..0fe1d29d1 100644
--- a/core/lib/Thelia/Core/Template/Loop/OrderStatus.php
+++ b/core/lib/Thelia/Core/Template/Loop/OrderStatus.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Payment.php b/core/lib/Thelia/Core/Template/Loop/Payment.php
index 20a387e0e..af43b9ff0 100644
--- a/core/lib/Thelia/Core/Template/Loop/Payment.php
+++ b/core/lib/Thelia/Core/Template/Loop/Payment.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php
index 8bcf76e4d..70348626b 100644
--- a/core/lib/Thelia/Core/Template/Loop/Product.php
+++ b/core/lib/Thelia/Core/Template/Loop/Product.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -83,6 +72,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
Argument::createIntTypeArgument('min_stock'),
Argument::createFloatTypeArgument('min_weight'),
Argument::createFloatTypeArgument('max_weight'),
+ Argument::createBooleanTypeArgument('with_prev_next_info', false),
Argument::createBooleanTypeArgument('current'),
Argument::createBooleanTypeArgument('current_category'),
Argument::createIntTypeArgument('depth', 1),
@@ -467,12 +457,19 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
}
$taxCountry = $this->container->get('thelia.taxEngine')->getDeliveryCountry();
+ /** @var \Thelia\Core\Security\SecurityContext $securityContext */
+ $securityContext = $this->container->get('thelia.securityContext');
foreach ($loopResult->getResultDataCollection() as $product) {
$loopResultRow = new LoopResultRow($product);
$price = $product->getVirtualColumn('price');
+
+ if ($securityContext->hasCustomerUser() && $securityContext->getCustomerUser()->getDiscount() > 0) {
+ $price = $price * (1-($securityContext->getCustomerUser()->getDiscount()/100));
+ }
+
try {
$taxedPrice = $product->getTaxedPrice(
$taxCountry,
@@ -482,6 +479,10 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
$taxedPrice = null;
}
$promoPrice = $product->getVirtualColumn('promo_price');
+
+ if ($securityContext->hasCustomerUser() && $securityContext->getCustomerUser()->getDiscount() > 0) {
+ $promoPrice = $promoPrice * (1-($securityContext->getCustomerUser()->getDiscount()/100));
+ }
try {
$taxedPromoPrice = $product->getTaxedPromoPrice(
$taxCountry,
@@ -494,35 +495,10 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
// Find previous and next product, in the default category.
$default_category_id = $product->getDefaultCategoryId();
- $previous = ProductQuery::create()
- ->joinProductCategory()
- ->where('ProductCategory.category_id = ?', $default_category_id)
- ->filterByPosition($product->getPosition(), Criteria::LESS_THAN)
- ->orderByPosition(Criteria::DESC)
- ->findOne()
- ;
-
- $next = ProductQuery::create()
- ->joinProductCategory()
- ->where('ProductCategory.category_id = ?', $default_category_id)
- ->filterByPosition($product->getPosition(), Criteria::GREATER_THAN)
- ->orderByPosition(Criteria::ASC)
- ->findOne()
- ;
-
$loopResultRow
- ->set("ID" , $product->getId())
- ->set("REF" , $product->getRef())
- ->set("IS_TRANSLATED" , $product->getVirtualColumn('IS_TRANSLATED'))
- ->set("LOCALE" , $this->locale)
- ->set("TITLE" , $product->getVirtualColumn('i18n_TITLE'))
- ->set("CHAPO" , $product->getVirtualColumn('i18n_CHAPO'))
- ->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
- ->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
- ->set("URL" , $product->getUrl($this->locale))
- ->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE'))
- ->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION'))
- ->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS'))
+ ->set("WEIGHT" , $product->getVirtualColumn('weight'))
+ ->set("QUANTITY" , $product->getVirtualColumn('quantity'))
+ ->set("EAN_CODE" , $product->getVirtualColumn('ean_code'))
->set("BEST_PRICE" , $product->getVirtualColumn('is_promo') ? $promoPrice : $price)
->set("BEST_PRICE_TAX" , $taxedPrice - $product->getVirtualColumn('is_promo') ? $taxedPromoPrice - $promoPrice : $taxedPrice - $price)
->set("BEST_TAXED_PRICE" , $product->getVirtualColumn('is_promo') ? $taxedPromoPrice : $taxedPrice)
@@ -532,25 +508,13 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
->set("PROMO_PRICE" , $promoPrice)
->set("PROMO_PRICE_TAX" , $taxedPromoPrice - $promoPrice)
->set("TAXED_PROMO_PRICE" , $taxedPromoPrice)
- ->set("PRODUCT_SALE_ELEMENT" , $product->getVirtualColumn('pse_id'))
- ->set("WEIGHT" , $product->getVirtualColumn('weight'))
- ->set("QUANTITY" , $product->getVirtualColumn('quantity'))
- ->set("EAN_CODE" , $product->getVirtualColumn('ean_code'))
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
- ->set("POSITION" , $product->getPosition())
- ->set("VISIBLE" , $product->getVisible() ? "1" : "0")
- ->set("TEMPLATE" , $product->getTemplateId())
- ->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
- ->set("HAS_NEXT" , $next != null ? 1 : 0)
- ->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
- ->set("NEXT" , $next != null ? $next->getId() : -1)
- ->set("DEFAULT_CATEGORY" , $default_category_id)
- ->set("TAX_RULE_ID" , $product->getTaxRuleId())
;
- $loopResult->addRow($loopResultRow);
+
+ $loopResult->addRow($this->associateValues($loopResultRow, $product, $default_category_id));
}
return $loopResult;
@@ -985,6 +949,8 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
$loopResult = new LoopResult($results);
$taxCountry = $this->container->get('thelia.taxEngine')->getDeliveryCountry();
+ /** @var \Thelia\Core\Security\SecurityContext $securityContext */
+ $securityContext = $this->container->get('thelia.securityContext');
foreach ($loopResult->getResultDataCollection() as $product) {
@@ -992,10 +958,14 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
$price = $product->getRealLowestPrice();
+ if ($securityContext->hasCustomerUser() && $securityContext->getCustomerUser()->getDiscount() > 0) {
+ $price = $price * (1-($securityContext->getCustomerUser()->getDiscount()/100));
+ }
+
try {
$taxedPrice = $product->getTaxedPrice(
$taxCountry,
- $product->getRealLowestPrice()
+ $price
);
} catch (TaxEngineException $e) {
$taxedPrice = null;
@@ -1004,6 +974,48 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
// Find previous and next product, in the default category.
$default_category_id = $product->getDefaultCategoryId();
+ $loopResultRow
+ ->set("BEST_PRICE" , $price)
+ ->set("BEST_PRICE_TAX" , $taxedPrice - $price)
+ ->set("BEST_TAXED_PRICE" , $taxedPrice)
+ ->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
+ ->set("IS_NEW" , $product->getVirtualColumn('is_new'))
+ ;
+
+
+ $loopResult->addRow($this->associateValues($loopResultRow, $product, $default_category_id));
+ }
+
+ return $loopResult;
+ }
+
+ private function associateValues($loopResultRow, $product, $default_category_id)
+ {
+ $loopResultRow
+ ->set("ID" , $product->getId())
+ ->set("REF" , $product->getRef())
+ ->set("IS_TRANSLATED" , $product->getVirtualColumn('IS_TRANSLATED'))
+ ->set("LOCALE" , $this->locale)
+ ->set("TITLE" , $product->getVirtualColumn('i18n_TITLE'))
+ ->set("CHAPO" , $product->getVirtualColumn('i18n_CHAPO'))
+ ->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
+ ->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
+ ->set("URL" , $product->getUrl($this->locale))
+ ->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE'))
+ ->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION'))
+ ->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS'))
+ ->set("PRODUCT_SALE_ELEMENT" , $product->getVirtualColumn('pse_id'))
+ ->set("POSITION" , $product->getPosition())
+ ->set("VISIBLE" , $product->getVisible() ? "1" : "0")
+ ->set("TEMPLATE" , $product->getTemplateId())
+ ->set("DEFAULT_CATEGORY" , $default_category_id)
+ ->set("TAX_RULE_ID" , $product->getTaxRuleId())
+
+ ;
+
+
+ if ($this->getBackend_context() || $this->getWithPrevNextInfo()) {
+ // Find previous and next category
$previous = ProductQuery::create()
->joinProductCategory()
->where('ProductCategory.category_id = ?', $default_category_id)
@@ -1021,39 +1033,14 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
;
$loopResultRow
- ->set("ID" , $product->getId())
- ->set("REF" , $product->getRef())
- ->set("IS_TRANSLATED" , $product->getVirtualColumn('IS_TRANSLATED'))
- ->set("LOCALE" , $this->locale)
- ->set("TITLE" , $product->getVirtualColumn('i18n_TITLE'))
- ->set("CHAPO" , $product->getVirtualColumn('i18n_CHAPO'))
- ->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
- ->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
- ->set("URL" , $product->getUrl($this->locale))
- ->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE'))
- ->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION'))
- ->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS'))
- ->set("BEST_PRICE" , $price)
- ->set("BEST_PRICE_TAX" , $taxedPrice - $price)
- ->set("BEST_TAXED_PRICE" , $taxedPrice)
- ->set("IS_PROMO" , $product->getVirtualColumn('main_product_is_promo'))
- ->set("IS_NEW" , $product->getVirtualColumn('main_product_is_new'))
- ->set("POSITION" , $product->getPosition())
- ->set("VISIBLE" , $product->getVisible() ? "1" : "0")
- ->set("TEMPLATE" , $product->getTemplateId())
->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
->set("HAS_NEXT" , $next != null ? 1 : 0)
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
->set("NEXT" , $next != null ? $next->getId() : -1)
- ->set("DEFAULT_CATEGORY" , $default_category_id)
- ->set("TAX_RULE_ID" , $product->getTaxRuleId())
-
;
-
- $loopResult->addRow($loopResultRow);
}
- return $loopResult;
+ return $loopResultRow;
}
protected function manageFeatureAv(&$search, $feature_availability)
diff --git a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php
index e873faaf2..78e740d61 100644
--- a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php
+++ b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
@@ -146,22 +135,34 @@ class ProductSaleElements extends BaseLoop implements PropelSearchLoopInterface
public function parseResults(LoopResult $loopResult)
{
$taxCountry = $this->container->get('thelia.taxEngine')->getDeliveryCountry();
+ /** @var \Thelia\Core\Security\SecurityContext $securityContext */
+ $securityContext = $this->container->get('thelia.securityContext');
+ $discount = 0;
+
+ if ($securityContext->hasCustomerUser() && $securityContext->getCustomerUser()->getDiscount() > 0) {
+ $discount = $securityContext->getCustomerUser()->getDiscount();
+ }
foreach ($loopResult->getResultDataCollection() as $PSEValue) {
$loopResultRow = new LoopResultRow($PSEValue);
- $price = $PSEValue->getPrice();
+ $price = $PSEValue->getPrice('price_PRICE', $discount);
try {
$taxedPrice = $PSEValue->getTaxedPrice(
- $taxCountry
+ $taxCountry,
+ 'price_PRICE',
+ $discount
);
} catch (TaxEngineException $e) {
$taxedPrice = null;
}
- $promoPrice = $PSEValue->getPromoPrice();
+
+ $promoPrice = $PSEValue->getPromoPrice('price_PROMO_PRICE', $discount);
try {
$taxedPromoPrice = $PSEValue->getTaxedPromoPrice(
- $taxCountry
+ $taxCountry,
+ 'price_PROMO_PRICE',
+ $discount
);
} catch (TaxEngineException $e) {
$taxedPromoPrice = null;
diff --git a/core/lib/Thelia/Core/Template/Loop/ProductTemplate.php b/core/lib/Thelia/Core/Template/Loop/ProductTemplate.php
index 41c8c00ed..362cbe284 100644
--- a/core/lib/Thelia/Core/Template/Loop/ProductTemplate.php
+++ b/core/lib/Thelia/Core/Template/Loop/ProductTemplate.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Profile.php b/core/lib/Thelia/Core/Template/Loop/Profile.php
index 8b21d2fe0..fc9c5ce3a 100644
--- a/core/lib/Thelia/Core/Template/Loop/Profile.php
+++ b/core/lib/Thelia/Core/Template/Loop/Profile.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Resource.php b/core/lib/Thelia/Core/Template/Loop/Resource.php
index d1975d73f..eebbfb9a2 100644
--- a/core/lib/Thelia/Core/Template/Loop/Resource.php
+++ b/core/lib/Thelia/Core/Template/Loop/Resource.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Tax.php b/core/lib/Thelia/Core/Template/Loop/Tax.php
index 40c6e1cf3..cbee32be0 100644
--- a/core/lib/Thelia/Core/Template/Loop/Tax.php
+++ b/core/lib/Thelia/Core/Template/Loop/Tax.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/TaxRule.php b/core/lib/Thelia/Core/Template/Loop/TaxRule.php
index be90cc5ac..c3b2b11a6 100644
--- a/core/lib/Thelia/Core/Template/Loop/TaxRule.php
+++ b/core/lib/Thelia/Core/Template/Loop/TaxRule.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php b/core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php
index 0c32a51df..d90cd11d9 100644
--- a/core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php
+++ b/core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Template.php b/core/lib/Thelia/Core/Template/Loop/Template.php
index e6cf47288..1ce42ae4e 100644
--- a/core/lib/Thelia/Core/Template/Loop/Template.php
+++ b/core/lib/Thelia/Core/Template/Loop/Template.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/Loop/Title.php b/core/lib/Thelia/Core/Template/Loop/Title.php
index 51d482892..856e3ab77 100644
--- a/core/lib/Thelia/Core/Template/Loop/Title.php
+++ b/core/lib/Thelia/Core/Template/Loop/Title.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
diff --git a/core/lib/Thelia/Core/Template/ParserContext.php b/core/lib/Thelia/Core/Template/ParserContext.php
index 9e676da89..07642ce7c 100644
--- a/core/lib/Thelia/Core/Template/ParserContext.php
+++ b/core/lib/Thelia/Core/Template/ParserContext.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template;
diff --git a/core/lib/Thelia/Core/Template/ParserInterface.php b/core/lib/Thelia/Core/Template/ParserInterface.php
index 9ec99360c..0c32bd4ef 100644
--- a/core/lib/Thelia/Core/Template/ParserInterface.php
+++ b/core/lib/Thelia/Core/Template/ParserInterface.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template;
/**
@@ -38,6 +28,13 @@ interface ParserInterface
public function setStatus($status);
+ /**
+ * Setup the parser with a template definition, which provides a template description.
+ *
+ * @param TemplateDefinition $templateDefinition
+ */
+ public function setTemplateDefinition(TemplateDefinition $templateDefinition);
+
/**
* Add a template directory to the current template list
*
@@ -53,17 +50,17 @@ interface ParserInterface
/**
* Return the registeted template directories for a givent template type
*
- * @param unknown $templateType
- * @throws InvalidArgumentException if the tempmateType is not defined
- * @return array: an array of defined templates directories for the given template type
+ * @param unknown $templateType
+ * @throws \InvalidArgumentException if the templateType is not defined
+ * @return array: an array of defined templates directories for the given template type
*/
public function getTemplateDirectories($templateType);
/**
* Create a variable that will be available in the templates
*
- * @param $variable the vatiable name
- * @param $value the value of the variable
+ * @param string $variable the variable name
+ * @param mixed $value the value of the variable
*/
public function assign($variable, $value);
}
diff --git a/core/lib/Thelia/Core/Template/Smarty/AbstractSmartyPlugin.php b/core/lib/Thelia/Core/Template/Smarty/AbstractSmartyPlugin.php
index 611be2dbe..6bf8b4ec9 100644
--- a/core/lib/Thelia/Core/Template/Smarty/AbstractSmartyPlugin.php
+++ b/core/lib/Thelia/Core/Template/Smarty/AbstractSmartyPlugin.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php
index c175618cc..5974ef3db 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php
@@ -1,28 +1,18 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Assets;
+use Thelia\Log\Tlog;
use Thelia\Tools\URL;
use Thelia\Core\Template\Assets\AssetManagerInterface;
@@ -119,6 +109,27 @@ class SmartyAssetsManager
$templateDirectories = $smartyParser->getTemplateDirectories($templateDefinition->getType());
+ // if it's not a custom template and looking for a different origin (e.g. module)
+ // we first check if the asset is present in the default "source" (template)
+ // if not we take the default asset from the assetOrigin (module)
+ if (! $webAssetTemplate && $assetOrigin !== "0") {
+ if (isset($templateDirectories[$templateDefinition->getName()]["0"])) {
+ if (file_exists($templateDirectories[$templateDefinition->getName()]["0"] . DS . $file)) {
+ // the file exists, we take the default origin
+ $assetOrigin = "0";
+ }
+ }
+ }
+
+ if (! isset($templateDirectories[$templateDefinition->getName()][$assetOrigin])) {
+ // we try with the default origin
+ if (! $webAssetTemplate && $assetOrigin !== "0") {
+ $assetOrigin = "0";
+ } else {
+ throw new \Exception("Failed to get real path of '/".dirname($file)."'");
+ }
+ }
+
if (! isset($templateDirectories[$templateDefinition->getName()][$assetOrigin])) {
throw new \Exception("Failed to get real path of '/".dirname($file)."'");
}
@@ -130,17 +141,21 @@ class SmartyAssetsManager
$file = str_replace('/', DS, $file);
}
- $url = $this->assetsManager->processAsset(
- $assetSource . DS . $file,
- $assetSource . DS . self::$assetsDirectory,
- $this->web_root . $this->path_relative_to_web_root,
- $templateDefinition->getPath(),
- $assetOrigin,
- URL::getInstance()->absoluteUrl($this->path_relative_to_web_root, null, URL::PATH_TO_FILE /* path only */),
- $assetType,
- $filters,
- $debug
- );
+ $url = "";
+ // test if file exists before running the process
+ if (file_exists($assetSource . DS . $file)) {
+ $url = $this->assetsManager->processAsset(
+ $assetSource . DS . $file,
+ $assetSource . DS . self::$assetsDirectory,
+ $this->web_root . $this->path_relative_to_web_root,
+ $templateDefinition->getPath(),
+ $assetOrigin,
+ URL::getInstance()->absoluteUrl($this->path_relative_to_web_root, null, URL::PATH_TO_FILE /* path only */),
+ $assetType,
+ $filters,
+ $debug
+ );
+ }
return $url;
}
@@ -149,10 +164,13 @@ class SmartyAssetsManager
{
// Opening tag (first call only)
if ($repeat) {
- $url = $this->computeAssetUrl($assetType, $params, $template);
-
+ $url = "";
+ try {
+ $url = $this->computeAssetUrl($assetType, $params, $template);
+ } catch (\Exception $ex) {
+ Tlog::getInstance()->addWarning("Failed to get real path of " . $params['file']);
+ }
$template->assign('asset_url', $url);
-
} elseif (isset($content)) {
return $content;
}
diff --git a/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php b/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php
index 77efa2d17..8ef8ca86d 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Exception;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php
index 283a4c6cf..47fb45d8d 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
@@ -91,8 +80,8 @@ class AdminUtilities extends AbstractSmartyPlugin
*/
- if ($permissions == null || $this->securityContext->isGranted(
- "ADMIN",
+ if ($this->securityContext->isGranted(
+ array("ADMIN"),
$resource === null ? array() : array($resource),
$module === null ? array() : array($module),
array($access))
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Assets.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Assets.php
index e4a5c866f..bc2107f8d 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Assets.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Assets.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/CartPostage.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/CartPostage.php
new file mode 100644
index 000000000..9bf98dd43
--- /dev/null
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/CartPostage.php
@@ -0,0 +1,208 @@
+container = $container;
+
+ $this->request = $container->get('request');
+ }
+
+ /**
+ * Get postage amount for cart
+ *
+ * @param array $params Block parameters
+ * @param mixed $content Block content
+ * @param \Smarty_Internal_Template $template Template
+ * @param bool $repeat Control how many times
+ * the block is displayed
+ *
+ * @return mixed
+ */
+ public function postage($params, $content, $template, &$repeat)
+ {
+
+ if (! $repeat) {
+ return (null !== $this->countryId) ? $content : "";
+ }
+
+ $customer = $this->request->getSession()->getCustomerUser();
+ $country = $this->getDeliveryCountry($customer);
+
+ if (null !== $country) {
+ $this->countryId = $country->getId();
+ // try to get the cheapest delivery for this country
+ $this->getCheapestDelivery($country);
+ }
+
+ $template->assign('country_id', $this->countryId);
+ $template->assign('delivery_id', $this->deliveryId);
+ $template->assign('postage', $this->postage ?: 0.0);
+ $template->assign('is_customizable', $this->isCustomizable);
+ }
+
+ /**
+ * Retrieve the delivery country for a customer
+ *
+ * The rules :
+ * - the country of the delivery address of the customer related to the
+ * cart if it exists
+ * - the country saved in cookie if customer have changed
+ * the default country
+ * - the default country for the shop if it exists
+ *
+ *
+ * @param \Thelia\Model\Customer $customer
+ * @return \Thelia\Model\Country
+ */
+ protected function getDeliveryCountry(Customer $customer = null)
+ {
+
+ // get country from customer addresses
+ if (null !== $customer) {
+ $address = AddressQuery::create()
+ ->filterByCustomerId($customer->getId())
+ ->filterByIsDefault(1)
+ ->findOne()
+ ;
+
+ if (null !== $address) {
+ $this->isCustomizable = false;
+
+ return $address->getCountry();
+ }
+ }
+
+ // get country from cookie
+ $cookieName = ConfigQuery::read('front_cart_country_cookie_name', 'fcccn');
+ if ($this->request->cookies->has($cookieName)) {
+ $cookieVal = $this->request->cookies->getInt($cookieName, 0);
+ if (0 !== $cookieVal) {
+ $country = CountryQuery::create()->findPk($cookieVal);
+ if (null !== $country) {
+ return $country;
+ }
+ }
+ }
+
+ // get default country for store.
+ try {
+ $country = Country::getDefaultCountry();
+
+ return $country;
+ } catch (\LogicException $e) {
+ ;
+ }
+
+ return null;
+
+ }
+
+ /**
+ * Retrieve the cheapest delivery for country
+ *
+ * @param \Thelia\Model\Country $country
+ * @return DeliveryModuleInterface
+ */
+ protected function getCheapestDelivery(Country $country)
+ {
+
+ $deliveryModules = ModuleQuery::create()
+ ->filterByActivate(1)
+ ->filterByType(BaseModule::DELIVERY_MODULE_TYPE, Criteria::EQUAL)
+ ->find();
+ ;
+
+ foreach ($deliveryModules as $deliveryModule) {
+
+ /** @var DeliveryModuleInterface $moduleInstance */
+ $moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
+
+ if (false === $moduleInstance instanceof DeliveryModuleInterface) {
+ throw new \RuntimeException(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $deliveryModule->getCode()));
+ }
+
+ try {
+ // Check if module is valid, by calling isValidDelivery(),
+ // or catching a DeliveryException.
+ if ($moduleInstance->isValidDelivery($country)) {
+
+ $postage = $moduleInstance->getPostage($country);
+ if (null === $this->postage || $this->postage > $postage) {
+ $this->postage = $postage;
+ $this->deliveryId = $deliveryModule->getId();
+ }
+ }
+ } catch (DeliveryException $ex) {
+ // Module is not available
+ }
+
+ }
+
+ }
+
+ /**
+ * Defines the various smarty plugins handled by this class
+ *
+ * @return SmartyPluginDescriptor[] smarty plugin descriptors
+ */
+ public function getPluginDescriptors()
+ {
+ return array(
+ new SmartyPluginDescriptor('block', 'postage', $this, 'postage')
+ );
+ }
+}
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php
index d12d8639a..d439e7d63 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Esi.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Esi.php
index cfa3788bd..0177047f3 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Esi.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Esi.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php
index e89898af6..f6d6f7bc1 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template\Smarty\Plugins;
use Symfony\Component\HttpFoundation\Request;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php
index 92ad357f2..9fe5d2581 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template\Smarty\Plugins;
use Symfony\Component\Form\FormView;
@@ -127,16 +117,24 @@ class Form extends AbstractSmartyPlugin
}
}
- protected function assignFieldValues($template, $fieldName, $fieldValue, $fieldVars, $total_value_count = 1)
+ protected function assignFieldValues(
+ $template,
+ $fieldName,
+ $fieldValue,
+ $fieldType,
+ $fieldVars,
+ $total_value_count = 1
+ )
{
$template->assign("name", $fieldName);
-
$template->assign("value", $fieldValue);
+ $template->assign("data", $fieldVars['data']);
+
+ $template->assign("type", $fieldType);
$template->assign("checked", isset($fieldVars['checked']) ? $fieldVars['checked'] : false);
-
- //data
- $template->assign("data", $fieldVars['data']);
+ $template->assign("choices", isset($fieldVars['choices']) ? $fieldVars['choices'] : false);
+ $template->assign("multiple", isset($fieldVars['multiple']) ? $fieldVars['multiple'] : false);
$template->assign("label", $fieldVars["label"]);
$template->assign("label_attr", $fieldVars["label_attr"]);
@@ -211,6 +209,8 @@ class Form extends AbstractSmartyPlugin
$formFieldView = $this->getFormFieldView($params);
$formFieldConfig = $this->getFormFieldConfig($params);
+ $formFieldType = $formFieldConfig->getType()->getName();
+
$this->assignFormTypeValues($template, $formFieldConfig, $formFieldView);
$value = $formFieldView->vars["value"];
@@ -230,9 +230,22 @@ class Form extends AbstractSmartyPlugin
$val = $value[$key];
- $this->assignFieldValues($template, $name, $val, $formFieldView->vars, count($formFieldView->children));
+ $this->assignFieldValues(
+ $template,
+ $name,
+ $val,
+ $formFieldType,
+ $formFieldView->vars,
+ count($formFieldView->children)
+ );
} else {
- $this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars);
+ $this->assignFieldValues(
+ $template,
+ $formFieldView->vars["full_name"],
+ $formFieldView->vars["value"],
+ $formFieldType,
+ $formFieldView->vars
+ );
}
$formFieldView->setRendered();
@@ -251,16 +264,20 @@ class Form extends AbstractSmartyPlugin
}
if (isset(self::$taggedFieldsStack[self::$taggedFieldsStackPosition])) {
+
+ $field = self::$taggedFieldsStack[self::$taggedFieldsStackPosition];
+
$this->assignFieldValues(
$template,
- self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars["full_name"],
- self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars["value"],
- self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars
+ $field['view']->vars["full_name"],
+ $field['view']->vars["value"],
+ $field['config']->getType()->getName(),
+ $field['view']->vars
);
- $this->assignFormTypeValues($template, self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['config'], self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']);
+ $this->assignFormTypeValues($template, $field['config'], $field['view']);
- self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->setRendered();
+ $field['view']->setRendered();
$repeat = true;
}
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php
index f022cf0c5..372f74d3f 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php
index a66a1ed03..c067e32a1 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
@@ -63,43 +52,47 @@ class Module extends AbstractSmartyPlugin
public function theliaModule($params, \Smarty_Internal_Template $template)
{
$content = null;
-
+ $count = 0;
if (false !== $location = $this->getParam($params, 'location', false)) {
if ($this->debug === true && $this->request->get('SHOW_INCLUDE')) {
- echo sprintf('
%s
', $location);
+ echo sprintf('
%s
', $location);
}
$moduleLimit = $this->getParam($params, 'module', null);
$modules = ModuleQuery::getActivated();
- $count = 0;
-
+ /** @var \Thelia\Model\Module $module */
foreach ($modules as $module) {
if (null !== $moduleLimit && $moduleLimit != $module->getCode()) {
continue;
}
- $file = sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), $location);
+ $file = $module->getAbsoluteAdminIncludesPath() . DS . $location . '.html';
if (file_exists($file)) {
- $content .= file_get_contents($file);
- $count++;
+ $output = trim(file_get_contents($file));
+
+ if (! empty($output)) {
+ $content .= $output;
+
+ $count++;
+ }
}
}
}
- if (! empty($content)) {
- return $template->fetch(sprintf("string:%s", $content));
- }
-
if (false !== $countvarname = $this->getParam($params, 'countvar', false)) {
$template->assign($countvarname, $count);
}
+ if (! empty($content)) {
+ return $template->fetch(sprintf("string:%s", $content));
+ }
+
return "";
}
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php
index 9db8e90fe..85ebb4257 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
@@ -61,8 +50,8 @@ class Security extends AbstractSmartyPlugin
if (! $this->securityContext->isGranted($roles, $resources, $modules, $accesses)) {
$ex = new AuthenticationException(
- sprintf("User not granted for roles '%s', to access resources '%s' with %s in context '%s'.",
- implode(',', $roles), implode(',', $resources), implode(',', $accesses), $context
+ sprintf("User not granted for roles '%s', to access resources '%s' with %s.",
+ implode(',', $roles), implode(',', $resources), implode(',', $accesses)
)
);
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
index e6a795de9..dfc31e3fd 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
@@ -1,38 +1,31 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
+use Propel\Runtime\Util\PropelModelPager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Core\Template\Element\BaseLoop;
+use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Element\Exception\ElementNotFoundException;
use Thelia\Core\Template\Element\Exception\InvalidElementException;
+use Thelia\Core\Translation\Translator;
class TheliaLoop extends AbstractSmartyPlugin
{
+ /** @var PropelModelPager[] */
protected static $pagination = null;
protected $loopDefinition = array();
@@ -41,10 +34,15 @@ class TheliaLoop extends AbstractSmartyPlugin
protected $dispatcher;
protected $securityContext;
+ /** @var Translator */
+ protected $translator;
+
/** @var ContainerInterface Service Container */
protected $container = null;
+ /** @var LoopResult[] */
protected $loopstack = array();
+
protected $varstack = array();
/**
@@ -57,31 +55,43 @@ class TheliaLoop extends AbstractSmartyPlugin
$this->request = $container->get('request');
$this->dispatcher = $container->get('event_dispatcher');
$this->securityContext = $container->get('thelia.securityContext');
+ $this->translator = $container->get("thelia.translator");
}
/**
- * @param $loopId
- *
- * @return \PropelModelPager
+ * @param string $loopName
+ * @return PropelModelPager
+ * @throws \InvalidArgumentException if no pagination was found for loop
*/
public static function getPagination($loopName)
{
if (array_key_exists($loopName, self::$pagination)) {
return self::$pagination[$loopName];
} else {
- throw new \InvalidArgumentException("Loop $loopName is not defined");
+ throw new \InvalidArgumentException(
+ Translator::getInstance()->trans("No pagination currently defined for loop name '%name'", ['%name' => $loopName ])
+ );
}
}
/**
* Process the count function: executes a loop and return the number of items found
+ *
+ * @param array $params parameters array
+ * @param \Smarty_Internal_Template $template
+ *
+ * @return int the item count
+ * @throws \InvalidArgumentException if a parameter is missing
+ *
*/
- public function theliaCount($params, $template)
+ public function theliaCount($params, /** @noinspection PhpUnusedParameterInspection */ $template)
{
$type = $this->getParam($params, 'type');
if (null == $type) {
- throw new \InvalidArgumentException("Missing 'type' parameter in count arguments");
+ throw new \InvalidArgumentException(
+ $this->translator->trans("Missing 'type' parameter in {count} loop arguments")
+ );
}
$loop = $this->createLoopInstance($params);
@@ -94,31 +104,39 @@ class TheliaLoop extends AbstractSmartyPlugin
/**
* Process {loop name="loop name" type="loop type" ... } ... {/loop} block
*
- * @param unknown $params
- * @param unknown $content
- * @param unknown $template
- * @param unknown $repeat
+ * @param array $params
+ * @param string $content
+ * @param \Smarty_Internal_Template $template
+ * @param boolean $repeat
+ *
* @throws \InvalidArgumentException
- * @return string
+ *
+ * @return void|string
*/
public function theliaLoop($params, $content, $template, &$repeat)
{
$name = $this->getParam($params, 'name');
if (null == $name) {
- throw new \InvalidArgumentException("Missing 'name' parameter in loop arguments");
+ throw new \InvalidArgumentException(
+ $this->translator->trans("Missing 'name' parameter in loop arguments")
+ );
}
$type = $this->getParam($params, 'type');
if (null == $type) {
- throw new \InvalidArgumentException("Missing 'type' parameter in loop arguments");
+ throw new \InvalidArgumentException(
+ $this->translator->trans("Missing 'type' parameter in loop arguments")
+ );
}
if ($content === null) {
// Check if a loop with the same name exists in the current scope, and abort if it's the case.
if (array_key_exists($name, $this->varstack)) {
- throw new \InvalidArgumentException("A loop named '$name' already exists in the current scope.");
+ throw new \InvalidArgumentException(
+ $this->translator->trans("A loop named '%name' already exists in the current scope.", ['%name' => $name])
+ );
}
$loop = $this->createLoopInstance($params);
@@ -131,7 +149,7 @@ class TheliaLoop extends AbstractSmartyPlugin
$this->loopstack[$name] = $loopResults;
- // Pas de résultat ? la boucle est terminée, ne pas évaluer le contenu.
+ // No results ? The loop is terminated, do not evaluate loop text.
if ($loopResults->isEmpty()) $repeat = false;
} else {
@@ -184,52 +202,56 @@ class TheliaLoop extends AbstractSmartyPlugin
return $content;
}
+
+ return '';
}
/**
* Process {elseloop rel="loopname"} ... {/elseloop} block
*
- * @param unknown $params
- * @param unknown $content
- * @param unknown $template
- * @param unknown $repeat
- * @return Ambigous
+ * @param array $params loop parameters
+ * @param string $content loop text content
+ * @param \Smarty_Internal_Template $template the Smarty object
+ * @param boolean $repeat repeat indicator (see Smarty doc.)
+ * @return string the loop output
*/
- public function theliaElseloop($params, $content, $template, &$repeat)
+ public function theliaElseloop($params, $content, /** @noinspection PhpUnusedParameterInspection */ $template, &$repeat)
{
-
- // When encoutering close tag, check if loop has results.
+ // When encountering close tag, check if loop has results.
if ($repeat === false) {
- return $this->checkEmptyLoop($params, $template) ? $content : '';
+ return $this->checkEmptyLoop($params) ? $content : '';
}
+
+ return '';
}
/**
* Process {ifloop rel="loopname"} ... {/ifloop} block
*
- * @param unknown $params
- * @param unknown $content
- * @param unknown $template
- * @param unknown $repeat
- * @return Ambigous
+ * @param array $params loop parameters
+ * @param string $content loop text content
+ * @param \Smarty_Internal_Template $template the Smarty object
+ * @param boolean $repeat repeat indicator (see Smarty doc.)
+ * @return string the loop output
*/
- public function theliaIfLoop($params, $content, $template, &$repeat)
+ public function theliaIfLoop($params, $content, /** @noinspection PhpUnusedParameterInspection */ $template, &$repeat)
{
// When encountering close tag, check if loop has results.
if ($repeat === false) {
- return $this->checkEmptyLoop($params, $template) ? '' : $content;
+ return $this->checkEmptyLoop($params) ? '' : $content;
}
+
+ return '';
}
/**
* Process {pageloop rel="loopname"} ... {/pageloop} block
*
- * @param $params
- * @param $content
- * @param $template
- * @param $repeat
- *
- * @return string
+ * @param array $params loop parameters
+ * @param string $content loop text content
+ * @param \Smarty_Internal_Template $template the Smarty object
+ * @param boolean $repeat repeat indicator (see Smarty doc.)
+ * @return string the loop output
* @throws \InvalidArgumentException
*/
public function theliaPageLoop($params, $content, $template, &$repeat)
@@ -237,73 +259,102 @@ class TheliaLoop extends AbstractSmartyPlugin
$loopName = $this->getParam($params, 'rel');
if (null == $loopName)
- throw new \InvalidArgumentException("Missing 'rel' parameter in page loop");
+ throw new \InvalidArgumentException($this->translator->trans("Missing 'rel' parameter in page loop"));
// Find pagination
$pagination = self::getPagination($loopName);
- if ($pagination === null) { // loop has no result
+ if ($pagination === null || $pagination->getNbResults() == 0) {
+ // No need to paginate
return '';
}
- if ($pagination->getNbResults() == 0) {
- return '';
- }
+ $startPage = intval($this->getParam($params, 'start-page', 1));
+ $displayedPageCount = intval($this->getParam($params, 'limit', 10));
- $nbPage = $this->getParam($params, 'numPage', 10);
- $maxPage = $pagination->getLastPage();
+ if (intval($displayedPageCount) == 0) $displayedPageCount = PHP_INT_MAX;
+ $totalPageCount = $pagination->getLastPage();
if ($content === null) {
- $page = $pagination->getPage();
- if ($maxPage > ($page + $nbPage)) {
- $end = $page + $nbPage;
- } else {
- $end = $maxPage;
+
+ // The current page
+ $currentPage = $pagination->getPage();
+
+ // Get the start page.
+ if ($totalPageCount > $displayedPageCount) {
+ $startPage = $currentPage - round($displayedPageCount / 2);
+
+ if ($startPage < 0) $startPage = 1;
}
- $template->assign('PREV', $page > 1 ? $page-1: $page);
- $template->assign('NEXT', $page < $maxPage ? $page+1 : $maxPage);
- $template->assign('END', $end);
- $template->assign('LAST', $pagination->getLastPage());
+
+ // This is the iterative page number, the one we're going to increment in this loop
+ $iterationPage = $startPage;
+
+ // The last displayed page number
+ $endPage = $startPage + $displayedPageCount - 1;
+
+ if ($endPage > $totalPageCount) {
+ $endPage = $totalPageCount;
+ }
+
+ // The first displayed page number
+ $template->assign('START' , $startPage);
+ // The previous page number
+ $template->assign('PREV' , $currentPage > 1 ? $currentPage-1 : $currentPage);
+ // The next page number
+ $template->assign('NEXT' , $currentPage < $totalPageCount ? $currentPage+1 : $totalPageCount);
+ // The last displayed page number
+ $template->assign('END' , $endPage);
+ // The overall last page
+ $template->assign('LAST' , $totalPageCount);
} else {
- $page = $template->getTemplateVars('PAGE');
- $page++;
+ $iterationPage = $template->getTemplateVars('PAGE');
+
+ $iterationPage++;
}
+ if ($iterationPage <= $template->getTemplateVars('END')) {
+ // The iterative page number
+ $template->assign('PAGE', $iterationPage);
- if ($page <= $template->getTemplateVars('END')) {
- $template->assign('PAGE', $page);
+ // The overall current page number
$template->assign('CURRENT', $pagination->getPage());
-
$repeat = true;
}
if ($content !== null) {
return $content;
}
+
+ return '';
}
/**
* Check if a loop has returned results. The loop shoud have been executed before, or an
* InvalidArgumentException is thrown
*
- * @param unknown $params
- * @param unknown $template
+ * @param array $params
+ *
+ * @return boolean true if the loop is empty
* @throws \InvalidArgumentException
*/
- protected function checkEmptyLoop($params, $template)
+ protected function checkEmptyLoop($params)
{
$loopName = $this->getParam($params, 'rel');
if (null == $loopName)
- throw new \InvalidArgumentException("Missing 'rel' parameter in ifloop/elseloop arguments");
+ throw new \InvalidArgumentException(
+ $this->translator->trans("Missing 'rel' parameter in ifloop/elseloop arguments")
+ );
- if (! isset($this->loopstack[$loopName])) {
- throw new \InvalidArgumentException("Loop $loopName is not defined.");
- }
+ if (! isset($this->loopstack[$loopName]))
+ throw new \InvalidArgumentException(
+ $this->translator->trans("Related loop name '%name'' is not defined.", ['%name' => $loopName])
+ );
return $this->loopstack[$loopName]->isEmpty();
}
@@ -320,14 +371,16 @@ class TheliaLoop extends AbstractSmartyPlugin
$type = strtolower($smartyParams['type']);
if (! isset($this->loopDefinition[$type])) {
- throw new ElementNotFoundException(sprintf("'%s' loop type does not exists", $type));
+ throw new ElementNotFoundException(
+ $this->translator->trans("Loop type '%type' is not defined.", ['%type' => $type]));
}
$class = new \ReflectionClass($this->loopDefinition[$type]);
if ($class->isSubclassOf("Thelia\Core\Template\Element\BaseLoop") === false) {
- throw new InvalidElementException(sprintf("'%s' Loop class should extends Thelia\Core\Template\Element\BaseLoop",
- $type));
+ throw new InvalidElementException(
+ $this->translator->trans("'%type' loop class should extends Thelia\Core\Template\Element\BaseLoop", ['%type' => $type])
+ );
}
$loop = $class->newInstance(
@@ -361,7 +414,12 @@ class TheliaLoop extends AbstractSmartyPlugin
{
foreach ($loopDefinition as $name => $className) {
if (array_key_exists($name, $this->loopDefinition)) {
- throw new \InvalidArgumentException(sprintf("%s loop name already exists for %s class name", $name, $className));
+ throw new \InvalidArgumentException(
+ $this->translator->trans("The loop name '%name' is already defined in %className class", [
+ '%name' => $name,
+ '%className' => $className
+ ])
+ );
}
$this->loopDefinition[$name] = $className;
@@ -371,7 +429,7 @@ class TheliaLoop extends AbstractSmartyPlugin
/**
* Defines the various smarty plugins hendled by this class
*
- * @return an array of smarty plugin descriptors
+ * @return SmartyPluginDescriptor[] smarty plugin descriptors
*/
public function getPluginDescriptors()
{
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaSyntax.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaSyntax.php
index 268055064..cc087a1e6 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaSyntax.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaSyntax.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core\Template\Smarty\Plugins;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Translation.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Translation.php
index be319b73b..aa66c114f 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Translation.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Translation.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
@@ -30,41 +19,59 @@ use Symfony\Component\Translation\TranslatorInterface;
class Translation extends AbstractSmartyPlugin
{
protected $translator;
+ protected $defaultTranslationDomain = '';
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
+ /**
+ * Set the default translation domain
+ *
+ * @param array $params
+ * @param \Smarty_Internal_Template $smarty
+ * @return string
+ */
+ public function setDefaultTranslationDomain($params, &$smarty)
+ {
+ $this->defaultTranslationDomain = $this->getParam($params, 'domain');
+ }
+
/**
* Process translate function
*
- * @param unknown $params
- * @param unknown $smarty
+ * @param array $params
+ * @param \Smarty_Internal_Template $smarty
* @return string
*/
public function translate($params, &$smarty)
{
- // All parameters other than 'l' are supposed to be variables. Build an array of var => value pairs
+ // All parameters other than 'l' and 'd' are supposed to be variables. Build an array of var => value pairs
// and pass it to the translator
$vars = array();
foreach ($params as $name => $value) {
- if ($name != 'l') $vars["%$name"] = $value;
+ if ($name != 'l' && $name != 'd') $vars["%$name"] = $value;
}
- return $this->translator->trans($this->getParam($params, 'l'), $vars);
- }
+ return $this->translator->trans(
+ $this->getParam($params, 'l'),
+ $vars,
+ $this->getParam($params, 'd', $this->defaultTranslationDomain)
+ );
+}
/**
- * Define the various smarty plugins hendled by this class
+ * Define the various smarty plugins handled by this class
*
- * @return an array of smarty plugin descriptors
+ * @return SmartyPluginDescriptor[] an array of smarty plugin descriptors
*/
public function getPluginDescriptors()
{
return array(
new SmartyPluginDescriptor('function', 'intl', $this, 'translate'),
+ new SmartyPluginDescriptor('function', 'default_translation_domain', $this, 'setDefaultTranslationDomain'),
);
}
}
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php
index cc42a6b21..b7282c51b 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php
index ce6e6eae0..03d605358 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
index d2450fb43..bcc915018 100644
--- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
+++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
@@ -1,4 +1,14 @@
getTemplate() . '/configs';
- $this->setConfigDir($configDirectory);
+ $this->addConfigDir($configDirectory, 0);
/* add modules template directories */
$this->addTemplateDirectory(
@@ -170,6 +180,7 @@ class SmartyParser extends Smarty implements ParserInterface
if (isset($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()])) {
foreach ($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()] as $key => $directory) {
$this->addTemplateDir($directory, $key);
+ $this->addConfigDir($directory . "/configs", $key);
}
}
}
@@ -229,11 +240,28 @@ class SmartyParser extends Smarty implements ParserInterface
*/
public function render($realTemplateName, array $parameters = array())
{
- if (false === $this->templateExists($realTemplateName)) {
+ if (false === $this->templateExists($realTemplateName) || false === $this->checkTemplate($realTemplateName)) {
throw new ResourceNotFoundException(Translator::getInstance()->trans("Template file %file cannot be found.", array('%file' => $realTemplateName)));
}
return $this->internalRenderer('file', $realTemplateName, $parameters);
+
+ }
+
+ private function checkTemplate($fileName)
+ {
+ $templates = $this->getTemplateDir();
+
+ $found = true;
+ foreach ($templates as $key => $value) {
+ $absolutePath = rtrim(realpath(dirname($value.$fileName)), "/");
+ $templateDir = rtrim(realpath($value), "/");
+ if (!empty($absolutePath) && strpos($absolutePath, $templateDir) !== 0) {
+ $found = false;
+ }
+ }
+
+ return $found;
}
/**
diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyPluginDescriptor.php b/core/lib/Thelia/Core/Template/Smarty/SmartyPluginDescriptor.php
index f3bdbb203..8572528ef 100644
--- a/core/lib/Thelia/Core/Template/Smarty/SmartyPluginDescriptor.php
+++ b/core/lib/Thelia/Core/Template/Smarty/SmartyPluginDescriptor.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty;
diff --git a/core/lib/Thelia/Core/Template/TemplateDefinition.php b/core/lib/Thelia/Core/Template/TemplateDefinition.php
index b511414a5..c4e2149b9 100644
--- a/core/lib/Thelia/Core/Template/TemplateDefinition.php
+++ b/core/lib/Thelia/Core/Template/TemplateDefinition.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template;
@@ -57,6 +46,8 @@ class TemplateDefinition
*/
protected $type;
+ protected $translationDomainPrefix;
+
public function __construct($name, $type)
{
$this->name = $name;
@@ -65,22 +56,32 @@ class TemplateDefinition
switch ($type) {
case TemplateDefinition::FRONT_OFFICE:
$this->path = self::FRONT_OFFICE_SUBDIR . DS . $name;
+ $this->translationDomainPrefix = 'fo.';
break;
case TemplateDefinition::BACK_OFFICE:
$this->path = self::BACK_OFFICE_SUBDIR . DS . $name;
+ $this->translationDomainPrefix = 'bo.';
break;
case TemplateDefinition::PDF:
$this->path = self::PDF_SUBDIR . DS . $name;
+ $this->translationDomainPrefix = 'pdf.';
break;
case TemplateDefinition::EMAIL:
$this->path = self::EMAIL_SUBDIR . DS . $name;
+ $this->translationDomainPrefix = 'email.';
break;
default:
$this->path = $name;
+ $this->translationDomainPrefix = 'generic.';
break;
}
}
+ public function getTranslationDomain()
+ {
+ return $this->translationDomainPrefix . strtolower($this->getName());
+ }
+
public function getName()
{
return $this->name;
diff --git a/core/lib/Thelia/Core/Template/TemplateHelper.php b/core/lib/Thelia/Core/Template/TemplateHelper.php
index 4a5352f0a..ef6737890 100644
--- a/core/lib/Thelia/Core/Template/TemplateHelper.php
+++ b/core/lib/Thelia/Core/Template/TemplateHelper.php
@@ -1,28 +1,18 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core\Template;
+use Symfony\Component\Filesystem\Filesystem;
use Thelia\Model\ConfigQuery;
use Thelia\Log\Tlog;
use Thelia\Core\Translation\Translator;
@@ -57,6 +47,31 @@ class TemplateHelper
);
}
+ /**
+ * Check if a template definition is the current active template
+ *
+ * @param TemplateDefinition $tplDefinition
+ * @return bool true is the given template is the active template
+ */
+ public function isActive(TemplateDefinition $tplDefinition)
+ {
+ switch ($tplDefinition->getType()) {
+ case TemplateDefinition::FRONT_OFFICE:
+ $tplVar = 'active-front-template';
+ break;
+ case TemplateDefinition::BACK_OFFICE:
+ $tplVar = 'active-front-template';
+ break;
+ case TemplateDefinition::PDF:
+ $tplVar = 'active-front-template';
+ break;
+ case TemplateDefinition::EMAIL:
+ $tplVar = 'active-front-template';
+ break;
+ }
+
+ return $tplDefinition->getName() == ConfigQuery::read($tplVar, 'default');
+ }
/**
* @return TemplateDefinition
*/
@@ -106,10 +121,11 @@ class TemplateHelper
/**
* Return a list of existing templates for a given template type
*
- * @param int $templateType the template type
- * @return An array of \Thelia\Core\Template\TemplateDefinition
+ * @param int $templateType the template type
+ * @param string the template base (module or core, default to core).
+ * @return TemplateDefinition[] of \Thelia\Core\Template\TemplateDefinition
*/
- public function getList($templateType)
+ public function getList($templateType, $base = THELIA_TEMPLATE_DIR)
{
$list = $exclude = array();
@@ -119,24 +135,29 @@ class TemplateHelper
if ($templateType == $type) {
- $baseDir = THELIA_TEMPLATE_DIR.$subdir;
+ $baseDir = rtrim($base, DS).DS.$subdir;
- // Every subdir of the basedir is supposed to be a template.
- $di = new \DirectoryIterator($baseDir);
+ try {
+ // Every subdir of the basedir is supposed to be a template.
+ $di = new \DirectoryIterator($baseDir);
- foreach ($di as $file) {
- // Ignore 'dot' elements
- if ($file->isDot() || ! $file->isDir()) continue;
+ /** @var \DirectoryIterator $file */
+ foreach ($di as $file) {
+ // Ignore 'dot' elements
+ if ($file->isDot() || ! $file->isDir()) continue;
- // Ignore reserved directory names
- if (in_array($file->getFilename(), $exclude)) continue;
+ // Ignore reserved directory names
+ if (in_array($file->getFilename(), $exclude)) continue;
- $list[] = new TemplateDefinition($file->getFilename(), $templateType);
+ $list[] = new TemplateDefinition($file->getFilename(), $templateType);
+ }
+ } catch (\UnexpectedValueException $ex) {
+ // Ignore the exception and continue
}
-
- return $list;
}
}
+
+ return $list;
}
protected function normalizePath($path)
@@ -163,20 +184,21 @@ class TemplateHelper
* @param string $walkMode type of file scanning: WALK_MODE_PHP or WALK_MODE_TEMPLATE
* @param \Thelia\Core\Translation\Translator $translator the current translator
* @param string $currentLocale the current locale
+ * @param string $domain the translation domain (fontoffice, backoffice, module, etc...)
* @param array $strings the list of strings
* @throws \InvalidArgumentException if $walkMode contains an invalid value
* @return number the total number of translatable texts
*/
- public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings)
+ public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, $domain, &$strings)
{
$num_texts = 0;
if ($walkMode == self::WALK_MODE_PHP) {
- $prefix = '\-\>[\s]*trans[\s]*\(';
+ $prefix = '\-\>[\s]*trans[\s]*\([\s]*';
$allowed_exts = array('php');
} elseif ($walkMode == self::WALK_MODE_TEMPLATE) {
- $prefix = '\{intl[\s]l=';
+ $prefix = '\{intl(?:.*?)l=[\s]*';
$allowed_exts = array('html', 'tpl', 'xml');
} else {
@@ -189,11 +211,12 @@ class TemplateHelper
Tlog::getInstance()->debug("Walking in $directory, in mode $walkMode");
+ /** @var \DirectoryIterator $fileInfo */
foreach (new \DirectoryIterator($directory) as $fileInfo) {
if ($fileInfo->isDot()) continue;
- if ($fileInfo->isDir()) $num_texts += $this->walkDir($fileInfo->getPathName(), $walkMode, $translator, $currentLocale, $strings);
+ if ($fileInfo->isDir()) $num_texts += $this->walkDir($fileInfo->getPathName(), $walkMode, $translator, $currentLocale, $domain, $strings);
if ($fileInfo->isFile()) {
@@ -213,6 +236,8 @@ class TemplateHelper
Tlog::getInstance()->debug("Strings found: ", $matches[2]);
+ $idx = 0;
+
foreach ($matches[2] as $match) {
$hash = md5($match);
@@ -224,16 +249,22 @@ class TemplateHelper
} else {
$num_texts++;
- // remove \'
- $match = str_replace("\\'", "'", $match);
+ // remove \' (or \"), that will prevent the translator to work properly, as
+ // "abc \def\" ghi" will be passed as abc "def" ghi to the translator.
+
+ $quote = $matches[1][$idx];
+
+ $match = str_replace("\\$quote", $quote, $match);
$strings[$hash] = array(
'files' => array($short_path),
'text' => $match,
- 'translation' => $translator->trans($match, array(), 'messages', $currentLocale, false),
+ 'translation' => $translator->trans($match, array(), $domain, $currentLocale, false),
'dollar' => strstr($match, '$') !== false
);
}
+
+ $idx++;
}
}
}
@@ -244,13 +275,24 @@ class TemplateHelper
return $num_texts;
} catch (\UnexpectedValueException $ex) {
- echo $ex;
+ // Directory does not exists => ignore/
}
}
- public function writeTranslation($file, $texts, $translations)
+ public function writeTranslation($file, $texts, $translations, $createIfNotExists = false)
{
+ $fs = new Filesystem();
+
+ if (! $fs->exists($file) && true === $createIfNotExists) {
+
+ $dir = dirname($file);
+
+ if (! $fs->exists($file)) {
+ $fs->mkdir($dir);
+ }
+ }
+
if ($fp = @fopen($file, 'w')) {
fwrite($fp, '<' . "?php\n\n");
diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php
index 15076211f..fb750c534 100644
--- a/core/lib/Thelia/Core/Thelia.php
+++ b/core/lib/Thelia/Core/Thelia.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core;
@@ -45,6 +34,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Config\DatabaseConfiguration;
use Thelia\Config\DefinePropel;
+use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\TemplateDefinition;
use Thelia\Core\DependencyInjection\Loader\XmlFileLoader;
@@ -54,11 +44,12 @@ use Propel\Runtime\Propel;
use Propel\Runtime\Connection\ConnectionManagerSingle;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Log\Tlog;
+use Thelia\Model\Module;
class Thelia extends Kernel
{
- const THELIA_VERSION = '2.0.0-RC1';
+ const THELIA_VERSION = '2.0.1';
public function init()
{
@@ -82,7 +73,7 @@ class Thelia extends Kernel
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
$con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);
if ($this->isDebug()) {
- $serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
+ $serviceContainer->setLogger('defaultLogger', Tlog::getInstance());
$con->useDebug(true);
}
@@ -104,8 +95,8 @@ class Thelia extends Kernel
/**
* Add all module's standard templates to the parser environment
*
- * @param TheliaParser $parser the parser
- * @param Module $module the Module.
+ * @param ParserInterface $parser the parser
+ * @param Module $module the Module.
*/
protected function addStandardModuleTemplatesToParserEnvironment($parser, $module)
{
@@ -119,10 +110,10 @@ class Thelia extends Kernel
/**
* Add a module template directory to the parser environment
*
- * @param TheliaParser $parser the parser
- * @param Module $module the Module.
- * @param string $templateType the template type (one of the TemplateDefinition type constants)
- * @param string $templateSubdirName the template subdirectory name (one of the TemplateDefinition::XXX_SUBDIR constants)
+ * @param ParserInterface $parser the parser
+ * @param Module $module the Module.
+ * @param string $templateType the template type (one of the TemplateDefinition type constants)
+ * @param string $templateSubdirName the template subdirectory name (one of the TemplateDefinition::XXX_SUBDIR constants)
*/
protected function addModuleTemplateToParserEnvironment($parser, $module, $templateType, $templateSubdirName)
{
@@ -179,8 +170,11 @@ class Thelia extends Kernel
$modules = \Thelia\Model\ModuleQuery::getActivated();
$translationDirs = array();
+
+ /** @var ParserInterface $parser */
$parser = $container->getDefinition('thelia.parser');
+ /** @var Module $module */
foreach ($modules as $module) {
try {
@@ -201,33 +195,63 @@ class Thelia extends Kernel
} else {
$container->addCompilerPass($compiler);
}
-
}
$loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath()));
$loader->load("config.xml");
+ // Core module translation
if (is_dir($dir = $module->getAbsoluteI18nPath())) {
- $translationDirs[] = $dir;
+ $translationDirs[$module->getTranslationDomain()] = $dir;
}
+ // Admin includes translation
+ if (is_dir($dir = $module->getAbsoluteAdminIncludesI18nPath())) {
+ $translationDirs[$module->getAdminIncludesTranslationDomain()] = $dir;
+ }
+
+ // Module back-office template, if any
+ $templates =
+ TemplateHelper::getInstance()->getList(
+ TemplateDefinition::BACK_OFFICE,
+ $module->getAbsoluteTemplateBasePath()
+ );
+
+ foreach ($templates as $template) {
+ $translationDirs[$module->getBackOfficeTemplateTranslationDomain($template->getName())] =
+ $module->getAbsoluteBackOfficeI18nTemplatePath($template->getName());
+ }
+
+ // Module front-office template, if any
+ $templates =
+ TemplateHelper::getInstance()->getList(
+ TemplateDefinition::FRONT_OFFICE,
+ $module->getAbsoluteTemplateBasePath()
+ );
+
+ foreach ($templates as $template) {
+ $translationDirs[$module->getFrontOfficeTemplateTranslationDomain($template->getName())] =
+ $module->getAbsoluteFrontOfficeI18nTemplatePath($template->getName());
+ }
$this->addStandardModuleTemplatesToParserEnvironment($parser, $module);
} catch (\InvalidArgumentException $e) {
- Tlog::getInstance()->addError(sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()), $e);
+ Tlog::getInstance()->addError(
+ sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()), $e
+ );
}
}
- // Load translation from templates
- // core translation
- $translationDirs[] = THELIA_ROOT . "core/lib/Thelia/Config/I18n";
+ // Load core translation
+ $translationDirs['core'] = THELIA_ROOT . 'core'.DS.'lib'.DS.'Thelia'.DS.'Config'.DS.'I18n';
// Standard templates (front, back, pdf, mail)
$th = TemplateHelper::getInstance();
+ /** @var TemplateDefinition $templateDefinition */
foreach ($th->getStandardTemplateDefinitions() as $templateDefinition) {
if (is_dir($dir = $templateDefinition->getAbsoluteI18nPath())) {
- $translationDirs[] = $dir;
+ $translationDirs[$templateDefinition->getTranslationDomain()] = $dir;
}
}
@@ -241,14 +265,24 @@ class Thelia extends Kernel
{
$translator = $container->getDefinition('thelia.translator');
- $finder = Finder::create()
- ->files()
- ->depth(0)
- ->in($dirs);
+ foreach ($dirs as $domain => $dir) {
- foreach ($finder as $file) {
- list($locale, $format) = explode('.', $file->getBaseName(), 2);
- $translator->addMethodCall('addResource', array($format, (string) $file, $locale));
+ try {
+ $finder = Finder::create()
+ ->files()
+ ->depth(0)
+ ->in($dir);
+
+ /** @var \DirectoryIterator $file */
+ foreach ($finder as $file) {
+ list($locale, $format) = explode('.', $file->getBaseName(), 2);
+
+ $translator->addMethodCall('addResource', array($format, (string) $file, $locale, $domain));
+ }
+ } catch (\InvalidArgumentException $ex) {
+ // Ignore missing I18n directories
+ Tlog::getInstance()->addWarning("loadTranslation: missing $dir directory");
+ }
}
}
@@ -298,7 +332,7 @@ class Thelia extends Kernel
public function getCacheDir()
{
if (defined('THELIA_ROOT')) {
- return THELIA_ROOT.'cache/'.$this->environment;
+ return THELIA_CACHE_DIR.DS.$this->environment;
} else {
return parent::getCacheDir();
}
@@ -315,7 +349,7 @@ class Thelia extends Kernel
public function getLogDir()
{
if (defined('THELIA_ROOT')) {
- return THELIA_ROOT.'log/';
+ return THELIA_LOG_DIR;
} else {
return parent::getLogDir();
}
diff --git a/core/lib/Thelia/Core/TheliaContainerBuilder.php b/core/lib/Thelia/Core/TheliaContainerBuilder.php
index 6a1f896e9..b409a233d 100644
--- a/core/lib/Thelia/Core/TheliaContainerBuilder.php
+++ b/core/lib/Thelia/Core/TheliaContainerBuilder.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Core;
diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php
index 64577bfcb..060871a22 100644
--- a/core/lib/Thelia/Core/TheliaHttpKernel.php
+++ b/core/lib/Thelia/Core/TheliaHttpKernel.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Core;
use Propel\Runtime\ActiveQuery\ModelCriteria;
@@ -32,7 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Session;
-use Thelia\Core\Event\Currency\CurrencyEvent;
+use Thelia\Core\Event\Currency\CurrencyChangeEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model;
@@ -152,7 +142,7 @@ class TheliaHttpKernel extends HttpKernel
if ($request->query->has("currency")) {
$currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency"));
if ($currency) {
- $this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyEvent($currency));
+ $this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyChangeEvent($currency, $request));
}
} else {
$currency = $request->getSession()->getCurrency(false);
diff --git a/core/lib/Thelia/Core/Translation/Translator.php b/core/lib/Thelia/Core/Translation/Translator.php
index fc1c75de2..bad4d4d99 100644
--- a/core/lib/Thelia/Core/Translation/Translator.php
+++ b/core/lib/Thelia/Core/Translation/Translator.php
@@ -1,8 +1,20 @@
getLocale();
@@ -62,11 +74,19 @@ class Translator extends BaseTranslator
$this->loadCatalogue($locale);
}
- if ($this->catalogues[$locale]->has((string) $id, $domain))
+ if (! $this->catalogues[$locale]->has((string) $id, $domain)) {
+
+ }
+
+ if ($this->catalogues[$locale]->has((string) $id, $domain)) {
return parent::trans($id, $parameters, $domain, $locale);
- else if ($return_default_if_not_available)
- return strtr($id, $parameters);
- else
- return '';
+ } else {
+ //Tlog::getInstance()->addWarning("Undefined translation: locale: $locale, domain: $domain, ID: $id");
+
+ if ($return_default_if_not_available)
+ return strtr($id, $parameters);
+ else
+ return '';
+ }
}
}
diff --git a/core/lib/Thelia/Coupon/BaseFacade.php b/core/lib/Thelia/Coupon/BaseFacade.php
index b8f5c9a7f..bdc87261d 100644
--- a/core/lib/Thelia/Coupon/BaseFacade.php
+++ b/core/lib/Thelia/Coupon/BaseFacade.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon;
@@ -29,6 +18,8 @@ use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\TranslatorInterface;
use Thelia\Condition\ConditionEvaluator;
use Thelia\Core\HttpFoundation\Request;
+use Thelia\Core\Template\ParserInterface;
+use Thelia\Core\Template\TemplateHelper;
use Thelia\Model\Coupon;
use Thelia\Model\CouponQuery;
use Thelia\Cart\CartTrait;
@@ -54,6 +45,9 @@ class BaseFacade implements FacadeInterface
/** @var Translator Service Translator */
protected $translator = null;
+ /** @var ParserInterface The thelia parser */
+ private $parser = null;
+
/**
* Constructor
*
@@ -208,6 +202,23 @@ class BaseFacade implements FacadeInterface
return $this->container->get('thelia.translator');
}
+ /**
+ * Return platform Parser
+ *
+ * @return ParserInterface
+ */
+ public function getParser()
+ {
+ if ($this->parser == null) {
+ $this->parser = $this->container->get('thelia.parser');
+
+ // Define the current back-office template that should be used
+ $this->parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveAdminTemplate());
+ }
+
+ return $this->parser;
+ }
+
/**
* Return the main currency
* THe one used to set prices in BackOffice
diff --git a/core/lib/Thelia/Coupon/CouponFactory.php b/core/lib/Thelia/Coupon/CouponFactory.php
index 69eb75162..e577061b7 100644
--- a/core/lib/Thelia/Coupon/CouponFactory.php
+++ b/core/lib/Thelia/Coupon/CouponFactory.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon;
diff --git a/core/lib/Thelia/Coupon/CouponManager.php b/core/lib/Thelia/Coupon/CouponManager.php
index f072ad69b..daf1ca9d2 100644
--- a/core/lib/Thelia/Coupon/CouponManager.php
+++ b/core/lib/Thelia/Coupon/CouponManager.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon;
diff --git a/core/lib/Thelia/Coupon/FacadeInterface.php b/core/lib/Thelia/Coupon/FacadeInterface.php
index 1b2d01a5b..40e4e2948 100644
--- a/core/lib/Thelia/Coupon/FacadeInterface.php
+++ b/core/lib/Thelia/Coupon/FacadeInterface.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon;
@@ -28,6 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Thelia\Condition\ConditionEvaluator;
use Thelia\Core\HttpFoundation\Request;
+use Thelia\Core\Template\ParserInterface;
use Thelia\Model\Coupon;
/**
@@ -140,6 +130,12 @@ interface FacadeInterface
* @return TranslatorInterface
*/
public function getTranslator();
+ /**
+ * Return platform ParserInterface
+ *
+ * @return ParserInterface
+ */
+ public function getParser();
/**
* Return the main currency
diff --git a/core/lib/Thelia/Coupon/Type/CouponAbstract.php b/core/lib/Thelia/Coupon/Type/CouponAbstract.php
index 9518c3214..5a2c5f03a 100644
--- a/core/lib/Thelia/Coupon/Type/CouponAbstract.php
+++ b/core/lib/Thelia/Coupon/Type/CouponAbstract.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon\Type;
@@ -361,22 +350,16 @@ abstract class CouponAbstract implements CouponInterface
/**
* Draw the input displayed in the BackOffice
* allowing Admin to set its Coupon effect
+ * Override this method to do something useful
*
* @return string HTML string
*/
- public function drawBackOfficeInputs()
- {
- $label = $this->getInputName();
- $value = $this->amount;
-
- $html = '
-
-
-
-
- ';
-
- return $html;
+ public function drawBackOfficeInputs() {
+ return $this->facade->getParser()->render('coupon/type-fragments/remove-x.html', [
+ 'label' => $this->getInputName(),
+ 'fieldName' => self::INPUT_AMOUNT_NAME,
+ 'value' => $this->amount
+ ]);
}
/**
diff --git a/core/lib/Thelia/Coupon/Type/CouponInterface.php b/core/lib/Thelia/Coupon/Type/CouponInterface.php
index 822af01c9..12b54db15 100644
--- a/core/lib/Thelia/Coupon/Type/CouponInterface.php
+++ b/core/lib/Thelia/Coupon/Type/CouponInterface.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon\Type;
diff --git a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php
index e9d7b208e..c644706a2 100644
--- a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php
+++ b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon\Type;
@@ -44,7 +33,7 @@ class RemoveXAmount extends CouponAbstract
{
return $this->facade
->getTranslator()
- ->trans('Remove X amount to total cart', array(), 'coupon');
+ ->trans('Fixed Amount Discount', array(), 'coupon');
}
/**
@@ -56,7 +45,7 @@ class RemoveXAmount extends CouponAbstract
{
return $this->facade
->getTranslator()
- ->trans('Amount removed from the cart', array(), 'coupon');
+ ->trans('Discount amount', array(), 'coupon');
}
/**
@@ -69,11 +58,20 @@ class RemoveXAmount extends CouponAbstract
$toolTip = $this->facade
->getTranslator()
->trans(
- 'This coupon will remove the entered amount to the customer total checkout. If the discount is superior to the total checkout price the customer will only pay the postage. Unless if the coupon is set to remove postage too.',
+ 'This coupon will subtracts a set amount from the total cost of an order. If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
array(),
'coupon'
);
return $toolTip;
}
+
+ public function drawBackOfficeInputs()
+ {
+ return $this->facade->getParser()->render('coupon/type-fragments/remove-x-amount.html', [
+ 'label' => $this->getInputName(),
+ 'fieldName' => self::INPUT_AMOUNT_NAME,
+ 'value' => $this->amount
+ ]);
+ }
}
diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php
index 747d55a72..83c625d9c 100644
--- a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php
+++ b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon\Type;
@@ -127,7 +116,7 @@ class RemoveXPercent extends CouponAbstract
{
return $this->facade
->getTranslator()
- ->trans('Percentage removed from the cart', array(), 'coupon');
+ ->trans('Percent Discount', array(), 'coupon');
}
/**
@@ -140,7 +129,7 @@ class RemoveXPercent extends CouponAbstract
$toolTip = $this->facade
->getTranslator()
->trans(
- 'This coupon will remove the entered percentage to the customer total checkout. If the discount is superior to the total checkout price the customer will only pay the postage. Unless if the coupon is set to remove postage too.',
+ 'This coupon will offert a flat percentage off a shopper\'s entire order (not applied to shipping costs or tax rates). If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
array(),
'coupon'
);
@@ -156,17 +145,12 @@ class RemoveXPercent extends CouponAbstract
*/
public function drawBackOfficeInputs()
{
- $labelPercentage = $this->getInputName();
-
- $html = '
-
-
-
-
-
- ';
-
- return $html;
+ return $this->facade->getParser()->render('coupon/type-fragments/remove-x-percent.html', [
+ 'label' => $this->getInputName(),
+ 'typeKey' => self::INPUT_AMOUNT_NAME,
+ 'fieldId' => self::INPUT_PERCENTAGE_NAME,
+ 'fieldName' => self::INPUT_EXTENDED__NAME,
+ 'value' => $this->percentage
+ ]);
}
-
}
diff --git a/core/lib/Thelia/Exception/AdminAccessDenied.php b/core/lib/Thelia/Exception/AdminAccessDenied.php
index a0f9fc14a..fd620b474 100644
--- a/core/lib/Thelia/Exception/AdminAccessDenied.php
+++ b/core/lib/Thelia/Exception/AdminAccessDenied.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/CouponExpiredException.php b/core/lib/Thelia/Exception/CouponExpiredException.php
index 3aa912549..499ea7dae 100644
--- a/core/lib/Thelia/Exception/CouponExpiredException.php
+++ b/core/lib/Thelia/Exception/CouponExpiredException.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/CustomerException.php b/core/lib/Thelia/Exception/CustomerException.php
index e2381ca26..ef1f1a591 100644
--- a/core/lib/Thelia/Exception/CustomerException.php
+++ b/core/lib/Thelia/Exception/CustomerException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/DocumentException.php b/core/lib/Thelia/Exception/DocumentException.php
index 9727a4267..80aed3559 100644
--- a/core/lib/Thelia/Exception/DocumentException.php
+++ b/core/lib/Thelia/Exception/DocumentException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/ImageException.php b/core/lib/Thelia/Exception/ImageException.php
index 948ee07f0..ec8bbb673 100644
--- a/core/lib/Thelia/Exception/ImageException.php
+++ b/core/lib/Thelia/Exception/ImageException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/InvalidCartException.php b/core/lib/Thelia/Exception/InvalidCartException.php
index 67269df7b..a071ca900 100644
--- a/core/lib/Thelia/Exception/InvalidCartException.php
+++ b/core/lib/Thelia/Exception/InvalidCartException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/InvalidConditionException.php b/core/lib/Thelia/Exception/InvalidConditionException.php
index 89d01a7be..4303c9416 100644
--- a/core/lib/Thelia/Exception/InvalidConditionException.php
+++ b/core/lib/Thelia/Exception/InvalidConditionException.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/InvalidConditionOperatorException.php b/core/lib/Thelia/Exception/InvalidConditionOperatorException.php
index b336aac9a..4d2dc8dc0 100644
--- a/core/lib/Thelia/Exception/InvalidConditionOperatorException.php
+++ b/core/lib/Thelia/Exception/InvalidConditionOperatorException.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/InvalidConditionValueException.php b/core/lib/Thelia/Exception/InvalidConditionValueException.php
index 65f94ae3a..282cfc333 100644
--- a/core/lib/Thelia/Exception/InvalidConditionValueException.php
+++ b/core/lib/Thelia/Exception/InvalidConditionValueException.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/MemberAccessException.php b/core/lib/Thelia/Exception/MemberAccessException.php
index e1f65e590..bd6d269d3 100644
--- a/core/lib/Thelia/Exception/MemberAccessException.php
+++ b/core/lib/Thelia/Exception/MemberAccessException.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Exception;
class MemberAccessException extends \LogicException
diff --git a/core/lib/Thelia/Exception/MissingFacadeException.php b/core/lib/Thelia/Exception/MissingFacadeException.php
index e717b1457..06845e0d2 100644
--- a/core/lib/Thelia/Exception/MissingFacadeException.php
+++ b/core/lib/Thelia/Exception/MissingFacadeException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/ModuleException.php b/core/lib/Thelia/Exception/ModuleException.php
index 263a071b0..be581cf51 100644
--- a/core/lib/Thelia/Exception/ModuleException.php
+++ b/core/lib/Thelia/Exception/ModuleException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/NotImplementedException.php b/core/lib/Thelia/Exception/NotImplementedException.php
index 96b2117c8..31b263f14 100644
--- a/core/lib/Thelia/Exception/NotImplementedException.php
+++ b/core/lib/Thelia/Exception/NotImplementedException.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/OrderException.php b/core/lib/Thelia/Exception/OrderException.php
index 8654277c5..1a216e9cf 100644
--- a/core/lib/Thelia/Exception/OrderException.php
+++ b/core/lib/Thelia/Exception/OrderException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/TaxEngineException.php b/core/lib/Thelia/Exception/TaxEngineException.php
index 8150d7169..b9b2363aa 100644
--- a/core/lib/Thelia/Exception/TaxEngineException.php
+++ b/core/lib/Thelia/Exception/TaxEngineException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/TheliaProcessException.php b/core/lib/Thelia/Exception/TheliaProcessException.php
index f61224dea..2fbee5087 100644
--- a/core/lib/Thelia/Exception/TheliaProcessException.php
+++ b/core/lib/Thelia/Exception/TheliaProcessException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/TypeException.php b/core/lib/Thelia/Exception/TypeException.php
index 442fffe3e..bb8e3f159 100644
--- a/core/lib/Thelia/Exception/TypeException.php
+++ b/core/lib/Thelia/Exception/TypeException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Exception/UrlRewritingException.php b/core/lib/Thelia/Exception/UrlRewritingException.php
index 4d84a0193..0ff0a3864 100644
--- a/core/lib/Thelia/Exception/UrlRewritingException.php
+++ b/core/lib/Thelia/Exception/UrlRewritingException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Form/AddressCreateForm.php b/core/lib/Thelia/Form/AddressCreateForm.php
index 7dcdff4d8..289d809dd 100644
--- a/core/lib/Thelia/Form/AddressCreateForm.php
+++ b/core/lib/Thelia/Form/AddressCreateForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/AddressUpdateForm.php b/core/lib/Thelia/Form/AddressUpdateForm.php
index 258fbc357..c79ec97c8 100644
--- a/core/lib/Thelia/Form/AddressUpdateForm.php
+++ b/core/lib/Thelia/Form/AddressUpdateForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/AdminLogin.php b/core/lib/Thelia/Form/AdminLogin.php
index ff26bdc8d..d5ecb0563 100644
--- a/core/lib/Thelia/Form/AdminLogin.php
+++ b/core/lib/Thelia/Form/AdminLogin.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\Length;
diff --git a/core/lib/Thelia/Form/AdministratorCreationForm.php b/core/lib/Thelia/Form/AdministratorCreationForm.php
index 669b72a9a..58df8f000 100644
--- a/core/lib/Thelia/Form/AdministratorCreationForm.php
+++ b/core/lib/Thelia/Form/AdministratorCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/AdministratorModificationForm.php b/core/lib/Thelia/Form/AdministratorModificationForm.php
index d9dae7ce4..cfc9d0bd4 100644
--- a/core/lib/Thelia/Form/AdministratorModificationForm.php
+++ b/core/lib/Thelia/Form/AdministratorModificationForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/Area/AreaCountryForm.php b/core/lib/Thelia/Form/Area/AreaCountryForm.php
index b3f09ae06..fcde947b7 100644
--- a/core/lib/Thelia/Form/Area/AreaCountryForm.php
+++ b/core/lib/Thelia/Form/Area/AreaCountryForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Area;
diff --git a/core/lib/Thelia/Form/Area/AreaCreateForm.php b/core/lib/Thelia/Form/Area/AreaCreateForm.php
index 79fc4b2a2..adbae921b 100644
--- a/core/lib/Thelia/Form/Area/AreaCreateForm.php
+++ b/core/lib/Thelia/Form/Area/AreaCreateForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Area;
@@ -62,7 +51,7 @@ class AreaCreateForm extends BaseForm
new NotBlank()
),
'label_attr' => array('for' => 'shipping_name'),
- 'label' => Translator::getInstance()->trans('shipping area name')
+ 'label' => Translator::getInstance()->trans('Shipping zone name')
))
;
diff --git a/core/lib/Thelia/Form/Area/AreaModificationForm.php b/core/lib/Thelia/Form/Area/AreaModificationForm.php
index 6c9d52f7f..86ac8a364 100644
--- a/core/lib/Thelia/Form/Area/AreaModificationForm.php
+++ b/core/lib/Thelia/Form/Area/AreaModificationForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Area;
diff --git a/core/lib/Thelia/Form/Area/AreaPostageForm.php b/core/lib/Thelia/Form/Area/AreaPostageForm.php
index fa22ab908..d885ba517 100644
--- a/core/lib/Thelia/Form/Area/AreaPostageForm.php
+++ b/core/lib/Thelia/Form/Area/AreaPostageForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Area;
diff --git a/core/lib/Thelia/Form/AttributeAvCreationForm.php b/core/lib/Thelia/Form/AttributeAvCreationForm.php
index 513fc0c6b..e14190435 100644
--- a/core/lib/Thelia/Form/AttributeAvCreationForm.php
+++ b/core/lib/Thelia/Form/AttributeAvCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/AttributeCreationForm.php b/core/lib/Thelia/Form/AttributeCreationForm.php
index db638fb29..81f92683f 100644
--- a/core/lib/Thelia/Form/AttributeCreationForm.php
+++ b/core/lib/Thelia/Form/AttributeCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/AttributeModificationForm.php b/core/lib/Thelia/Form/AttributeModificationForm.php
index cd6ea2a76..fda1a679b 100644
--- a/core/lib/Thelia/Form/AttributeModificationForm.php
+++ b/core/lib/Thelia/Form/AttributeModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/BaseForm.php b/core/lib/Thelia/Form/BaseForm.php
index 8dff18cfc..332d8eff6 100644
--- a/core/lib/Thelia/Form/BaseForm.php
+++ b/core/lib/Thelia/Form/BaseForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
@@ -189,7 +179,7 @@ abstract class BaseForm
/**
* Set the error message related to global form error
*
- * @param unknown $message
+ * @param string $message
*/
public function setErrorMessage($message)
{
diff --git a/core/lib/Thelia/Form/Cache/AssetsFlushForm.php b/core/lib/Thelia/Form/Cache/AssetsFlushForm.php
new file mode 100644
index 000000000..4847208f9
--- /dev/null
+++ b/core/lib/Thelia/Form/Cache/AssetsFlushForm.php
@@ -0,0 +1,40 @@
+
+ */
+class AssetsFlushForm extends BaseForm
+{
+
+ /**
+ * @inheritdoc
+ */
+ protected function buildForm()
+ {
+ //Nothing, we just want CSRF protection
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getName()
+ {
+ return "assets_flush";
+ }
+}
diff --git a/core/lib/Thelia/Form/Cache/CacheFlushForm.php b/core/lib/Thelia/Form/Cache/CacheFlushForm.php
new file mode 100644
index 000000000..b68b418f9
--- /dev/null
+++ b/core/lib/Thelia/Form/Cache/CacheFlushForm.php
@@ -0,0 +1,40 @@
+
+ */
+class CacheFlushForm extends BaseForm
+{
+
+ /**
+ * @inheritdoc
+ */
+ protected function buildForm()
+ {
+ //Nothing, we just want CSRF protection
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getName()
+ {
+ return "cache_flush";
+ }
+}
diff --git a/core/lib/Thelia/Form/Cache/ImagesAndDocumentsCacheFlushForm.php b/core/lib/Thelia/Form/Cache/ImagesAndDocumentsCacheFlushForm.php
new file mode 100644
index 000000000..ef29944e9
--- /dev/null
+++ b/core/lib/Thelia/Form/Cache/ImagesAndDocumentsCacheFlushForm.php
@@ -0,0 +1,40 @@
+
+ */
+class ImagesAndDocumentsCacheFlushForm extends BaseForm
+{
+
+ /**
+ * @inheritdoc
+ */
+ protected function buildForm()
+ {
+ //Nothing, we just want CSRF protection
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getName()
+ {
+ return "images_and_documents_cache_flush";
+ }
+}
diff --git a/core/lib/Thelia/Form/CartAdd.php b/core/lib/Thelia/Form/CartAdd.php
index 7b750b40d..688394ee3 100644
--- a/core/lib/Thelia/Form/CartAdd.php
+++ b/core/lib/Thelia/Form/CartAdd.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/CategoryCreationForm.php b/core/lib/Thelia/Form/CategoryCreationForm.php
index 6a0172180..8db602d33 100644
--- a/core/lib/Thelia/Form/CategoryCreationForm.php
+++ b/core/lib/Thelia/Form/CategoryCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
diff --git a/core/lib/Thelia/Form/CategoryDocumentModification.php b/core/lib/Thelia/Form/CategoryDocumentModification.php
index 9ad7ba890..b7def3b50 100644
--- a/core/lib/Thelia/Form/CategoryDocumentModification.php
+++ b/core/lib/Thelia/Form/CategoryDocumentModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Form\Image\DocumentModification;
diff --git a/core/lib/Thelia/Form/CategoryImageModification.php b/core/lib/Thelia/Form/CategoryImageModification.php
index 6f24263eb..2348c2fe9 100644
--- a/core/lib/Thelia/Form/CategoryImageModification.php
+++ b/core/lib/Thelia/Form/CategoryImageModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Form\Image\ImageModification;
diff --git a/core/lib/Thelia/Form/CategoryModificationForm.php b/core/lib/Thelia/Form/CategoryModificationForm.php
index 1ce877803..6611f5f1d 100644
--- a/core/lib/Thelia/Form/CategoryModificationForm.php
+++ b/core/lib/Thelia/Form/CategoryModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
diff --git a/core/lib/Thelia/Form/ConfigCreationForm.php b/core/lib/Thelia/Form/ConfigCreationForm.php
index 56df63f8a..55e6abf70 100644
--- a/core/lib/Thelia/Form/ConfigCreationForm.php
+++ b/core/lib/Thelia/Form/ConfigCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/ConfigModificationForm.php b/core/lib/Thelia/Form/ConfigModificationForm.php
index 318da7185..ed5cec2b7 100644
--- a/core/lib/Thelia/Form/ConfigModificationForm.php
+++ b/core/lib/Thelia/Form/ConfigModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
diff --git a/core/lib/Thelia/Form/ConfigStoreForm.php b/core/lib/Thelia/Form/ConfigStoreForm.php
index 382e91c4d..b7b49b2a0 100644
--- a/core/lib/Thelia/Form/ConfigStoreForm.php
+++ b/core/lib/Thelia/Form/ConfigStoreForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/ContactForm.php b/core/lib/Thelia/Form/ContactForm.php
index 8497a2222..1d8366806 100644
--- a/core/lib/Thelia/Form/ContactForm.php
+++ b/core/lib/Thelia/Form/ContactForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/ContentCreationForm.php b/core/lib/Thelia/Form/ContentCreationForm.php
index 663ed4c1b..c5d65f757 100644
--- a/core/lib/Thelia/Form/ContentCreationForm.php
+++ b/core/lib/Thelia/Form/ContentCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
diff --git a/core/lib/Thelia/Form/ContentDocumentModification.php b/core/lib/Thelia/Form/ContentDocumentModification.php
index d9d7c0571..020639fae 100644
--- a/core/lib/Thelia/Form/ContentDocumentModification.php
+++ b/core/lib/Thelia/Form/ContentDocumentModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Form\Image\DocumentModification;
diff --git a/core/lib/Thelia/Form/ContentImageModification.php b/core/lib/Thelia/Form/ContentImageModification.php
index d80e47224..d6768eed0 100644
--- a/core/lib/Thelia/Form/ContentImageModification.php
+++ b/core/lib/Thelia/Form/ContentImageModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Form\Image\ImageModification;
diff --git a/core/lib/Thelia/Form/ContentModificationForm.php b/core/lib/Thelia/Form/ContentModificationForm.php
index dbe427b9f..a04aeefef 100644
--- a/core/lib/Thelia/Form/ContentModificationForm.php
+++ b/core/lib/Thelia/Form/ContentModificationForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/CountryCreationForm.php b/core/lib/Thelia/Form/CountryCreationForm.php
index fe7486852..8641f0850 100644
--- a/core/lib/Thelia/Form/CountryCreationForm.php
+++ b/core/lib/Thelia/Form/CountryCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
diff --git a/core/lib/Thelia/Form/CountryModificationForm.php b/core/lib/Thelia/Form/CountryModificationForm.php
index 99c404e62..e2efad398 100644
--- a/core/lib/Thelia/Form/CountryModificationForm.php
+++ b/core/lib/Thelia/Form/CountryModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
diff --git a/core/lib/Thelia/Form/CouponCode.php b/core/lib/Thelia/Form/CouponCode.php
index 1319c1fb8..b72959741 100644
--- a/core/lib/Thelia/Form/CouponCode.php
+++ b/core/lib/Thelia/Form/CouponCode.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/CouponCreationForm.php b/core/lib/Thelia/Form/CouponCreationForm.php
index 279063329..a42ad85da 100644
--- a/core/lib/Thelia/Form/CouponCreationForm.php
+++ b/core/lib/Thelia/Form/CouponCreationForm.php
@@ -1,32 +1,24 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Form;
-use Symfony\Component\Validator\Constraints\Date;
+use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotEqualTo;
+use Symfony\Component\Validator\ExecutionContextInterface;
+use Thelia\Core\Translation\Translator;
+use Thelia\Model\Base\LangQuery;
/**
* Allow to build a form Coupon
@@ -106,7 +98,11 @@ class CouponCreationForm extends BaseForm
array(
'constraints' => array(
new NotBlank(),
- new Date()
+ new Callback(array(
+ "methods" => array(
+ array($this, "checkLocalizedDate"),
+ ),
+ ))
)
)
)
@@ -131,11 +127,7 @@ class CouponCreationForm extends BaseForm
array(
'constraints' => array(
new NotBlank(),
- new GreaterThanOrEqual(
- array(
- 'value' => -1
- )
- )
+ new GreaterThanOrEqual(['value' => -1])
)
)
)
@@ -150,6 +142,24 @@ class CouponCreationForm extends BaseForm
);
}
+ /**
+ * Validate a date entered with the default Language date format.
+ *
+ * @param string $value
+ * @param ExecutionContextInterface $context
+ */
+ public function checkLocalizedDate($value, ExecutionContextInterface $context)
+ {
+ $format = LangQuery::create()->findOneByByDefault(true)->getDateFormat();
+
+ if (false === \DateTime::createFromFormat($format, $value)) {
+ $context->addViolation(Translator::getInstance()->trans("Date '%date' is invalid, please enter a valid date using %fmt format", [
+ '%fmt' => $format,
+ '%date' => $value
+ ]));
+ }
+ }
+
/**
* Get form name
*
diff --git a/core/lib/Thelia/Form/CurrencyCreationForm.php b/core/lib/Thelia/Form/CurrencyCreationForm.php
index 9872d100c..0c3a8c3bf 100644
--- a/core/lib/Thelia/Form/CurrencyCreationForm.php
+++ b/core/lib/Thelia/Form/CurrencyCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/CurrencyModificationForm.php b/core/lib/Thelia/Form/CurrencyModificationForm.php
index c56791e3d..1f5901a57 100644
--- a/core/lib/Thelia/Form/CurrencyModificationForm.php
+++ b/core/lib/Thelia/Form/CurrencyModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
diff --git a/core/lib/Thelia/Form/CustomerCreateForm.php b/core/lib/Thelia/Form/CustomerCreateForm.php
index 2da01fe48..d0e915657 100644
--- a/core/lib/Thelia/Form/CustomerCreateForm.php
+++ b/core/lib/Thelia/Form/CustomerCreateForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/CustomerLogin.php b/core/lib/Thelia/Form/CustomerLogin.php
index 8c2f2fa6d..12ba68696 100644
--- a/core/lib/Thelia/Form/CustomerLogin.php
+++ b/core/lib/Thelia/Form/CustomerLogin.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/CustomerLostPasswordForm.php b/core/lib/Thelia/Form/CustomerLostPasswordForm.php
index ee26fd2c1..3d29605e9 100644
--- a/core/lib/Thelia/Form/CustomerLostPasswordForm.php
+++ b/core/lib/Thelia/Form/CustomerLostPasswordForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php
index 50f49261a..9fece619c 100644
--- a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php
+++ b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php
index 9b075abe8..1d4d07b30 100644
--- a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php
+++ b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\ExecutionContextInterface;
diff --git a/core/lib/Thelia/Form/CustomerUpdateForm.php b/core/lib/Thelia/Form/CustomerUpdateForm.php
index 6f4411113..ae7f446a7 100644
--- a/core/lib/Thelia/Form/CustomerUpdateForm.php
+++ b/core/lib/Thelia/Form/CustomerUpdateForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
@@ -169,6 +158,12 @@ class CustomerUpdateForm extends BaseForm
"for" => "title"
)
))
+ ->add('discount', 'text', array(
+ 'label' => Translator::getInstance()->trans('permanent discount (in percent)'),
+ 'label_attr' => array(
+ 'for' => 'discount'
+ )
+ ))
;
}
diff --git a/core/lib/Thelia/Form/Exception/FormValidationException.php b/core/lib/Thelia/Form/Exception/FormValidationException.php
index c955b03f0..9547ec872 100644
--- a/core/lib/Thelia/Form/Exception/FormValidationException.php
+++ b/core/lib/Thelia/Form/Exception/FormValidationException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Exception;
diff --git a/core/lib/Thelia/Form/Exception/ProductNotFoundException.php b/core/lib/Thelia/Form/Exception/ProductNotFoundException.php
index 480aec433..3c786cfd8 100644
--- a/core/lib/Thelia/Form/Exception/ProductNotFoundException.php
+++ b/core/lib/Thelia/Form/Exception/ProductNotFoundException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Exception;
diff --git a/core/lib/Thelia/Form/Exception/StockNotFoundException.php b/core/lib/Thelia/Form/Exception/StockNotFoundException.php
index 47c5740da..cc3bdbbbe 100644
--- a/core/lib/Thelia/Form/Exception/StockNotFoundException.php
+++ b/core/lib/Thelia/Form/Exception/StockNotFoundException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Exception;
diff --git a/core/lib/Thelia/Form/FeatureAvCreationForm.php b/core/lib/Thelia/Form/FeatureAvCreationForm.php
index 9245bf28d..77b4ec410 100644
--- a/core/lib/Thelia/Form/FeatureAvCreationForm.php
+++ b/core/lib/Thelia/Form/FeatureAvCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/FeatureCreationForm.php b/core/lib/Thelia/Form/FeatureCreationForm.php
index b436ca917..747d504aa 100644
--- a/core/lib/Thelia/Form/FeatureCreationForm.php
+++ b/core/lib/Thelia/Form/FeatureCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/FeatureModificationForm.php b/core/lib/Thelia/Form/FeatureModificationForm.php
index 5b20bd337..6b08d185b 100644
--- a/core/lib/Thelia/Form/FeatureModificationForm.php
+++ b/core/lib/Thelia/Form/FeatureModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/FolderCreationForm.php b/core/lib/Thelia/Form/FolderCreationForm.php
index ac7b10376..27386a8b5 100644
--- a/core/lib/Thelia/Form/FolderCreationForm.php
+++ b/core/lib/Thelia/Form/FolderCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
diff --git a/core/lib/Thelia/Form/FolderDocumentModification.php b/core/lib/Thelia/Form/FolderDocumentModification.php
index 47bcd7c7f..76263bf76 100644
--- a/core/lib/Thelia/Form/FolderDocumentModification.php
+++ b/core/lib/Thelia/Form/FolderDocumentModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Form\Image\DocumentModification;
diff --git a/core/lib/Thelia/Form/FolderImageModification.php b/core/lib/Thelia/Form/FolderImageModification.php
index 004c4676b..fbb02e028 100644
--- a/core/lib/Thelia/Form/FolderImageModification.php
+++ b/core/lib/Thelia/Form/FolderImageModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Form\Image\ImageModification;
diff --git a/core/lib/Thelia/Form/FolderModificationForm.php b/core/lib/Thelia/Form/FolderModificationForm.php
index daab3b5ad..156662bcd 100644
--- a/core/lib/Thelia/Form/FolderModificationForm.php
+++ b/core/lib/Thelia/Form/FolderModificationForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/Image/DocumentModification.php b/core/lib/Thelia/Form/Image/DocumentModification.php
index 199a874b4..6af9a5d12 100644
--- a/core/lib/Thelia/Form/Image/DocumentModification.php
+++ b/core/lib/Thelia/Form/Image/DocumentModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form\Image;
use Symfony\Component\Validator\Constraints\NotBlank;
diff --git a/core/lib/Thelia/Form/Image/ImageModification.php b/core/lib/Thelia/Form/Image/ImageModification.php
index 93b8f9898..472deb4fb 100644
--- a/core/lib/Thelia/Form/Image/ImageModification.php
+++ b/core/lib/Thelia/Form/Image/ImageModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form\Image;
use Symfony\Component\Validator\Constraints\Image;
diff --git a/core/lib/Thelia/Form/InstallStep3Form.php b/core/lib/Thelia/Form/InstallStep3Form.php
index 9388f14db..4cfefba7e 100644
--- a/core/lib/Thelia/Form/InstallStep3Form.php
+++ b/core/lib/Thelia/Form/InstallStep3Form.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/Lang/LangCreateForm.php b/core/lib/Thelia/Form/Lang/LangCreateForm.php
index d41c45641..44c149511 100644
--- a/core/lib/Thelia/Form/Lang/LangCreateForm.php
+++ b/core/lib/Thelia/Form/Lang/LangCreateForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Lang;
@@ -102,6 +91,30 @@ class LangCreateForm extends BaseForm
'for' => 'time_lang'
)
))
+ ->add('decimal_separator', 'text', array(
+ 'constraints' => array(
+ new NotBlank()
+ ),
+ 'label' => Translator::getInstance()->trans('decimal separator'),
+ 'label_attr' => array(
+ 'for' => 'decimal_separator'
+ )
+ ))
+ ->add('thousands_separator', 'text', array(
+ 'label' => Translator::getInstance()->trans('thousands separator'),
+ 'label_attr' => array(
+ 'for' => 'thousands_separator'
+ )
+ ))
+ ->add('decimals', 'text', array(
+ 'constraints' => array(
+ new NotBlank()
+ ),
+ 'label' => Translator::getInstance()->trans('Sets the number of decimal points'),
+ 'label_attr' => array(
+ 'for' => 'decimals'
+ )
+ ))
;
}
diff --git a/core/lib/Thelia/Form/Lang/LangDefaultBehaviorForm.php b/core/lib/Thelia/Form/Lang/LangDefaultBehaviorForm.php
index 38a48a007..3d29e86ad 100644
--- a/core/lib/Thelia/Form/Lang/LangDefaultBehaviorForm.php
+++ b/core/lib/Thelia/Form/Lang/LangDefaultBehaviorForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Lang;
diff --git a/core/lib/Thelia/Form/Lang/LangUpdateForm.php b/core/lib/Thelia/Form/Lang/LangUpdateForm.php
index e0c572797..6491013e1 100644
--- a/core/lib/Thelia/Form/Lang/LangUpdateForm.php
+++ b/core/lib/Thelia/Form/Lang/LangUpdateForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Lang;
diff --git a/core/lib/Thelia/Form/Lang/LangUrlEvent.php b/core/lib/Thelia/Form/Lang/LangUrlEvent.php
index 18366f094..018a7156f 100644
--- a/core/lib/Thelia/Form/Lang/LangUrlEvent.php
+++ b/core/lib/Thelia/Form/Lang/LangUrlEvent.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Lang;
diff --git a/core/lib/Thelia/Form/Lang/LangUrlForm.php b/core/lib/Thelia/Form/Lang/LangUrlForm.php
index 784924728..27cc2623f 100644
--- a/core/lib/Thelia/Form/Lang/LangUrlForm.php
+++ b/core/lib/Thelia/Form/Lang/LangUrlForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\Lang;
diff --git a/core/lib/Thelia/Form/MailingSystemModificationForm.php b/core/lib/Thelia/Form/MailingSystemModificationForm.php
index 2ae325b20..14bf6c1ed 100644
--- a/core/lib/Thelia/Form/MailingSystemModificationForm.php
+++ b/core/lib/Thelia/Form/MailingSystemModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Core\Translation\Translator;
diff --git a/core/lib/Thelia/Form/MessageCreationForm.php b/core/lib/Thelia/Form/MessageCreationForm.php
index 288de1d36..e0187b797 100644
--- a/core/lib/Thelia/Form/MessageCreationForm.php
+++ b/core/lib/Thelia/Form/MessageCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/MessageModificationForm.php b/core/lib/Thelia/Form/MessageModificationForm.php
index 231c605b8..26b5b87e0 100644
--- a/core/lib/Thelia/Form/MessageModificationForm.php
+++ b/core/lib/Thelia/Form/MessageModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
diff --git a/core/lib/Thelia/Form/ModuleModificationForm.php b/core/lib/Thelia/Form/ModuleModificationForm.php
index 2d0e6eea7..14272151b 100644
--- a/core/lib/Thelia/Form/ModuleModificationForm.php
+++ b/core/lib/Thelia/Form/ModuleModificationForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/NewsletterForm.php b/core/lib/Thelia/Form/NewsletterForm.php
index aa90138b1..4bdf97046 100644
--- a/core/lib/Thelia/Form/NewsletterForm.php
+++ b/core/lib/Thelia/Form/NewsletterForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/OrderDelivery.php b/core/lib/Thelia/Form/OrderDelivery.php
index 37172612a..74ad75f33 100644
--- a/core/lib/Thelia/Form/OrderDelivery.php
+++ b/core/lib/Thelia/Form/OrderDelivery.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
@@ -83,13 +73,12 @@ class OrderDelivery extends BaseForm
if (null === $module) {
$context->addViolation(Translator::getInstance()->trans("Delivery module ID not found"));
- }
-
- $moduleReflection = new \ReflectionClass($module->getFullNamespace());
- if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
- $context->addViolation(
- sprintf(Translator::getInstance()->trans("delivery module %s is not a Thelia\Module\DeliveryModuleInterface"), $module->getCode())
- );
+ } else {
+ if (! $module->isDeliveryModule()) {
+ $context->addViolation(
+ sprintf(Translator::getInstance()->trans("delivery module %s is not a Thelia\Module\DeliveryModuleInterface"), $module->getCode())
+ );
+ }
}
}
diff --git a/core/lib/Thelia/Form/OrderPayment.php b/core/lib/Thelia/Form/OrderPayment.php
index 1ae4fa06c..9353eee37 100644
--- a/core/lib/Thelia/Form/OrderPayment.php
+++ b/core/lib/Thelia/Form/OrderPayment.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
@@ -85,10 +75,9 @@ class OrderPayment extends BaseForm
$context->addViolation("Payment module ID not found");
}
- $moduleReflection = new \ReflectionClass($module->getFullNamespace());
- if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) {
+ if (! $module->isPayementModule()) {
$context->addViolation(
- sprintf(Translator::getInstance()->trans("delivery module %s is not a Thelia\Module\PaymentModuleInterface"), $module->getCode())
+ sprintf(Translator::getInstance()->trans("payment module %s is not a Thelia\Module\PaymentModuleInterface"), $module->getCode())
);
}
}
diff --git a/core/lib/Thelia/Form/OrderUpdateAddress.php b/core/lib/Thelia/Form/OrderUpdateAddress.php
index 9c4bfaa37..da8cbf469 100644
--- a/core/lib/Thelia/Form/OrderUpdateAddress.php
+++ b/core/lib/Thelia/Form/OrderUpdateAddress.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/ProductCombinationGenerationForm.php b/core/lib/Thelia/Form/ProductCombinationGenerationForm.php
index 82df0e09a..b1e3404ea 100644
--- a/core/lib/Thelia/Form/ProductCombinationGenerationForm.php
+++ b/core/lib/Thelia/Form/ProductCombinationGenerationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
diff --git a/core/lib/Thelia/Form/ProductCreationForm.php b/core/lib/Thelia/Form/ProductCreationForm.php
index de683e27a..d74529509 100644
--- a/core/lib/Thelia/Form/ProductCreationForm.php
+++ b/core/lib/Thelia/Form/ProductCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
@@ -70,8 +60,12 @@ class ProductCreationForm extends BaseForm
->add("price", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Product base price excluding taxes *"),
- "label_attr" => array("for" => "price_field")
+ "label_attr" => array("for" => "price_without_tax")
))
+ ->add("tax_price", "number", array(
+ "label" => Translator::getInstance()->trans("Product base price with taxes"),
+ "label_attr" => array("for" => "price_with_tax")
+ ))
->add("currency", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Price currency *"),
@@ -83,8 +77,7 @@ class ProductCreationForm extends BaseForm
"label_attr" => array("for" => "tax_rule_field")
))
->add("weight", "number", array(
- "constraints" => array(new NotBlank()),
- "label" => Translator::getInstance()->trans("Weight *"),
+ "label" => Translator::getInstance()->trans("Weight"),
"label_attr" => array("for" => "weight_field")
))
;
diff --git a/core/lib/Thelia/Form/ProductDefaultSaleElementUpdateForm.php b/core/lib/Thelia/Form/ProductDefaultSaleElementUpdateForm.php
index 54fb2fdc1..49f3553d6 100644
--- a/core/lib/Thelia/Form/ProductDefaultSaleElementUpdateForm.php
+++ b/core/lib/Thelia/Form/ProductDefaultSaleElementUpdateForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
@@ -65,8 +55,7 @@ class ProductDefaultSaleElementUpdateForm extends ProductSaleElementUpdateForm
"label_attr" => array("for" => "tax_rule_field")
))
->add("weight", "number", array(
- "constraints" => array(new NotBlank()),
- "label" => Translator::getInstance()->trans("Weight *"),
+ "label" => Translator::getInstance()->trans("Weight"),
"label_attr" => array("for" => "weight_field")
))
->add("quantity", "number", array(
diff --git a/core/lib/Thelia/Form/ProductDocumentModification.php b/core/lib/Thelia/Form/ProductDocumentModification.php
index a9d7617e4..412beca6a 100644
--- a/core/lib/Thelia/Form/ProductDocumentModification.php
+++ b/core/lib/Thelia/Form/ProductDocumentModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Form\Image\DocumentModification;
diff --git a/core/lib/Thelia/Form/ProductImageModification.php b/core/lib/Thelia/Form/ProductImageModification.php
index 9c81ca839..decc297da 100644
--- a/core/lib/Thelia/Form/ProductImageModification.php
+++ b/core/lib/Thelia/Form/ProductImageModification.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Thelia\Form\Image\ImageModification;
diff --git a/core/lib/Thelia/Form/ProductModificationForm.php b/core/lib/Thelia/Form/ProductModificationForm.php
index d2819737c..b3b362f8a 100644
--- a/core/lib/Thelia/Form/ProductModificationForm.php
+++ b/core/lib/Thelia/Form/ProductModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
diff --git a/core/lib/Thelia/Form/ProductSaleElementUpdateForm.php b/core/lib/Thelia/Form/ProductSaleElementUpdateForm.php
index cda72cc72..1c0643c05 100644
--- a/core/lib/Thelia/Form/ProductSaleElementUpdateForm.php
+++ b/core/lib/Thelia/Form/ProductSaleElementUpdateForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
@@ -91,13 +81,10 @@ class ProductSaleElementUpdateForm extends BaseForm
))
->add('weight', 'collection', array(
'type' => 'number',
- 'label' => Translator::getInstance()->trans('Weight *'),
+ 'label' => Translator::getInstance()->trans('Weight'),
'label_attr' => array('for' => 'weight_field'),
'allow_add' => true,
- 'allow_delete' => true,
- 'options' => array(
- 'constraints' => array(new NotBlank()),
- )
+ 'allow_delete' => true
))
->add('quantity', 'collection', array(
'type' => 'number',
diff --git a/core/lib/Thelia/Form/ProfileCreationForm.php b/core/lib/Thelia/Form/ProfileCreationForm.php
index 8a70b68bd..c7faa6d2f 100644
--- a/core/lib/Thelia/Form/ProfileCreationForm.php
+++ b/core/lib/Thelia/Form/ProfileCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/ProfileModificationForm.php b/core/lib/Thelia/Form/ProfileModificationForm.php
index 9ac186283..a7e8dae39 100644
--- a/core/lib/Thelia/Form/ProfileModificationForm.php
+++ b/core/lib/Thelia/Form/ProfileModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php b/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php
index 6e1ee9c3e..08384572c 100644
--- a/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php
+++ b/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php b/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php
index 5bd8eeca4..b1c52c272 100644
--- a/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php
+++ b/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/SeoFieldsTrait.php b/core/lib/Thelia/Form/SeoFieldsTrait.php
index 95ce487fc..cb64ad6c0 100644
--- a/core/lib/Thelia/Form/SeoFieldsTrait.php
+++ b/core/lib/Thelia/Form/SeoFieldsTrait.php
@@ -1,28 +1,17 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
-use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
/**
@@ -54,13 +43,11 @@ trait SeoFieldsTrait
if (! in_array('meta_title', $exclude))
$this->formBuilder
->add('meta_title', 'text', array(
- 'constraints' => array(
- new NotBlank()
- ),
'label' => Translator::getInstance()->trans('Page Title'),
'label_attr' => array(
'for' => 'meta_title'
- )
+ ),
+ 'required' => false
)
);
diff --git a/core/lib/Thelia/Form/SeoForm.php b/core/lib/Thelia/Form/SeoForm.php
index 28c90c9ba..acdb577ef 100644
--- a/core/lib/Thelia/Form/SeoForm.php
+++ b/core/lib/Thelia/Form/SeoForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
diff --git a/core/lib/Thelia/Form/ShippingZone/ShippingZoneAddArea.php b/core/lib/Thelia/Form/ShippingZone/ShippingZoneAddArea.php
index ea31b696b..8e2433fba 100644
--- a/core/lib/Thelia/Form/ShippingZone/ShippingZoneAddArea.php
+++ b/core/lib/Thelia/Form/ShippingZone/ShippingZoneAddArea.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\ShippingZone;
@@ -65,7 +54,7 @@ class ShippingZoneAddArea extends BaseForm
new GreaterThan(array('value' => 0))
),
'label_attr' => array('for' => 'shipping_area'),
- 'label' => Translator::getInstance()->trans('Area')
+ 'label' => Translator::getInstance()->trans('Available shipping zones')
))
->add('shipping_zone_id', 'integer', array(
'constraints' => array(
diff --git a/core/lib/Thelia/Form/ShippingZone/ShippingZoneRemoveArea.php b/core/lib/Thelia/Form/ShippingZone/ShippingZoneRemoveArea.php
index dfa568334..355ac79c4 100644
--- a/core/lib/Thelia/Form/ShippingZone/ShippingZoneRemoveArea.php
+++ b/core/lib/Thelia/Form/ShippingZone/ShippingZoneRemoveArea.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form\ShippingZone;
diff --git a/core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php b/core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php
index f204e7254..e050cce1f 100644
--- a/core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php
+++ b/core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
diff --git a/core/lib/Thelia/Form/SystemLogConfigurationForm.php b/core/lib/Thelia/Form/SystemLogConfigurationForm.php
index f4eb62285..0f6a4dde3 100644
--- a/core/lib/Thelia/Form/SystemLogConfigurationForm.php
+++ b/core/lib/Thelia/Form/SystemLogConfigurationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/TaxCreationForm.php b/core/lib/Thelia/Form/TaxCreationForm.php
index 8d91bdc4a..bd58e1367 100644
--- a/core/lib/Thelia/Form/TaxCreationForm.php
+++ b/core/lib/Thelia/Form/TaxCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/TaxModificationForm.php b/core/lib/Thelia/Form/TaxModificationForm.php
index 8cfacdd0c..24ab90acb 100644
--- a/core/lib/Thelia/Form/TaxModificationForm.php
+++ b/core/lib/Thelia/Form/TaxModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/TaxRuleCreationForm.php b/core/lib/Thelia/Form/TaxRuleCreationForm.php
index a5dcc1999..29d81d3fd 100644
--- a/core/lib/Thelia/Form/TaxRuleCreationForm.php
+++ b/core/lib/Thelia/Form/TaxRuleCreationForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/TaxRuleModificationForm.php b/core/lib/Thelia/Form/TaxRuleModificationForm.php
index 0a75f810b..febc5327d 100644
--- a/core/lib/Thelia/Form/TaxRuleModificationForm.php
+++ b/core/lib/Thelia/Form/TaxRuleModificationForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/TaxRuleTaxListUpdateForm.php b/core/lib/Thelia/Form/TaxRuleTaxListUpdateForm.php
index a48dea678..b3d29f489 100644
--- a/core/lib/Thelia/Form/TaxRuleTaxListUpdateForm.php
+++ b/core/lib/Thelia/Form/TaxRuleTaxListUpdateForm.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
diff --git a/core/lib/Thelia/Form/TemplateCreationForm.php b/core/lib/Thelia/Form/TemplateCreationForm.php
index 82d3560eb..1b3ac55a5 100644
--- a/core/lib/Thelia/Form/TemplateCreationForm.php
+++ b/core/lib/Thelia/Form/TemplateCreationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Form/TemplateModificationForm.php b/core/lib/Thelia/Form/TemplateModificationForm.php
index 96e681350..af7daba1b 100644
--- a/core/lib/Thelia/Form/TemplateModificationForm.php
+++ b/core/lib/Thelia/Form/TemplateModificationForm.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
diff --git a/core/lib/Thelia/Install/BaseInstall.php b/core/lib/Thelia/Install/BaseInstall.php
index 2e602b1b6..ec8feaefa 100644
--- a/core/lib/Thelia/Install/BaseInstall.php
+++ b/core/lib/Thelia/Install/BaseInstall.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Install;
use Thelia\Install\Exception\AlreadyInstallException;
diff --git a/core/lib/Thelia/Install/CheckDatabaseConnection.php b/core/lib/Thelia/Install/CheckDatabaseConnection.php
index 4a6d4a33b..26e8450ee 100644
--- a/core/lib/Thelia/Install/CheckDatabaseConnection.php
+++ b/core/lib/Thelia/Install/CheckDatabaseConnection.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Install;
diff --git a/core/lib/Thelia/Install/CheckPermission.php b/core/lib/Thelia/Install/CheckPermission.php
index a0e1c3db8..9cc1261f2 100644
--- a/core/lib/Thelia/Install/CheckPermission.php
+++ b/core/lib/Thelia/Install/CheckPermission.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Install;
diff --git a/core/lib/Thelia/Install/Database.php b/core/lib/Thelia/Install/Database.php
index cefd3ef65..9f45e9253 100644
--- a/core/lib/Thelia/Install/Database.php
+++ b/core/lib/Thelia/Install/Database.php
@@ -1,28 +1,22 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Install;
+use Propel\Runtime\Connection\ConnectionInterface;
+use Propel\Runtime\Connection\ConnectionWrapper;
+use Propel\Runtime\Propel;
+use Propel\Runtime\ServiceContainer\ServiceContainerInterface;
+
/**
* Class Database
* @package Thelia\Install
@@ -30,10 +24,34 @@ namespace Thelia\Install;
*/
class Database
{
- public $connection;
+ /**
+ * @var \PDO
+ */
+ protected $connection;
- public function __construct(\PDO $connection)
+ /**
+ * Create a new instance, using the provided connection information, either none for
+ * automatically a connection, a ConnectionWrapper instance (through ConnectionInterface) or a PDO connection.
+ *
+ * @param ConnectionInterface|\PDO|null $connection the connection object
+ * @throws \InvalidArgumentException if $connection is not of the suitable type.
+ */
+ public function __construct($connection = null)
{
+ // Get a connection from Propel if we don't have one
+ if (null == $connection) {
+ $connection = Propel::getConnection(ServiceContainerInterface::CONNECTION_WRITE);
+ }
+
+ // Get the PDO connection from an
+ if ($connection instanceof ConnectionWrapper) {
+ $connection = $connection->getWrappedConnection();
+ }
+
+ if (!$connection instanceof \PDO) {
+ throw new \InvalidArgumentException("A PDO connection shoud be provided");
+ }
+
$this->connection = $connection;
}
@@ -55,8 +73,8 @@ class Database
if (null === $extraSqlFiles) {
$sql = array_merge(
$sql,
- $this->prepareSql(file_get_contents(THELIA_ROOT . '/install/thelia.sql')),
- $this->prepareSql(file_get_contents(THELIA_ROOT . '/install/insert.sql'))
+ $this->prepareSql(file_get_contents(THELIA_ROOT . '/setup/thelia.sql')),
+ $this->prepareSql(file_get_contents(THELIA_ROOT . '/setup/insert.sql'))
);
} else {
foreach ($extraSqlFiles as $fileToInsert) {
@@ -67,13 +85,35 @@ class Database
}
}
$size = count($sql);
- for ($i = 0; $i < $size; $i ++) {
+ for ($i = 0; $i < $size; $i++) {
if (!empty($sql[$i])) {
- $this->connection->query($sql[$i]);
+ $this->execute($sql[$i]);
}
}
}
+ /**
+ * A simple wrapper around PDO::exec
+ *
+ * @param string $sql SQL query
+ * @param array $args SQL request parameters (PDO style)
+ * @throws \RuntimeException|\PDOException if something goes wrong.
+ */
+ public function execute($sql, $args = array())
+ {
+ $stmt = $this->connection->prepare($sql);
+
+ if ($stmt === false) {
+ throw new \RuntimeException("Failed to prepare statement for $sql: " . print_r($this->connection->errorInfo(), 1));
+ }
+
+ $success = $stmt->execute($args);
+
+ if ($success === false || $stmt->errorCode() != 0) {
+ throw new \RuntimeException("Failed to execute SQL '$sql', arguments:" . print_r($args,1).", error:".print_r($stmt->errorInfo(), 1));
+ }
+ }
+
/**
* Separate each sql instruction in an array
*
@@ -88,7 +128,7 @@ class Database
$tab = explode(";\n", $sql);
$size = count($tab);
- for ($i=0; $i<$size; $i++) {
+ for ($i = 0; $i < $size; $i++) {
$queryTemp = str_replace("-CODE-", ";',", $tab[$i]);
$queryTemp = str_replace("|", ";", $queryTemp);
$query[] = $queryTemp;
@@ -104,7 +144,7 @@ class Database
*/
public function createDatabase($dbName)
{
- $this->connection->exec(
+ $this->execute(
sprintf(
"CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8",
$dbName
diff --git a/core/lib/Thelia/Install/Exception/AlreadyInstallException.php b/core/lib/Thelia/Install/Exception/AlreadyInstallException.php
index b2ff1555e..b1c6af986 100644
--- a/core/lib/Thelia/Install/Exception/AlreadyInstallException.php
+++ b/core/lib/Thelia/Install/Exception/AlreadyInstallException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Install\Exception;
diff --git a/core/lib/Thelia/Install/Exception/InstallException.php b/core/lib/Thelia/Install/Exception/InstallException.php
index 2d0f45fe4..208953242 100644
--- a/core/lib/Thelia/Install/Exception/InstallException.php
+++ b/core/lib/Thelia/Install/Exception/InstallException.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Install\Exception;
/**
diff --git a/core/lib/Thelia/Install/Exception/UpToDateException.php b/core/lib/Thelia/Install/Exception/UpToDateException.php
index e7401fe88..f28dbbf78 100644
--- a/core/lib/Thelia/Install/Exception/UpToDateException.php
+++ b/core/lib/Thelia/Install/Exception/UpToDateException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Install\Exception;
diff --git a/core/lib/Thelia/Install/Update.php b/core/lib/Thelia/Install/Update.php
index d80fe294a..4deb768d2 100644
--- a/core/lib/Thelia/Install/Update.php
+++ b/core/lib/Thelia/Install/Update.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Install;
@@ -42,6 +31,8 @@ class Update
'2' => '2.0.0-beta3',
'3' => '2.0.0-beta4',
'4' => '2.0.0-RC1',
+ '5' => '2.0.0',
+ '6' => '2.0.1',
);
protected function isLatestVersion($version)
@@ -93,9 +84,9 @@ class Update
protected function updateToVersion($version, Database $database,Tlog $logger)
{
- if (file_exists(THELIA_ROOT . '/install/update/'.$version.'.sql')) {
+ if (file_exists(THELIA_ROOT . '/setup/update/'.$version.'.sql')) {
$logger->debug(sprintf('inserting file %s', $version.'$sql'));
- $database->insertSql(null, array(THELIA_ROOT . '/install/update/'.$version.'.sql'));
+ $database->insertSql(null, array(THELIA_ROOT . '/setup/update/'.$version.'.sql'));
$logger->debug(sprintf('end inserting file %s', $version.'$sql'));
}
diff --git a/core/lib/Thelia/Log/AbstractTlogDestination.php b/core/lib/Thelia/Log/AbstractTlogDestination.php
index 6c4fd2aff..400c8b911 100644
--- a/core/lib/Thelia/Log/AbstractTlogDestination.php
+++ b/core/lib/Thelia/Log/AbstractTlogDestination.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log;
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationFile.php b/core/lib/Thelia/Log/Destination/TlogDestinationFile.php
index ff5119131..b49d36710 100644
--- a/core/lib/Thelia/Log/Destination/TlogDestinationFile.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationFile.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log\Destination;
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php b/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php
index 7d0be3fa8..0010ccc6f 100644
--- a/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log\Destination;
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php b/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php
index e1f3444a5..b781769d3 100644
--- a/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php
@@ -1,24 +1,13 @@
. */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log\Destination;
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationNull.php b/core/lib/Thelia/Log/Destination/TlogDestinationNull.php
index b78d24258..bdfa786eb 100644
--- a/core/lib/Thelia/Log/Destination/TlogDestinationNull.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationNull.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log\Destination;
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php b/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php
index 547a24c85..2aacfb0d9 100644
--- a/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php
@@ -1,24 +1,13 @@
. */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log\Destination;
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationRotatingFile.php b/core/lib/Thelia/Log/Destination/TlogDestinationRotatingFile.php
index 4e0c3e94e..30e10de3c 100644
--- a/core/lib/Thelia/Log/Destination/TlogDestinationRotatingFile.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationRotatingFile.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log\Destination;
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationText.php b/core/lib/Thelia/Log/Destination/TlogDestinationText.php
index 00dca3ddd..7df20c0b7 100644
--- a/core/lib/Thelia/Log/Destination/TlogDestinationText.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationText.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log\Destination;
diff --git a/core/lib/Thelia/Log/Tlog.php b/core/lib/Thelia/Log/Tlog.php
index 1eaf64350..1aade8a5c 100644
--- a/core/lib/Thelia/Log/Tlog.php
+++ b/core/lib/Thelia/Log/Tlog.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log;
@@ -124,6 +113,20 @@ class Tlog Implements LoggerInterface
return self::$instance;
}
+ /**
+ * Create a new Tlog instance, that could be configured without interfering with the "main" instance
+ *
+ * @return Tlog a new Tlog instance.
+ */
+ public static function getNewInstance()
+ {
+ $instance = new Tlog();
+
+ $instance->init();
+
+ return $instance;
+ }
+
/**
* initialize default configuration
*/
diff --git a/core/lib/Thelia/Log/TlogDestinationConfig.php b/core/lib/Thelia/Log/TlogDestinationConfig.php
index cbc56fd33..9a6938c50 100644
--- a/core/lib/Thelia/Log/TlogDestinationConfig.php
+++ b/core/lib/Thelia/Log/TlogDestinationConfig.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Log;
diff --git a/core/lib/Thelia/Log/TlogInterface.php b/core/lib/Thelia/Log/TlogInterface.php
deleted file mode 100644
index 8dfe9e7c1..000000000
--- a/core/lib/Thelia/Log/TlogInterface.php
+++ /dev/null
@@ -1,15 +0,0 @@
-. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Mailer;
diff --git a/core/lib/Thelia/Model/Admin.php b/core/lib/Thelia/Model/Admin.php
index 355258336..bba191cd1 100644
--- a/core/lib/Thelia/Model/Admin.php
+++ b/core/lib/Thelia/Model/Admin.php
@@ -27,6 +27,11 @@ class Admin extends BaseAdmin implements UserInterface
{
use ModelEventDispatcherTrait;
+ /**
+ * Retrieve all permissions for the current admin
+ *
+ * @return array|string
+ */
public function getPermissions()
{
$profileId = $this->getProfileId();
@@ -105,7 +110,7 @@ class Admin extends BaseAdmin implements UserInterface
*/
public function eraseCredentials()
{
- $this->setPassword(null);
+ parent::setPassword(null);
}
/**
diff --git a/core/lib/Thelia/Model/AreaDeliveryModule.php b/core/lib/Thelia/Model/AreaDeliveryModule.php
index 206625a12..39aed03e3 100644
--- a/core/lib/Thelia/Model/AreaDeliveryModule.php
+++ b/core/lib/Thelia/Model/AreaDeliveryModule.php
@@ -4,7 +4,7 @@ namespace Thelia\Model;
use Thelia\Model\Base\AreaDeliveryModule as BaseAreaDeliveryModule;
- class AreaDeliveryModule extends BaseAreaDeliveryModule
+class AreaDeliveryModule extends BaseAreaDeliveryModule
{
}
diff --git a/core/lib/Thelia/Model/AreaDeliveryModuleQuery.php b/core/lib/Thelia/Model/AreaDeliveryModuleQuery.php
index 416daa8c9..dfb58e863 100644
--- a/core/lib/Thelia/Model/AreaDeliveryModuleQuery.php
+++ b/core/lib/Thelia/Model/AreaDeliveryModuleQuery.php
@@ -17,4 +17,19 @@ use Thelia\Model\Base\AreaDeliveryModuleQuery as BaseAreaDeliveryModuleQuery;
class AreaDeliveryModuleQuery extends BaseAreaDeliveryModuleQuery
{
+
+ public function findByCountryAndModule(Country $country, Module $module)
+ {
+ $response = null;
+
+ if (null !== $country->getAreaId()) {
+ $response = $this->filterByAreaId($country->getAreaId())
+ ->filterByModule($module)
+ ->findOne();
+
+ }
+
+ return $response;
+ }
+
} // AreaDeliveryModuleQuery
diff --git a/core/lib/Thelia/Model/Cart.php b/core/lib/Thelia/Model/Cart.php
index 7cf66eeb3..aab17db46 100644
--- a/core/lib/Thelia/Model/Cart.php
+++ b/core/lib/Thelia/Model/Cart.php
@@ -4,11 +4,21 @@ namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\Criteria;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Thelia\Core\Event\Cart\CartItemDuplicationItem;
+use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Base\Cart as BaseCart;
class Cart extends BaseCart
{
- public function duplicate($token, Customer $customer = null)
+ /**
+ * Duplicate the current existing cart. Only the token is changed
+ *
+ * @param $token
+ * @param Customer $customer
+ * @return Cart
+ */
+ public function duplicate($token, Customer $customer = null, Currency $currency = null, EventDispatcherInterface $dispatcher)
{
$cartItems = $this->getCartItems();
@@ -16,11 +26,21 @@ class Cart extends BaseCart
$cart->setAddressDeliveryId($this->getAddressDeliveryId());
$cart->setAddressInvoiceId($this->getAddressInvoiceId());
$cart->setToken($token);
- // TODO : set current Currency
- $cart->setCurrencyId($this->getCurrencyId());
+ $discount = 0;
+
+ if (null === $currency) {
+ $currencyQuery = CurrencyQuery::create();
+ $currency = $currencyQuery->findPk($this->getCurrencyId()) ?: $currencyQuery->findOneByByDefault(1);
+ }
+
+ $cart->setCurrency($currency);
if ($customer) {
$cart->setCustomer($customer);
+
+ if ($customer->getDiscount() > 0) {
+ $discount = $customer->getDiscount();
+ }
}
$cart->save();
@@ -40,28 +60,27 @@ class Cart extends BaseCart
$item->setProductId($cartItem->getProductId());
$item->setQuantity($cartItem->getQuantity());
$item->setProductSaleElements($productSaleElements);
- if ($currentDateTime <= $cartItem->getPriceEndOfLife()) {
- $item->setPrice($cartItem->getPrice())
- ->setPromoPrice($cartItem->getPromoPrice())
- ->setPromo($productSaleElements->getPromo())
- // TODO : new price EOF or duplicate current priceEOF from $cartItem ?
- ->setPriceEndOfLife($cartItem->getPriceEndOfLife());
- } else {
- $productPrices = ProductPriceQuery::create()->filterByProductSaleElements($productSaleElements)->findOne();
+ $prices = $productSaleElements->getPricesByCurrency($currency, $discount);
+ $item
+ ->setPrice($prices->getPrice())
+ ->setPromoPrice($prices->getPromoPrice())
+ ->setPromo($productSaleElements->getPromo());
- $item->setPrice($productPrices->getPrice())
- ->setPromoPrice($productPrices->getPromoPrice())
- ->setPromo($productSaleElements->getPromo())
- ->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30));
- }
$item->save();
+ $dispatcher->dispatch(TheliaEvents::CART_ITEM_DUPLICATE, new CartItemDuplicationItem($item, $cartItem));
}
}
+ $this->delete();
return $cart;
}
+ /**
+ * Retrieve the last item added in the cart
+ *
+ * @return CartItem
+ */
public function getLastCartItemAdded()
{
return CartItemQuery::create()
@@ -71,6 +90,18 @@ class Cart extends BaseCart
;
}
+ /**
+ *
+ * Retrieve the total taxed amount.
+ *
+ * By default, the total include the discount
+ *
+ * /!\ The postage amount is not available so it's the total with or without discount an without postage
+ *
+ * @param Country $country
+ * @param bool $discount
+ * @return float|int
+ */
public function getTaxedAmount(Country $country, $discount = true)
{
$total = 0;
@@ -86,7 +117,13 @@ class Cart extends BaseCart
return $total;
}
- public function getTotalAmount()
+ /**
+ *
+ * @see getTaxedAmount same as this method but the amount is without taxes
+ * @param bool $discount
+ * @return float|int
+ */
+ public function getTotalAmount($discount = true)
{
$total = 0;
@@ -97,11 +134,18 @@ class Cart extends BaseCart
$total += $subtotal;
}
- $total -= $this->getDiscount();
+ if ($discount) {
+ $total -= $this->getDiscount();
+ }
return $total;
}
+ /**
+ * Retrieve the total weight for all products in cart
+ *
+ * @return float|int
+ */
public function getWeight()
{
$weight = 0;
diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php
index 82f029e61..c5ab471a5 100644
--- a/core/lib/Thelia/Model/Category.php
+++ b/core/lib/Thelia/Model/Category.php
@@ -36,6 +36,8 @@ class Category extends BaseCategory
*
* count all products for current category and sub categories
*
+ * /!\ the number of queries is exponential, use it with caution
+ *
* @return int
*/
public function countAllProducts()
diff --git a/core/lib/Thelia/Model/CategoryImageI18n.php b/core/lib/Thelia/Model/CategoryImageI18n.php
index 5cfb7577b..3d001c6ad 100644
--- a/core/lib/Thelia/Model/CategoryImageI18n.php
+++ b/core/lib/Thelia/Model/CategoryImageI18n.php
@@ -4,7 +4,7 @@ namespace Thelia\Model;
use Thelia\Model\Base\CategoryImageI18n as BaseCategoryImageI18n;
- class CategoryImageI18n extends BaseCategoryImageI18n
+class CategoryImageI18n extends BaseCategoryImageI18n
{
}
diff --git a/core/lib/Thelia/Model/ConfigQuery.php b/core/lib/Thelia/Model/ConfigQuery.php
index 77653ade1..31c56e229 100644
--- a/core/lib/Thelia/Model/ConfigQuery.php
+++ b/core/lib/Thelia/Model/ConfigQuery.php
@@ -18,6 +18,16 @@ class ConfigQuery extends BaseConfigQuery
{
protected static $cache = array();
+ /**
+ *
+ * Find a config variable and return the value or default value if not founded.
+ *
+ * Use this method for better performance, a cache is created for each variable already searched
+ *
+ * @param $search
+ * @param null $default
+ * @return mixed
+ */
public static function read($search, $default = null)
{
if (array_key_exists($search, self::$cache)) {
@@ -125,12 +135,12 @@ class ConfigQuery extends BaseConfigQuery
public static function getSmtpPassword()
{
- return self::read('smtp.authmode');
+ return self::read('smtp.password');
}
public static function getSmtpAuthMode()
{
- return self::read('smtp.host');
+ return self::read('smtp.authmode');
}
public static function getSmtpTimeout()
diff --git a/core/lib/Thelia/Model/Content.php b/core/lib/Thelia/Model/Content.php
index 983580540..d40ba286a 100644
--- a/core/lib/Thelia/Model/Content.php
+++ b/core/lib/Thelia/Model/Content.php
@@ -2,6 +2,7 @@
namespace Thelia\Model;
+use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Propel;
use Thelia\Core\Event\Content\ContentEvent;
use Thelia\Core\Event\TheliaEvents;
@@ -32,8 +33,14 @@ class Content extends BaseContent
*/
protected function addCriteriaToPositionQuery($query)
{
- // TODO: Find the default folder for this content,
- // and generate the position relative to this folder
+ $contents = ContentFolderQuery::create()
+ ->filterByFolderId($this->getDefaultFolderId())
+ ->filterByDefaultFolder(true)
+ ->select('content_id')
+ ->find();
+
+ // Filtrer la requete sur ces produits
+ if ($contents != null) $query->filterById($contents, Criteria::IN);
}
public function getDefaultFolderId()
diff --git a/core/lib/Thelia/Model/Country.php b/core/lib/Thelia/Model/Country.php
index 1e7748f75..038bd5a61 100644
--- a/core/lib/Thelia/Model/Country.php
+++ b/core/lib/Thelia/Model/Country.php
@@ -16,6 +16,14 @@ class Country extends BaseCountry
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
+ /**
+ *
+ * Put the current country as the default one.
+ *
+ * @throws \RuntimeException
+ * @throws \Exception
+ * @throws \Propel\Runtime\Exception\PropelException
+ */
public function toggleDefault()
{
if ($this->getId() === null) {
diff --git a/core/lib/Thelia/Model/Coupon.php b/core/lib/Thelia/Model/Coupon.php
index b0d860ba4..cced6beb7 100644
--- a/core/lib/Thelia/Model/Coupon.php
+++ b/core/lib/Thelia/Model/Coupon.php
@@ -1,223 +1,203 @@
-. */
-/* */
-/**********************************************************************************/
-
-namespace Thelia\Model;
-
-use Propel\Runtime\Propel;
-use Thelia\Model\Base\Coupon as BaseCoupon;
-use Thelia\Model\Exception\InvalidArgumentException;
-use Thelia\Model\Map\CouponTableMap;
-
-/**
- * Used to provide an effect (mostly a discount)
- * at the end of the Customer checkout tunnel
- * It will be usable for a Customer only if it matches the Coupon criteria (Rules)
- *
- * @package Coupon
- * @author Guillaume MOREL
- *
- */
-class Coupon extends BaseCoupon
-{
-
- use \Thelia\Model\Tools\ModelEventDispatcherTrait;
-
- /**
- * Create or Update this Coupon
- *
- * @param string $code Coupon Code
- * @param string $title Coupon title
- * @param array $effects Ready to be serialized in JSON effect params
- * @param string $type Coupon type
- * @param bool $isRemovingPostage Is removing Postage
- * @param string $shortDescription Coupon short description
- * @param string $description Coupon description
- * @param boolean $isEnabled Enable/Disable
- * @param \DateTime $expirationDate Coupon expiration date
- * @param boolean $isAvailableOnSpecialOffers Is available on special offers
- * @param boolean $isCumulative Is cumulative
- * @param int $maxUsage Coupon quantity
- * @param string $defaultSerializedRule Serialized default rule added if none found
- * @param string $locale Coupon Language code ISO (ex: fr_FR)
- *
- * @throws \Exception
- */
- public function createOrUpdate($code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule, $locale = null)
- {
- $this->setCode($code)
- ->setType($type)
- ->setEffects($effects)
- ->setIsRemovingPostage($isRemovingPostage)
- ->setIsEnabled($isEnabled)
- ->setExpirationDate($expirationDate)
- ->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
- ->setIsCumulative($isCumulative)
- ->setMaxUsage($maxUsage);
- $this->setTitle($title)
- ->setShortDescription($shortDescription)
- ->setDescription($description);
-
- // If no rule given, set default rule
- if (null === $this->getSerializedConditions()) {
- $this->setSerializedConditions($defaultSerializedRule);
- }
-
- // Set object language (i18n)
- if (!is_null($locale)) {
- $this->setLocale($locale);
- }
-
- $con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME);
- $con->beginTransaction();
- try {
- $this->save($con);
- $con->commit();
-
- } catch (\Exception $e) {
- $con->rollback();
- throw $e;
- }
- }
-
- /**
- * Create or Update this coupon condition
- *
- * @param string $serializableConditions Serialized conditions ready to be saved
- * @param string $locale Coupon Language code ISO (ex: fr_FR)
- *
- * @throws \Exception
- */
- public function createOrUpdateConditions($serializableConditions, $locale)
- {
- $this->setSerializedConditions($serializableConditions);
-
- // Set object language (i18n)
- if (!is_null($locale)) {
- $this->setLocale($locale);
- }
-
- $con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME);
- $con->beginTransaction();
- try {
- $this->save($con);
- $con->commit();
- } catch (\Exception $e) {
- $con->rollback();
- throw $e;
- }
- }
-
- /**
- * Set Coupon amount
- *
- * @param float $amount Amount deduced from the Cart
- *
- * @return $this
- */
- public function setAmount($amount)
- {
- $effects = $this->unserializeEffects($this->getSerializedEffects());
- $effects['amount'] = floatval($amount);
- $this->setEffects($effects);
-
- return $this;
- }
-
- /**
- * Get the amount removed from the coupon to the cart
- *
- * @return float
- */
- public function getAmount()
- {
- $amount = $this->getEffects()['amount'];
-
- return floatval($amount);
- }
-
- /**
- * Get the Coupon effects
- *
- * @return array
- * @throws Exception\InvalidArgumentException
- */
- public function getEffects()
- {
- $effects = $this->unserializeEffects($this->getSerializedEffects());
-
- if (null === $effects['amount']) {
- throw new InvalidArgumentException('Missing key \'amount\' in Coupon effect coming from database');
- }
-
- return $effects;
- }
-
- /**
- * Get the Coupon effects
- *
- * @param array $effects Effect ready to be serialized
- * Needs at least the key 'amount'
- * with the amount removed from the cart
- *
- * @throws Exception\InvalidArgumentException
- * @return $this
- */
- public function setEffects(array $effects)
- {
- if (null === $effects['amount']) {
- throw new InvalidArgumentException('Missing key \'amount\' in Coupon effect ready to be serialized array');
- }
-
- $this->setSerializedEffects($this->serializeEffects($effects));
-
- return $this;
- }
-
- /**
- * Return unserialized effects
- *
- * @param string $serializedEffects Serialized effect string to unserialize
- *
- * @return array
- */
- public function unserializeEffects($serializedEffects)
- {
- $effects = json_decode($serializedEffects, true);
-
- return $effects;
- }
-
- /**
- * Return serialized effects
- *
- * @param array $unserializedEffects Unserialized array string to serialize
- *
- * @return string
- */
- public function serializeEffects(array $unserializedEffects)
- {
- $effects = json_encode($unserializedEffects);
-
- return $effects;
- }
-}
+. */
+/* */
+/**********************************************************************************/
+
+namespace Thelia\Model;
+
+use Propel\Runtime\Propel;
+use Thelia\Model\Base\Coupon as BaseCoupon;
+use Thelia\Model\Exception\InvalidArgumentException;
+use Thelia\Model\Map\CouponTableMap;
+
+/**
+ * Used to provide an effect (mostly a discount)
+ * at the end of the Customer checkout tunnel
+ * It will be usable for a Customer only if it matches the Coupon criteria (Rules)
+ *
+ * @package Coupon
+ * @author Guillaume MOREL
+ *
+ */
+class Coupon extends BaseCoupon
+{
+
+ use \Thelia\Model\Tools\ModelEventDispatcherTrait;
+
+ /**
+ * Create or Update this Coupon
+ *
+ * @param string $code Coupon Code
+ * @param string $title Coupon title
+ * @param array $effects Ready to be serialized in JSON effect params
+ * @param string $type Coupon type
+ * @param bool $isRemovingPostage Is removing Postage
+ * @param string $shortDescription Coupon short description
+ * @param string $description Coupon description
+ * @param boolean $isEnabled Enable/Disable
+ * @param \DateTime $expirationDate Coupon expiration date
+ * @param boolean $isAvailableOnSpecialOffers Is available on special offers
+ * @param boolean $isCumulative Is cumulative
+ * @param int $maxUsage Coupon quantity
+ * @param string $defaultSerializedRule Serialized default rule added if none found
+ * @param string $locale Coupon Language code ISO (ex: fr_FR)
+ *
+ * @throws \Exception
+ */
+ public function createOrUpdate($code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule, $locale = null)
+ {
+ $this
+ ->setCode($code)
+ ->setType($type)
+ ->setEffects($effects)
+ ->setIsRemovingPostage($isRemovingPostage)
+ ->setIsEnabled($isEnabled)
+ ->setExpirationDate($expirationDate)
+ ->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
+ ->setIsCumulative($isCumulative)
+ ->setMaxUsage($maxUsage)
+ ->setLocale($locale)
+ ->setTitle($title)
+ ->setShortDescription($shortDescription)
+ ->setDescription($description);
+
+ // If no rule given, set default rule
+ if (null === $this->getSerializedConditions()) {
+ $this->setSerializedConditions($defaultSerializedRule);
+ }
+
+ $this->save();
+ }
+
+ /**
+ * Create or Update this coupon condition
+ *
+ * @param string $serializableConditions Serialized conditions ready to be saved
+ * @param string $locale Coupon Language code ISO (ex: fr_FR)
+ *
+ * @throws \Exception
+ */
+ public function createOrUpdateConditions($serializableConditions, $locale)
+ {
+ $this->setSerializedConditions($serializableConditions);
+
+ // Set object language (i18n)
+ if (!is_null($locale)) {
+ $this->setLocale($locale);
+ }
+
+ $this->save();
+ }
+
+ /**
+ * Set Coupon amount
+ *
+ * @param float $amount Amount deduced from the Cart
+ *
+ * @return $this
+ */
+ public function setAmount($amount)
+ {
+ $effects = $this->unserializeEffects($this->getSerializedEffects());
+ $effects['amount'] = floatval($amount);
+ $this->setEffects($effects);
+
+ return $this;
+ }
+
+ /**
+ * Get the amount removed from the coupon to the cart
+ *
+ * @return float
+ */
+ public function getAmount()
+ {
+ $amount = $this->getEffects()['amount'];
+
+ return floatval($amount);
+ }
+
+ /**
+ * Get the Coupon effects
+ *
+ * @return array
+ * @throws Exception\InvalidArgumentException
+ */
+ public function getEffects()
+ {
+ $effects = $this->unserializeEffects($this->getSerializedEffects());
+
+ if (null === $effects['amount']) {
+ throw new InvalidArgumentException('Missing key \'amount\' in Coupon effect coming from database');
+ }
+
+ return $effects;
+ }
+
+ /**
+ * Get the Coupon effects
+ *
+ * @param array $effects Effect ready to be serialized
+ * Needs at least the key 'amount'
+ * with the amount removed from the cart
+ *
+ * @throws Exception\InvalidArgumentException
+ * @return $this
+ */
+ public function setEffects(array $effects)
+ {
+ if (null === $effects['amount']) {
+ throw new InvalidArgumentException('Missing key \'amount\' in Coupon effect ready to be serialized array');
+ }
+
+ $this->setSerializedEffects($this->serializeEffects($effects));
+
+ return $this;
+ }
+
+ /**
+ * Return unserialized effects
+ *
+ * @param string $serializedEffects Serialized effect string to unserialize
+ *
+ * @return array
+ */
+ public function unserializeEffects($serializedEffects)
+ {
+ $effects = json_decode($serializedEffects, true);
+
+ return $effects;
+ }
+
+ /**
+ * Return serialized effects
+ *
+ * @param array $unserializedEffects Unserialized array string to serialize
+ *
+ * @return string
+ */
+ public function serializeEffects(array $unserializedEffects)
+ {
+ $effects = json_encode($unserializedEffects);
+
+ return $effects;
+ }
+}
diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php
index 4d4b3ebfa..c44fc0e61 100644
--- a/core/lib/Thelia/Model/Customer.php
+++ b/core/lib/Thelia/Model/Customer.php
@@ -129,7 +129,7 @@ class Customer extends BaseCustomer implements UserInterface
protected function generateRef()
{
- return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true);
+ return sprintf('CUS%s', str_pad($this->getId(), 12, 0, STR_PAD_LEFT));
}
/**
@@ -143,6 +143,15 @@ class Customer extends BaseCustomer implements UserInterface
->findOne();
}
+ public function setRef($v)
+ {
+ if (null !== $v) {
+ parent::setRef($v);
+ }
+
+ return $this;
+ }
+
/**
* create hash for plain password and set it in Customer object
*
@@ -164,7 +173,7 @@ class Customer extends BaseCustomer implements UserInterface
return $this;
}
-
+/*
public function setRef($ref)
{
if (null === $ref && null === $this->ref) {
@@ -174,7 +183,7 @@ class Customer extends BaseCustomer implements UserInterface
}
return $this;
- }
+ }*/
public function setEmail($email, $force = false)
{
@@ -212,7 +221,8 @@ class Customer extends BaseCustomer implements UserInterface
*/
public function eraseCredentials()
{
- $this->setPassword(null);
+ parent::setPassword(null);
+ $this->resetModified();
}
/**
@@ -272,10 +282,6 @@ class Customer extends BaseCustomer implements UserInterface
// Set the serial number (for auto-login)
$this->setRememberMeSerial(uniqid());
- if (null === $this->ref) {
- $this->setRef($this->generateRef());
- }
-
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, new CustomerEvent($this));
return true;
@@ -286,6 +292,11 @@ class Customer extends BaseCustomer implements UserInterface
*/
public function postInsert(ConnectionInterface $con = null)
{
+ if (null === $this->getRef()) {
+ $this->setRef($this->generateRef())
+ ->save($con);
+ }
+
$this->dispatchEvent(TheliaEvents::AFTER_CREATECUSTOMER, new CustomerEvent($this));
}
diff --git a/core/lib/Thelia/Model/Exception/InvalidArgumentException.php b/core/lib/Thelia/Model/Exception/InvalidArgumentException.php
index ab8ca49c9..f6caf1761 100644
--- a/core/lib/Thelia/Model/Exception/InvalidArgumentException.php
+++ b/core/lib/Thelia/Model/Exception/InvalidArgumentException.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Model\Exception;
diff --git a/core/lib/Thelia/Model/Exception/ModelException.php b/core/lib/Thelia/Model/Exception/ModelException.php
index 505a3068c..c315bf682 100644
--- a/core/lib/Thelia/Model/Exception/ModelException.php
+++ b/core/lib/Thelia/Model/Exception/ModelException.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Model\Exception;
class ModelException extends \RuntimeException
diff --git a/core/lib/Thelia/Model/Lang.php b/core/lib/Thelia/Model/Lang.php
index a6a138a65..a0baa80c2 100644
--- a/core/lib/Thelia/Model/Lang.php
+++ b/core/lib/Thelia/Model/Lang.php
@@ -122,4 +122,10 @@ class Lang extends BaseLang
$this->dispatchEvent(TheliaEvents::AFTER_DELETELANG, new LangEvent($this));
}
+ public function preSave(ConnectionInterface $con = null)
+ {
+ $this->setDatetimeFormat(sprintf("%s %s", $this->getDateFormat(), $this->getTimeFormat()));
+
+ return true;
+ }
}
diff --git a/core/lib/Thelia/Model/Map/CustomerTableMap.php b/core/lib/Thelia/Model/Map/CustomerTableMap.php
index 14e14e330..795a4af03 100644
--- a/core/lib/Thelia/Model/Map/CustomerTableMap.php
+++ b/core/lib/Thelia/Model/Map/CustomerTableMap.php
@@ -202,7 +202,7 @@ class CustomerTableMap extends TableMap
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
- $this->addColumn('REF', 'Ref', 'VARCHAR', true, 50, null);
+ $this->addColumn('REF', 'Ref', 'VARCHAR', false, 50, null);
$this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
diff --git a/core/lib/Thelia/Model/Map/OrderTableMap.php b/core/lib/Thelia/Model/Map/OrderTableMap.php
index 28613da80..2246af89c 100644
--- a/core/lib/Thelia/Model/Map/OrderTableMap.php
+++ b/core/lib/Thelia/Model/Map/OrderTableMap.php
@@ -217,7 +217,7 @@ class OrderTableMap extends TableMap
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
- $this->addColumn('REF', 'Ref', 'VARCHAR', true, 45, null);
+ $this->addColumn('REF', 'Ref', 'VARCHAR', false, 45, null);
$this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null);
$this->addForeignKey('INVOICE_ORDER_ADDRESS_ID', 'InvoiceOrderAddressId', 'INTEGER', 'order_address', 'ID', true, null, null);
$this->addForeignKey('DELIVERY_ORDER_ADDRESS_ID', 'DeliveryOrderAddressId', 'INTEGER', 'order_address', 'ID', true, null, null);
diff --git a/core/lib/Thelia/Model/Message.php b/core/lib/Thelia/Model/Message.php
index 168136f3c..b96887d07 100644
--- a/core/lib/Thelia/Model/Message.php
+++ b/core/lib/Thelia/Model/Message.php
@@ -2,6 +2,7 @@
namespace Thelia\Model;
+use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Model\Base\Message as BaseMessage;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Event\TheliaEvents;
@@ -74,13 +75,13 @@ class Message extends BaseMessage
{
$body = false;
- $mail_template_path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath() . DS;
+ //$mail_template_path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath() . DS;
// Try to get the body from template file, if a file is defined
if (! empty($template)) {
try {
- $body = $parser->render($mail_template_path . $template);
+ $body = $parser->render($template);
} catch (ResourceNotFoundException $ex) {
// Ignore this.
}
@@ -98,7 +99,7 @@ class Message extends BaseMessage
$parser->assign('message_body', $body);
// Render the layout file
- $body = $parser->render($mail_template_path . $layout);
+ $body = $parser->render($layout);
}
return $body;
@@ -136,6 +137,7 @@ class Message extends BaseMessage
*/
public function buildMessage($parser, \Swift_Message $messageInstance)
{
+ $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveMailTemplate());
$subject = $parser->fetch(sprintf("string:%s", $this->getSubject()));
$htmlMessage = $this->getHtmlMessageBody($parser);
$textMessage = $this->getTextMessageBody($parser);
diff --git a/core/lib/Thelia/Model/Module.php b/core/lib/Thelia/Model/Module.php
index 65ea065d9..c5b7257c3 100644
--- a/core/lib/Thelia/Model/Module.php
+++ b/core/lib/Thelia/Model/Module.php
@@ -3,20 +3,80 @@
namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
+use Thelia\Core\Template\TemplateDefinition;
use Thelia\Model\Base\Module as BaseModule;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
+use Thelia\Model\Tools\PositionManagementTrait;
class Module extends BaseModule
{
use ModelEventDispatcherTrait;
- use \Thelia\Model\Tools\PositionManagementTrait;
+ use PositionManagementTrait;
+
+ const ADMIN_INCLUDES_DIRECTORY_NAME = "AdminIncludes";
public function postSave(ConnectionInterface $con = null)
{
ModuleQuery::resetActivated();
}
+ public function getTranslationDomain()
+ {
+ return strtolower($this->getCode());
+ }
+
+ public function getAdminIncludesTranslationDomain()
+ {
+ return $this->getTranslationDomain().'.ai';
+ }
+
+ public function getAbsoluteBackOfficeTemplatePath($subdir)
+ {
+ return sprintf("%s".DS."%s".DS."%s",
+ $this->getAbsoluteTemplateBasePath(),
+ TemplateDefinition::BACK_OFFICE_SUBDIR,
+ $subdir
+ );
+ }
+
+ public function getAbsoluteBackOfficeI18nTemplatePath($subdir)
+ {
+ return sprintf("%s".DS."%s".DS."%s",
+ $this->getAbsoluteI18nPath(),
+ TemplateDefinition::BACK_OFFICE_SUBDIR,
+ $subdir
+ );
+ }
+
+ public function getBackOfficeTemplateTranslationDomain($templateName)
+ {
+ return $this->getTranslationDomain(). '.bo.' . $templateName;
+ }
+
+ public function getAbsoluteFrontOfficeTemplatePath($subdir)
+ {
+ return sprintf("%s".DS."%s".DS."%s",
+ $this->getAbsoluteTemplateBasePath(),
+ TemplateDefinition::FRONT_OFFICE_SUBDIR,
+ $subdir
+ );
+ }
+
+ public function getAbsoluteFrontOfficeI18nTemplatePath($subdir)
+ {
+ return sprintf("%s".DS."%s".DS."%s",
+ $this->getAbsoluteI18nPath(),
+ TemplateDefinition::FRONT_OFFICE_SUBDIR,
+ $subdir
+ );
+ }
+
+ public function getFrontOfficeTemplateTranslationDomain($templateName)
+ {
+ return $this->getTranslationDomain(). '.fo.' . $templateName;
+ }
+
/**
* @return the module's base directory path, relative to THELIA_MODULE_DIR
*/
@@ -65,14 +125,71 @@ class Module extends BaseModule
return THELIA_MODULE_DIR . $this->getI18nPath();
}
+ /**
+ * @return the module's AdminIncludes absolute directory path
+ */
+ public function getAbsoluteAdminIncludesPath()
+ {
+ return $this->getAbsoluteBaseDir() . DS . self::ADMIN_INCLUDES_DIRECTORY_NAME;
+ }
+
+ /**
+ * @return the module's AdminIncludes i18N absolute directory path
+ */
+ public function getAbsoluteAdminIncludesI18nPath()
+ {
+ return THELIA_MODULE_DIR . $this->getI18nPath() . DS . self::ADMIN_INCLUDES_DIRECTORY_NAME;
+ }
+
+ /**
+ * Return the absolute path to the module's template directory
+ *
+ * @return string a path
+ */
+ public function getAbsoluteTemplateBasePath()
+ {
+ return $this->getAbsoluteBaseDir() . DS . 'templates';
+ }
+
/**
* Return the absolute path to one of the module's template directories
*
- * @param int $templateSubdirName the name of the, probably one of TemplateDefinition::xxx_SUBDIR constants
+ * @param int $templateSubdirName the name of the, probably one of TemplateDefinition::xxx_SUBDIR constants
+ * @return string a path
*/
public function getAbsoluteTemplateDirectoryPath($templateSubdirName)
{
- return sprintf("%s%stemplates%s%s", $this->getAbsoluteBaseDir(), DS, DS, $templateSubdirName);
+ return $this->getAbsoluteTemplateBasePath() .DS. $templateSubdirName;
+ }
+
+ /**
+ * @return true if this module is a delivery module
+ */
+ public function isDeliveryModule()
+ {
+ $moduleReflection = new \ReflectionClass($this->getFullNamespace());
+
+ return $moduleReflection->implementsInterface("Thelia\Module\DeliveryModuleInterface");
+ }
+
+ /**
+ * @return true if this module is a payment module
+ */
+ public function isPayementModule()
+ {
+ $moduleReflection = new \ReflectionClass($this->getFullNamespace());
+
+ return $moduleReflection->implementsInterface("Thelia\Module\PaymentModuleInterface");
+ }
+
+ /**
+ * @return BaseModule a new module instance.
+ */
+ public function createInstance()
+ {
+ $moduleClass = new \ReflectionClass($this->getFullNamespace());
+
+ return $moduleClass->newInstance();
}
/**
diff --git a/core/lib/Thelia/Model/ModuleQuery.php b/core/lib/Thelia/Model/ModuleQuery.php
index dfe9b1b3c..c1f9394dd 100644
--- a/core/lib/Thelia/Model/ModuleQuery.php
+++ b/core/lib/Thelia/Model/ModuleQuery.php
@@ -25,6 +25,7 @@ class ModuleQuery extends BaseModuleQuery
if (null === self::$activated) {
self::$activated = self::create()
->filterByActivate(1)
+ ->orderByPosition()
->find();
}
diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php
index f4b1b5abc..f19f29e03 100644
--- a/core/lib/Thelia/Model/Order.php
+++ b/core/lib/Thelia/Model/Order.php
@@ -23,8 +23,6 @@ class Order extends BaseOrder
*/
public function preInsert(ConnectionInterface $con = null)
{
- $this->setRef($this->generateRef());
-
$this->dispatchEvent(TheliaEvents::ORDER_BEFORE_CREATE, new OrderEvent($this));
return true;
@@ -35,22 +33,34 @@ class Order extends BaseOrder
*/
public function postInsert(ConnectionInterface $con = null)
{
+ $this->setRef($this->generateRef())
+ ->save($con);
$this->dispatchEvent(TheliaEvents::ORDER_AFTER_CREATE, new OrderEvent($this));
}
+ public function postSave(ConnectionInterface $con = null)
+ {
+ if ($this->isPaid() && null === $this->getInvoiceDate()) {
+ $this
+ ->setInvoiceDate(time())
+ ->save($con);
+ }
+ }
+
public function generateRef()
{
- /* order addresses are unique */
-
- return uniqid('ORD', true);
+ return sprintf('ORD%s', str_pad($this->getId(), 12, 0, STR_PAD_LEFT));
}
/**
* Compute this order amount.
*
- * @param float $tax (output only) returns the tax amount for this order
- * @param bool $includePostage if true, the postage cost is included to the total
- * @param bool $includeDiscount if true, the discount will be included to the total
+ * The order amount amount is only avaible once the order is persisted in database.
+ * Duting invoice process, use all cart methods instead of order methods (the order doest not exists at this moment)
+ *
+ * @param float|int $tax (output only) returns the tax amount for this order
+ * @param bool $includePostage if true, the postage cost is included to the total
+ * @param bool $includeDiscount if true, the discount will be included to the total
* @return float
*/
public function getTotalAmount(&$tax = 0, $includePostage = true, $includeDiscount = true)
diff --git a/core/lib/Thelia/Model/OrderProduct.php b/core/lib/Thelia/Model/OrderProduct.php
index b73ef9852..5f87cbc97 100644
--- a/core/lib/Thelia/Model/OrderProduct.php
+++ b/core/lib/Thelia/Model/OrderProduct.php
@@ -11,12 +11,32 @@ class OrderProduct extends BaseOrderProduct
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
+ protected $cartIemId;
+
+ /**
+ * @param mixed $cartIemId
+ */
+ public function setCartIemId($cartIemId)
+ {
+ $this->cartIemId = $cartIemId;
+
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getCartIemId()
+ {
+ return $this->cartIemId;
+ }
+
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
- $this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_BEFORE_CREATE, new OrderEvent($this->getOrder()));
+ $this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_BEFORE_CREATE, (new OrderEvent($this->getOrder()))->setCartItemId($this->cartIemId));
return true;
}
@@ -26,6 +46,6 @@ class OrderProduct extends BaseOrderProduct
*/
public function postInsert(ConnectionInterface $con = null)
{
- $this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_AFTER_CREATE, new OrderEvent($this->getOrder()));
+ $this->dispatchEvent(TheliaEvents::ORDER_PRODUCT_AFTER_CREATE, (new OrderEvent($this->getOrder()))->setCartItemId($this->cartIemId));
}
}
diff --git a/core/lib/Thelia/Model/OrderQuery.php b/core/lib/Thelia/Model/OrderQuery.php
index d9b4ad8b4..459314b87 100644
--- a/core/lib/Thelia/Model/OrderQuery.php
+++ b/core/lib/Thelia/Model/OrderQuery.php
@@ -103,7 +103,7 @@ class OrderQuery extends BaseOrderQuery
$query = self::create('o')
->filterByCreatedAt(sprintf("%s 00:00:00", $startDate->format('Y-m-d')), Criteria::GREATER_EQUAL)
->filterByCreatedAt(sprintf("%s 23:59:59", $endDate->format('Y-m-d')), Criteria::LESS_EQUAL)
- ->filterByStatusId("2,3,4", Criteria::IN)
+ ->filterByStatusId([2,3,4], Criteria::IN)
->innerJoinOrderProduct()
->addJoinObject($orderTaxJoin)
diff --git a/core/lib/Thelia/Model/OrderStatusQuery.php b/core/lib/Thelia/Model/OrderStatusQuery.php
index c4ce4e325..46c6128e5 100644
--- a/core/lib/Thelia/Model/OrderStatusQuery.php
+++ b/core/lib/Thelia/Model/OrderStatusQuery.php
@@ -16,4 +16,30 @@ use Thelia\Model\Base\OrderStatusQuery as BaseOrderStatusQuery;
*/
class OrderStatusQuery extends BaseOrderStatusQuery
{
+
+ public static function getNotPaidStatus()
+ {
+ return OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_NOT_PAID);
+ }
+
+ public static function getPaidStatus()
+ {
+ return OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_PAID);
+ }
+
+ public static function getProcessingStatus()
+ {
+ return OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_PROCESSING);
+ }
+
+ public static function getSentStatus()
+ {
+ return OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_SENT);
+ }
+
+ public static function getCancelledStatus()
+ {
+ return OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_CANCELED);
+ }
+
} // OrderStatusQuery
diff --git a/core/lib/Thelia/Model/Product.php b/core/lib/Thelia/Model/Product.php
index a8d342f0e..2eb3fb584 100644
--- a/core/lib/Thelia/Model/Product.php
+++ b/core/lib/Thelia/Model/Product.php
@@ -214,6 +214,7 @@ class Product extends BaseProduct
->setPromoPrice($salePrice)
->setPrice($basePrice)
->setCurrencyId($currencyId)
+ ->setFromDefaultCurrency(false)
->save($con)
;
diff --git a/core/lib/Thelia/Model/ProductSaleElements.php b/core/lib/Thelia/Model/ProductSaleElements.php
index ec485d7a7..05398c041 100644
--- a/core/lib/Thelia/Model/ProductSaleElements.php
+++ b/core/lib/Thelia/Model/ProductSaleElements.php
@@ -3,14 +3,19 @@
namespace Thelia\Model;
use Thelia\Model\Base\ProductSaleElements as BaseProductSaleElements;
+use Thelia\Model\Tools\ProductPriceTools;
use Thelia\TaxEngine\Calculator;
class ProductSaleElements extends BaseProductSaleElements
{
- public function getPrice($virtualColumnName = 'price_PRICE')
+ public function getPrice($virtualColumnName = 'price_PRICE', $discount = 0)
{
try {
$amount = $this->getVirtualColumn($virtualColumnName);
+
+ if ($discount > 0) {
+ $amount = $amount * (1-($discount/100));
+ }
} catch (PropelException $e) {
throw new PropelException("Virtual column `$virtualColumnName` does not exist in ProductSaleElements::getPrice");
}
@@ -18,10 +23,14 @@ class ProductSaleElements extends BaseProductSaleElements
return $amount;
}
- public function getPromoPrice($virtualColumnName = 'price_PROMO_PRICE')
+ public function getPromoPrice($virtualColumnName = 'price_PROMO_PRICE', $discount = 0)
{
try {
$amount = $this->getVirtualColumn($virtualColumnName);
+
+ if ($discount > 0) {
+ $amount = $amount * (1-($discount/100));
+ }
} catch (PropelException $e) {
throw new PropelException("Virtual column `$virtualColumnName` does not exist in ProductSaleElements::getPromoPrice");
}
@@ -29,17 +38,69 @@ class ProductSaleElements extends BaseProductSaleElements
return $amount;
}
- public function getTaxedPrice(Country $country)
+ public function getTaxedPrice(Country $country , $virtualColumnName = 'price_PRICE', $discount = 0)
{
$taxCalculator = new Calculator();
- return round($taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPrice()), 2);
+ return round($taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPrice($virtualColumnName, $discount)), 2);
}
- public function getTaxedPromoPrice(Country $country)
+ public function getTaxedPromoPrice(Country $country, $virtualColumnName = 'price_PROMO_PRICE', $discount = 0)
{
$taxCalculator = new Calculator();
- return round($taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPromoPrice()), 2);
+ return round($taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPromoPrice($virtualColumnName, $discount)), 2);
}
+
+ /**
+ * Get product prices for a specific currency.
+ *
+ * When the currency is not the default currency, the product prices for this currency is :
+ * - calculated according to the product price of the default currency. It happens when no product price exists for
+ * the currency or when the `from_default_currency` flag is set to `true`
+ * - set directly in the product price when `from_default_currency` is set to `false`
+ *
+ * @param Currency $currency
+ * @return ProductPriceTools
+ * @throws \RuntimeException
+ */
+ public function getPricesByCurrency(Currency $currency, $discount = 0)
+ {
+ $defaultCurrency = Currency::getDefaultCurrency();
+
+ $productPrice = ProductPriceQuery::create()
+ ->filterByProductSaleElementsId($this->getId())
+ ->filterByCurrencyId($currency->getId())
+ ->findOne();
+
+ $price = 0.0;
+ $promoPrice = 0.0;
+
+ if (null === $productPrice || $productPrice->getFromDefaultCurrency()) {
+ // need to calculate the prices based on the product prices for the default currency
+ $productPrice = ProductPriceQuery::create()
+ ->filterByProductSaleElementsId($this->getId())
+ ->filterByCurrencyId($defaultCurrency->getId())
+ ->findOne();
+ if (null !== $productPrice) {
+ $price = $productPrice->getPrice() * $currency->getRate() / $defaultCurrency->getRate();
+ $promoPrice = $productPrice->getPromoPrice() * $currency->getRate() / $defaultCurrency->getRate();
+ } else {
+ throw new \RuntimeException('Cannot find product prices for currency id: `' . $currency->getId() . '`');
+ }
+ } else {
+ $price = $productPrice->getPrice();
+ $promoPrice = $productPrice->getPromoPrice();
+ }
+
+ if ($discount > 0) {
+ $price = $price * (1-($discount/100));
+ $promoPrice = $promoPrice * (1-($discount/100));
+ }
+
+ $productPriceTools = new ProductPriceTools($price, $promoPrice);
+
+ return $productPriceTools;
+ }
+
}
diff --git a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
index bc2f72889..4e767a0a3 100644
--- a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
+++ b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
@@ -1,5 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Model\Tools;
@@ -53,6 +42,11 @@ trait ModelEventDispatcherTrait
return $this->dispatcher;
}
+ public function clearDispatcher()
+ {
+ $this->dispatcher = null;
+ }
+
protected function dispatchEvent($eventName, ActionEvent $event)
{
if (!is_null($this->dispatcher)) {
diff --git a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
index e96ae6f11..66ef33621 100644
--- a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
+++ b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Model\Tools;
diff --git a/core/lib/Thelia/Model/Tools/ProductPriceTools.php b/core/lib/Thelia/Model/Tools/ProductPriceTools.php
new file mode 100644
index 000000000..d51a27982
--- /dev/null
+++ b/core/lib/Thelia/Model/Tools/ProductPriceTools.php
@@ -0,0 +1,60 @@
+
+ */
+class ProductPriceTools
+{
+ /**
+ * The value for the price field.
+ *
+ * @var double
+ */
+ protected $price;
+
+ /**
+ * The value for the promoPrice field.
+ *
+ * @var double
+ */
+ protected $promoPrice;
+
+ public function __construct($price, $promoPrice)
+ {
+ $this->price = $price;
+ $this->promoPrice = $promoPrice;
+ }
+
+ /**
+ * @return float
+ */
+ public function getPrice()
+ {
+ return $this->price;
+ }
+
+ /**
+ * @return float
+ */
+ public function getPromoPrice()
+ {
+ return $this->promoPrice;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/Tools/UrlRewritingTrait.php b/core/lib/Thelia/Model/Tools/UrlRewritingTrait.php
index b02cf0c6d..79947074f 100644
--- a/core/lib/Thelia/Model/Tools/UrlRewritingTrait.php
+++ b/core/lib/Thelia/Model/Tools/UrlRewritingTrait.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Model\Tools;
diff --git a/core/lib/Thelia/Module/AbstractDeliveryModule.php b/core/lib/Thelia/Module/AbstractDeliveryModule.php
new file mode 100644
index 000000000..070b19cc1
--- /dev/null
+++ b/core/lib/Thelia/Module/AbstractDeliveryModule.php
@@ -0,0 +1,19 @@
+container->get("thelia.parser");
+
+ $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate());
+
+ $renderedTemplate = $parser->render(
+ "order-payment-gateway.html",
+ array(
+ "order_id" => $order->getId(),
+ "cart_count" => $this->getRequest()->getSession()->getCart()->getCartItems()->count(),
+ "gateway_url" => $gateway_url,
+ "payment_form_data" => $form_data
+ )
+ );
+
+ return Response::create($renderedTemplate);
+ }
+
+ /**
+ * Return the order payment success page URL
+ *
+ * @param int $order_id the order ID
+ * @return string the order payment success page URL
+ */
+ public function getPaymentSuccessPageUrl($order_id)
+ {
+ $frontOfficeRouter = $this->getContainer()->get('router.front');
+
+ return URL::getInstance()->absoluteUrl(
+ $frontOfficeRouter->generate(
+ "order.placed",
+ array("order_id" => $order_id),
+ Router::ABSOLUTE_URL
+ )
+ );
+ }
+
+ /**
+ * Redirect the customer to the failure payment page. if $message is null, a generic message is displayed.
+ *
+ * @param int $order_id the order ID
+ * @param string|null $message an error message.
+ *
+ * @return string the order payment failure page URL
+ */
+ public function getPaymentFailurePageUrl($order_id, $message)
+ {
+ $frontOfficeRouter = $this->getContainer()->get('router.front');
+
+ return URL::getInstance()->absoluteUrl(
+ $frontOfficeRouter->generate(
+ "order.failed",
+ array(
+ "order_id" => $order_id,
+ "message" => $message
+ ),
+ Router::ABSOLUTE_URL
+ )
+ );
+ }
+}
diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php
index 6dcf3ff06..6ff1cf0f1 100644
--- a/core/lib/Thelia/Module/BaseModule.php
+++ b/core/lib/Thelia/Module/BaseModule.php
@@ -1,25 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Module;
@@ -29,15 +17,20 @@ use Propel\Runtime\Propel;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
-use Thelia\Model\Map\ModuleTableMap;
-use Thelia\Model\ModuleI18nQuery;
-use Thelia\Model\Map\ModuleImageTableMap;
-use Thelia\Model\ModuleI18n;
-use Thelia\Tools\Image;
+use Thelia\Core\HttpFoundation\Session\Session;
use Thelia\Exception\ModuleException;
+use Thelia\Model\Cart;
+use Thelia\Model\Country;
+use Thelia\Model\Map\ModuleImageTableMap;
+use Thelia\Model\Map\ModuleTableMap;
use Thelia\Model\Module;
+use Thelia\Model\ModuleI18n;
+use Thelia\Model\ModuleI18nQuery;
use Thelia\Model\ModuleImage;
use Thelia\Model\ModuleQuery;
+use Thelia\Model\Order;
+use Thelia\TaxEngine\TaxEngine;
+use Thelia\Tools\Image;
class BaseModule extends ContainerAware implements BaseModuleInterface
{
@@ -124,8 +117,18 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
$this->request = $request;
}
+ /**
+ * @return \Thelia\Core\HttpFoundation\Request the request.
+ *
+ * @throws \RuntimeException
+ */
public function getRequest()
{
+ if ($this->hasRequest() === false) {
+ // Try to get request from container.
+ $this->setRequest($this->getContainer()->get('request'));
+ }
+
if ($this->hasRequest() === false) {
throw new \RuntimeException("Sorry, the request is not available in this context");
}
@@ -152,6 +155,12 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
return $this->dispatcher;
}
+ /**
+ * Sets a module titles for various languages
+ *
+ * @param Module $module the module.
+ * @param array $titles an associative array of locale => title_string
+ */
public function setTitle(Module $module, $titles)
{
if (is_array($titles)) {
@@ -173,6 +182,19 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
}
}
+ /**
+ * Ensure the proper deployment of the module's images.
+ *
+ * TODO : this method does not take care of internationalization. This is a bug.
+ *
+ * @param Module $module the module
+ * @param string $folderPath the image folder path
+ * @param ConnectionInterface $con
+ *
+ * @throws \Thelia\Exception\ModuleException
+ * @throws \Exception
+ * @throws \UnexpectedValueException
+ */
public function deployImageFolder(Module $module, $folderPath, ConnectionInterface $con = null)
{
try {
@@ -181,13 +203,14 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
throw $e;
}
if (null === $con) {
- $con = \Propel\Runtime\Propel::getConnection(
+ $con = Propel::getConnection(
ModuleImageTableMap::DATABASE_NAME
);
}
/* browse the directory */
$imagePosition = 1;
+ /** @var \DirectoryIterator $directoryContent */
foreach ($directoryBrowser as $directoryContent) {
/* is it a file ? */
if ($directoryContent->isFile()) {
@@ -263,8 +286,72 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
}
/**
+ * Check if this module is the payment module for a given order
*
- * This method allow adding new compilers to Thelia container
+ * @param Order $order an order
+ * @return bool true if this module is the payment module for the given order.
+ */
+ public function isPaymentModuleFor(Order $order)
+ {
+ $model = $this->getModuleModel();
+
+ return $order->getPaymentModuleId() == $model->getId();
+ }
+
+ /**
+ * Check if this module is the delivery module for a given order
+ *
+ * @param Order $order an order
+ * @return bool true if this module is the delivery module for the given order.
+ */
+ public function isDeliveryModuleFor(Order $order)
+ {
+ $model = $this->getModuleModel();
+
+ return $order->getDeliveryModuleId() == $model->getId();
+ }
+
+ /**
+ * A convenient method to get the current order total, with or without tax, discount or postage.
+ * This method operates on the order currently in the user's session, and should not be used to
+ * get the total amount of an order already stored in the database. For such orders, use
+ * Order::getTotalAmount() method.
+ *
+ * @param bool $with_tax if true, to total price will include tax amount
+ * @param bool $with_discount if true, the total price will include discount, if any
+ * @param bool $with_postage if true, the total price will include the delivery costs, if any.
+ *
+ * @return float|int the current order amount.
+ */
+ public function getCurrentOrderTotalAmount($with_tax = true, $with_discount = true, $with_postage = true)
+ {
+ /** @var Session $session */
+ $session = $this->getRequest()->getSession();
+
+ /** @var Cart $cart */
+ $cart = $session->getCart();
+
+ /** @var Order $order */
+ $order = $session->getOrder();
+
+ /** @var TaxEngine $taxEngine */
+ $taxEngine = $this->getContainer()->get("thelia.taxengine");
+
+ /** @var Country $country */
+ $country = $taxEngine->getDeliveryCountry();
+
+ $amount = $with_tax ? $cart->getTaxedAmount($country, $with_discount) : $cart->getTotalAmount($with_discount);
+
+ if ($with_postage) {
+ $amount += $order->getPostage();
+ }
+
+ return $amount;
+ }
+
+ /**
+ *
+ * This method adds new compilers to Thelia container
*
* You must return an array. This array can contain :
* - arrays
@@ -302,33 +389,66 @@ class BaseModule extends ContainerAware implements BaseModuleInterface
return array();
}
+ /**
+ * This method is called when the plugin is installed for the first time, using
+ * zip upload method.
+ *
+ * @param ConnectionInterface $con
+ */
public function install(ConnectionInterface $con = null)
{
- // Implement this method to do something useful.
+ // Override this method to do something useful.
}
+ /**
+ * This method is called before the module activation, and may prevent it by returning false.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return bool true to continue module activation, false to prevent it.
+ */
public function preActivation(ConnectionInterface $con = null)
{
+ // Override this method to do something useful.
return true;
}
+ /**
+ * This method is called just after the module was successfully activated.
+ *
+ * @param ConnectionInterface $con
+ */
public function postActivation(ConnectionInterface $con = null)
{
- // Implement this method to do something useful.
+ // Override this method to do something useful.
}
+ /**
+ * This method is called before the module de-activation, and may prevent it by returning false.
+ *
+ * @param ConnectionInterface $con
+ * @return bool true to continue module de-activation, false to prevent it.
+ */
public function preDeactivation(ConnectionInterface $con = null)
{
+ // Override this method to do something useful.
return true;
}
public function postDeactivation(ConnectionInterface $con = null)
{
- // Implement this method to do something useful.
+ // Override this method to do something useful.
}
+ /**
+ * This method is called just before the deletion of the module, giving the module an opportunity
+ * to delete its data.
+ *
+ * @param ConnectionInterface $con
+ * @param bool $deleteModuleData if true, the module should remove all its data from the system.
+ */
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
{
- // Implement this method to do something useful.
+ // Override this method to do something useful.
}
}
diff --git a/core/lib/Thelia/Module/BaseModuleInterface.php b/core/lib/Thelia/Module/BaseModuleInterface.php
index be7b30a12..11ee54fec 100644
--- a/core/lib/Thelia/Module/BaseModuleInterface.php
+++ b/core/lib/Thelia/Module/BaseModuleInterface.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Module;
diff --git a/core/lib/Thelia/Module/BasePaymentModuleController.php b/core/lib/Thelia/Module/BasePaymentModuleController.php
new file mode 100644
index 000000000..8c13c219b
--- /dev/null
+++ b/core/lib/Thelia/Module/BasePaymentModuleController.php
@@ -0,0 +1,187 @@
+
+ */
+abstract class BasePaymentModuleController extends BaseFrontController
+{
+ protected $log = null;
+
+ /**
+ * Return a module identifier used to calculate the name of the log file,
+ * and in the log messages.
+ *
+ * @return string the module code
+ */
+ abstract protected function getModuleCode();
+
+ /**
+ * Initialize a module-specific logger.
+ *
+ * @return Tlog a Tlog instance
+ */
+ protected function getLog()
+ {
+ if ($this->log == null) {
+ $this->log = Tlog::getNewInstance();
+
+ $logFilePath = sprintf(THELIA_ROOT."log".DS."%s.log", strtolower($this->getModuleCode()));
+
+ $this->log->setPrefix("#LEVEL: #DATE #HOUR: ");
+ $this->log->setDestinations("\\Thelia\\Log\\Destination\\TlogDestinationFile");
+ $this->log->setConfig("\\Thelia\\Log\\Destination\\TlogDestinationFile", 0, $logFilePath);
+ }
+
+ return $this->log;
+ }
+
+ /**
+ * Process the confirmation of an order. This method should be called
+ * once the module has performed the required checks to confirm a valid payment.
+ *
+ * @param int $order_id the order ID
+ */
+ public function confirmPayment($order_id)
+ {
+ try {
+ $order_id = intval($order_id);
+
+ if (null !== $order = $this->getOrder($order_id)) {
+
+ $this->getLog()->addInfo(
+ $this->getTranslator()->trans("Processing confirmation of order ref. %ref, ID %id",
+ array('%ref' => $order->getRef(), '%id' => $order->getId()))
+ );
+
+ $event = new OrderEvent($order);
+
+ $event->setStatus(OrderStatusQuery::getPaidStatus()->getId());
+
+ $this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
+
+ $this->getLog()->addInfo(
+ $this->getTranslator()->trans("Order ref. %ref, ID %id has been successfully paid.",
+ array('%ref' => $order->getRef(), '%id' => $order->getId()))
+ );
+ }
+ } catch (\Exception $ex) {
+ $this->getLog()->addError(
+ $this->getTranslator()->trans("Error occured while processing order ref. %ref, ID %id: %err",
+ array(
+ '%err' => $ex->getMessage(),
+ '%ref' => ! isset($order) ? "?" : $order->getRef(),
+ '%id' => ! isset($order) ? "?" : $order->getId()
+ )
+ )
+ );
+
+ throw $ex;
+ }
+ }
+
+ /**
+ * Process the cancelation of a payment on the payment gateway. The order will go back to the
+ * "not paid" status.
+ *
+ * @param int $order_id the order ID
+ */
+ public function cancelPayment($order_id)
+ {
+ $order_id = intval($order_id);
+
+ if (null !== $order = $this->getOrder($order_id)) {
+ $this->getLog()->addInfo(
+ $this->getTranslator()->trans("Processing cancelation of payment for order ref. %ref",
+ array('%ref' => $order->getRef()))
+ );
+
+ $event = new OrderEvent($order);
+
+ $event->setStatus(OrderStatus::CODE_NOT_PAID);
+
+ $this->getLog()->addInfo(
+ $this->getTranslator()->trans("Order ref. %ref is now unpaid.",
+ array('%ref' => $order->getRef()))
+ );
+
+ $this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
+ }
+ }
+
+ /**
+ * Get an order and issue a log message if not found.
+ * @param $order_id
+ * @return null|\Thelia\Model\Order
+ */
+ protected function getOrder($order_id)
+ {
+ if (null == $order = OrderQuery::create()->findPk($order_id)) {
+ $this->getLog()->addError($this->getTranslator()->trans("Unknown order ID: %id", array('%id' => $order_id)));
+ }
+
+ return $order;
+ }
+ /**
+ * Redirect the customer to the successful payment page.
+ *
+ * @param int $order_id the order ID
+ */
+ public function redirectToSuccessPage($order_id)
+ {
+ $this->getLog()->addInfo("Redirecting customer to payment success page");
+
+ $this->redirectToRoute(
+ 'order.placed',
+ [],
+ [
+ 'order_id' => $order_id
+ ],
+ Router::ABSOLUTE_PATH
+ );
+ }
+
+ /**
+ * Redirect the customer to the failure payment page. if $message is null, a generic message is displayed.
+ *
+ * @param int $order_id the order ID
+ * @param string|null $message an error message.
+ */
+ public function redirectToFailurePage($order_id, $message)
+ {
+ $this->getLog()->addInfo("Redirecting customer to payment failure page");
+
+ $this->redirectToRoute(
+ 'order.failed',
+ [],
+ [
+ 'order_id' => $order_id,
+ 'message' => $message
+ ],
+ Router::ABSOLUTE_PATH
+ );
+ }
+}
diff --git a/core/lib/Thelia/Module/DeliveryModuleInterface.php b/core/lib/Thelia/Module/DeliveryModuleInterface.php
index 17b000d4f..9fd15ddd1 100644
--- a/core/lib/Thelia/Module/DeliveryModuleInterface.php
+++ b/core/lib/Thelia/Module/DeliveryModuleInterface.php
@@ -1,38 +1,42 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Module;
use Thelia\Model\Country;
+use Thelia\Module\Exception\DeliveryException;
interface DeliveryModuleInterface extends BaseModuleInterface
{
/**
- * calculate and return delivery price
+ * This method is called by the Delivery loop, to check if the current module has to be displayed to the customer.
+ * Override it to implements your delivery rules/
*
- * @param Country $country
+ * If you return true, the delivery method will de displayed to the customer
+ * If you return false, the delivery method will not be displayed
*
- * @return mixed
+ * @param Country $country the country to deliver to.
+ *
+ * @return boolean
+ */
+ public function isValidDelivery(Country $country);
+
+ /**
+ * Calculate and return delivery price in the shop's default currency
+ *
+ * @param Country $country the country to deliver to.
+ *
+ * @return float the delivery price
+ * @throws DeliveryException if the postage price cannot be calculated.
*/
public function getPostage(Country $country);
}
diff --git a/core/lib/Thelia/Module/Exception/DeliveryException.php b/core/lib/Thelia/Module/Exception/DeliveryException.php
new file mode 100644
index 000000000..f5668a082
--- /dev/null
+++ b/core/lib/Thelia/Module/Exception/DeliveryException.php
@@ -0,0 +1,17 @@
+. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Module\Exception;
diff --git a/core/lib/Thelia/Module/ModuleDescriptorValidator.php b/core/lib/Thelia/Module/ModuleDescriptorValidator.php
index 8f8c89d4a..6b1f9452f 100644
--- a/core/lib/Thelia/Module/ModuleDescriptorValidator.php
+++ b/core/lib/Thelia/Module/ModuleDescriptorValidator.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Module;
diff --git a/core/lib/Thelia/Module/ModuleManagement.php b/core/lib/Thelia/Module/ModuleManagement.php
index 99cc5ca9f..0602c1188 100644
--- a/core/lib/Thelia/Module/ModuleManagement.php
+++ b/core/lib/Thelia/Module/ModuleManagement.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Module;
diff --git a/core/lib/Thelia/Module/PaymentModuleInterface.php b/core/lib/Thelia/Module/PaymentModuleInterface.php
index bb6d03854..47dff4d3a 100644
--- a/core/lib/Thelia/Module/PaymentModuleInterface.php
+++ b/core/lib/Thelia/Module/PaymentModuleInterface.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Module;
diff --git a/core/lib/Thelia/Rewriting/RewritingResolver.php b/core/lib/Thelia/Rewriting/RewritingResolver.php
index 91be66b55..2ac87df80 100644
--- a/core/lib/Thelia/Rewriting/RewritingResolver.php
+++ b/core/lib/Thelia/Rewriting/RewritingResolver.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Rewriting;
use Thelia\Exception\UrlRewritingException;
diff --git a/core/lib/Thelia/Rewriting/RewritingRetriever.php b/core/lib/Thelia/Rewriting/RewritingRetriever.php
index cfff07914..d161282aa 100644
--- a/core/lib/Thelia/Rewriting/RewritingRetriever.php
+++ b/core/lib/Thelia/Rewriting/RewritingRetriever.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Rewriting;
use Thelia\Model\RewritingUrlQuery;
diff --git a/core/lib/Thelia/TaxEngine/BaseTaxType.php b/core/lib/Thelia/TaxEngine/BaseTaxType.php
index 30223b669..80044c3f4 100644
--- a/core/lib/Thelia/TaxEngine/BaseTaxType.php
+++ b/core/lib/Thelia/TaxEngine/BaseTaxType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\TaxEngine;
use Thelia\Exception\TaxEngineException;
diff --git a/core/lib/Thelia/TaxEngine/Calculator.php b/core/lib/Thelia/TaxEngine/Calculator.php
index 552acab19..77a7b41a3 100644
--- a/core/lib/Thelia/TaxEngine/Calculator.php
+++ b/core/lib/Thelia/TaxEngine/Calculator.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\TaxEngine;
use Thelia\Exception\TaxEngineException;
@@ -100,6 +90,27 @@ class Calculator
return $this;
}
+ public function loadTaxRuleWithoutProduct(TaxRule $taxRule, Country $country)
+ {
+ $this->product = null;
+ $this->country = null;
+ $this->taxRulesCollection = null;
+
+ if ($taxRule->getId() === null) {
+ throw new TaxEngineException('TaxRule id is empty in Calculator::loadTaxRule', TaxEngineException::UNDEFINED_TAX_RULE);
+ }
+ if ($country->getId() === null) {
+ throw new TaxEngineException('Country id is empty in Calculator::loadTaxRule', TaxEngineException::UNDEFINED_COUNTRY);
+ }
+
+ $this->country = $country;
+ $this->product = new Product();
+
+ $this->taxRulesCollection = $this->taxRuleQuery->getTaxCalculatorCollection($taxRule, $country);
+
+ return $this;
+ }
+
public function getTaxAmountFromUntaxedPrice($untaxedPrice, &$taxCollection = null)
{
return $this->getTaxedPrice($untaxedPrice, $taxCollection) - $untaxedPrice;
diff --git a/core/lib/Thelia/TaxEngine/OrderProductTaxCollection.php b/core/lib/Thelia/TaxEngine/OrderProductTaxCollection.php
index 9bc497078..8d413af87 100644
--- a/core/lib/Thelia/TaxEngine/OrderProductTaxCollection.php
+++ b/core/lib/Thelia/TaxEngine/OrderProductTaxCollection.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\TaxEngine;
use Thelia\Model\OrderProductTax;
diff --git a/core/lib/Thelia/TaxEngine/TaxEngine.php b/core/lib/Thelia/TaxEngine/TaxEngine.php
index 62a8b2f68..04d5fe4fa 100644
--- a/core/lib/Thelia/TaxEngine/TaxEngine.php
+++ b/core/lib/Thelia/TaxEngine/TaxEngine.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\TaxEngine;
use Symfony\Component\HttpFoundation\Session\Session;
diff --git a/core/lib/Thelia/TaxEngine/TaxType/FeatureFixAmountTaxType.php b/core/lib/Thelia/TaxEngine/TaxType/FeatureFixAmountTaxType.php
index eb49847b6..899fca9c7 100644
--- a/core/lib/Thelia/TaxEngine/TaxType/FeatureFixAmountTaxType.php
+++ b/core/lib/Thelia/TaxEngine/TaxType/FeatureFixAmountTaxType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\TaxEngine\TaxType;
use Thelia\Exception\TaxEngineException;
@@ -47,6 +37,7 @@ class FeatureFixAmountTaxType extends BaseTaxType
public function fixAmountRetriever(Product $product)
{
+ $taxAmount = 0;
$featureId = $this->getRequirement("feature");
$query = FeatureProductQuery::create()
@@ -54,14 +45,17 @@ class FeatureFixAmountTaxType extends BaseTaxType
->filterByFeatureId($featureId)
->findOne();
- $taxAmount = $query->getFreeTextValue();
+ if (null !== $query) {
+ $taxAmount = $query->getFreeTextValue();
- $testInt = new FloatType();
- if (!$testInt->isValid($taxAmount)) {
- throw new TaxEngineException(
+ $testInt = new FloatType();
+ if (!$testInt->isValid($taxAmount)) {
+ throw new TaxEngineException(
Translator::getInstance()->trans('Feature value does not match FLOAT format'),
TaxEngineException::FEATURE_BAD_EXPECTED_VALUE
- );
+ );
+ }
+
}
return $taxAmount;
diff --git a/core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php b/core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php
index 43bad834a..46bb57cd5 100644
--- a/core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php
+++ b/core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\TaxEngine\TaxType;
use Thelia\Type\FloatType;
diff --git a/core/lib/Thelia/TaxEngine/TaxType/PricePercentTaxType.php b/core/lib/Thelia/TaxEngine/TaxType/PricePercentTaxType.php
index 08cd99d6d..effa6c988 100644
--- a/core/lib/Thelia/TaxEngine/TaxType/PricePercentTaxType.php
+++ b/core/lib/Thelia/TaxEngine/TaxType/PricePercentTaxType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\TaxEngine\TaxType;
use Thelia\Type\FloatType;
diff --git a/core/lib/Thelia/TaxEngine/TaxTypeRequirementDefinition.php b/core/lib/Thelia/TaxEngine/TaxTypeRequirementDefinition.php
index eb8b0f93c..f1c6c3d88 100644
--- a/core/lib/Thelia/TaxEngine/TaxTypeRequirementDefinition.php
+++ b/core/lib/Thelia/TaxEngine/TaxTypeRequirementDefinition.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\TaxEngine;
use Thelia\Type\TypeInterface;
diff --git a/core/lib/Thelia/Tests/Action/AddressTest.php b/core/lib/Thelia/Tests/Action/AddressTest.php
index d10dc2e9a..448c24af2 100644
--- a/core/lib/Thelia/Tests/Action/AddressTest.php
+++ b/core/lib/Thelia/Tests/Action/AddressTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/AdministratorTest.php b/core/lib/Thelia/Tests/Action/AdministratorTest.php
index 485cb8d87..382c7e31f 100644
--- a/core/lib/Thelia/Tests/Action/AdministratorTest.php
+++ b/core/lib/Thelia/Tests/Action/AdministratorTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/AreaTest.php b/core/lib/Thelia/Tests/Action/AreaTest.php
index 9e826a056..9bf0da48c 100644
--- a/core/lib/Thelia/Tests/Action/AreaTest.php
+++ b/core/lib/Thelia/Tests/Action/AreaTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/AttributeAvTest.php b/core/lib/Thelia/Tests/Action/AttributeAvTest.php
index 665afe2a2..757c51e7f 100644
--- a/core/lib/Thelia/Tests/Action/AttributeAvTest.php
+++ b/core/lib/Thelia/Tests/Action/AttributeAvTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/AttributeTest.php b/core/lib/Thelia/Tests/Action/AttributeTest.php
index 9054992ff..77a1b8e81 100644
--- a/core/lib/Thelia/Tests/Action/AttributeTest.php
+++ b/core/lib/Thelia/Tests/Action/AttributeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/BaseAction.php b/core/lib/Thelia/Tests/Action/BaseAction.php
index c07c07115..093efd0f3 100644
--- a/core/lib/Thelia/Tests/Action/BaseAction.php
+++ b/core/lib/Thelia/Tests/Action/BaseAction.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/CacheTest.php b/core/lib/Thelia/Tests/Action/CacheTest.php
index a0235c696..b15394d47 100644
--- a/core/lib/Thelia/Tests/Action/CacheTest.php
+++ b/core/lib/Thelia/Tests/Action/CacheTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/CategoryTest.php b/core/lib/Thelia/Tests/Action/CategoryTest.php
index ee8d31c81..f0112a7dd 100644
--- a/core/lib/Thelia/Tests/Action/CategoryTest.php
+++ b/core/lib/Thelia/Tests/Action/CategoryTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/ConfigTest.php b/core/lib/Thelia/Tests/Action/ConfigTest.php
index 5ed9e9633..afec65875 100644
--- a/core/lib/Thelia/Tests/Action/ConfigTest.php
+++ b/core/lib/Thelia/Tests/Action/ConfigTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/ContentTest.php b/core/lib/Thelia/Tests/Action/ContentTest.php
index 08e41815b..6f224f83a 100644
--- a/core/lib/Thelia/Tests/Action/ContentTest.php
+++ b/core/lib/Thelia/Tests/Action/ContentTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/CountryTest.php b/core/lib/Thelia/Tests/Action/CountryTest.php
index 0ea497fde..71612a614 100644
--- a/core/lib/Thelia/Tests/Action/CountryTest.php
+++ b/core/lib/Thelia/Tests/Action/CountryTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/CurrencyTest.php b/core/lib/Thelia/Tests/Action/CurrencyTest.php
index 01979455f..3350f3b99 100644
--- a/core/lib/Thelia/Tests/Action/CurrencyTest.php
+++ b/core/lib/Thelia/Tests/Action/CurrencyTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/CustomerTest.php b/core/lib/Thelia/Tests/Action/CustomerTest.php
index f160847ee..a8fcaa352 100644
--- a/core/lib/Thelia/Tests/Action/CustomerTest.php
+++ b/core/lib/Thelia/Tests/Action/CustomerTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action\ImageTest;
diff --git a/core/lib/Thelia/Tests/Action/DocumentTest.php b/core/lib/Thelia/Tests/Action/DocumentTest.php
index 17a841d94..b3c546165 100644
--- a/core/lib/Thelia/Tests/Action/DocumentTest.php
+++ b/core/lib/Thelia/Tests/Action/DocumentTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/FeatureAvTest.php b/core/lib/Thelia/Tests/Action/FeatureAvTest.php
index e6c66d45e..33d213946 100644
--- a/core/lib/Thelia/Tests/Action/FeatureAvTest.php
+++ b/core/lib/Thelia/Tests/Action/FeatureAvTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/FeatureTest.php b/core/lib/Thelia/Tests/Action/FeatureTest.php
index e2604079a..c97b8b1cb 100644
--- a/core/lib/Thelia/Tests/Action/FeatureTest.php
+++ b/core/lib/Thelia/Tests/Action/FeatureTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/FolderTest.php b/core/lib/Thelia/Tests/Action/FolderTest.php
index 96e07ed52..21416bfa3 100644
--- a/core/lib/Thelia/Tests/Action/FolderTest.php
+++ b/core/lib/Thelia/Tests/Action/FolderTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/ImageTest.php b/core/lib/Thelia/Tests/Action/ImageTest.php
index 1b718f096..00d08123c 100755
--- a/core/lib/Thelia/Tests/Action/ImageTest.php
+++ b/core/lib/Thelia/Tests/Action/ImageTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/LangTest.php b/core/lib/Thelia/Tests/Action/LangTest.php
index b187479eb..e4fc50e71 100644
--- a/core/lib/Thelia/Tests/Action/LangTest.php
+++ b/core/lib/Thelia/Tests/Action/LangTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
@@ -66,6 +55,9 @@ class LangTest extends \PHPUnit_Framework_TestCase
->setCode('TES')
->setDateFormat('Y-m-d')
->setTimeFormat('H:i:s')
+ ->setDecimalSeparator(".")
+ ->setThousandsSeparator(" ")
+ ->setDecimals("2")
->setDispatcher($this->dispatcher)
;
@@ -83,6 +75,10 @@ class LangTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('TES', $createdLang->getCode());
$this->assertEquals('Y-m-d', $createdLang->getDateFormat());
$this->assertEquals('H:i:s', $createdLang->getTimeFormat());
+ $this->assertEquals('.', $createdLang->getDecimalSeparator());
+ $this->assertEquals(' ', $createdLang->getThousandsSeparator());
+ $this->assertEquals('2', $createdLang->getDecimals());
+ $this->assertEquals('Y-m-d H:i:s', $createdLang->getDatetimeFormat());
return $createdLang;
}
@@ -101,6 +97,9 @@ class LangTest extends \PHPUnit_Framework_TestCase
->setCode('TEST')
->setDateFormat('d-m-Y')
->setTimeFormat('H-i-s')
+ ->setDecimalSeparator(",")
+ ->setThousandsSeparator(".")
+ ->setDecimals("1")
->setDispatcher($this->dispatcher)
;
@@ -116,6 +115,10 @@ class LangTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('test update', $updatedLang->getTitle());
$this->assertEquals('d-m-Y', $updatedLang->getDateFormat());
$this->assertEquals('H-i-s', $updatedLang->getTimeFormat());
+ $this->assertEquals(',', $updatedLang->getDecimalSeparator());
+ $this->assertEquals('.', $updatedLang->getThousandsSeparator());
+ $this->assertEquals('1', $updatedLang->getDecimals());
+ $this->assertEquals('d-m-Y H-i-s', $updatedLang->getDatetimeFormat());
return $updatedLang;
}
diff --git a/core/lib/Thelia/Tests/Action/MessageTest.php b/core/lib/Thelia/Tests/Action/MessageTest.php
index f5a53bb2c..a201a1f3d 100644
--- a/core/lib/Thelia/Tests/Action/MessageTest.php
+++ b/core/lib/Thelia/Tests/Action/MessageTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/NewsletterTest.php b/core/lib/Thelia/Tests/Action/NewsletterTest.php
index acea9752a..cee09d644 100644
--- a/core/lib/Thelia/Tests/Action/NewsletterTest.php
+++ b/core/lib/Thelia/Tests/Action/NewsletterTest.php
@@ -1,26 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
-
namespace Thelia\Tests\Action;
use Thelia\Action\Newsletter;
diff --git a/core/lib/Thelia/Tests/Action/OrderTest.php b/core/lib/Thelia/Tests/Action/OrderTest.php
index fa2f640fd..48527ae7f 100644
--- a/core/lib/Thelia/Tests/Action/OrderTest.php
+++ b/core/lib/Thelia/Tests/Action/OrderTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/PdfTest.php b/core/lib/Thelia/Tests/Action/PdfTest.php
index 2d5d772d5..e3b310782 100644
--- a/core/lib/Thelia/Tests/Action/PdfTest.php
+++ b/core/lib/Thelia/Tests/Action/PdfTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/ProductTest.php b/core/lib/Thelia/Tests/Action/ProductTest.php
index 91b6a2dcd..89c6d3a17 100644
--- a/core/lib/Thelia/Tests/Action/ProductTest.php
+++ b/core/lib/Thelia/Tests/Action/ProductTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/ProfileTest.php b/core/lib/Thelia/Tests/Action/ProfileTest.php
index dcf3c219a..96b3ec202 100644
--- a/core/lib/Thelia/Tests/Action/ProfileTest.php
+++ b/core/lib/Thelia/Tests/Action/ProfileTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Action;
diff --git a/core/lib/Thelia/Tests/Action/RewrittenUrlTestTrait.php b/core/lib/Thelia/Tests/Action/RewrittenUrlTestTrait.php
index 4891e8b96..08939048c 100644
--- a/core/lib/Thelia/Tests/Action/RewrittenUrlTestTrait.php
+++ b/core/lib/Thelia/Tests/Action/RewrittenUrlTestTrait.php
@@ -1,4 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Cart\CartTraitTest;
diff --git a/core/lib/Thelia/Tests/Command/BaseCommandTest.php b/core/lib/Thelia/Tests/Command/BaseCommandTest.php
index 54b62e3f5..234b87b34 100755
--- a/core/lib/Thelia/Tests/Command/BaseCommandTest.php
+++ b/core/lib/Thelia/Tests/Command/BaseCommandTest.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Tests\Command;
/**
diff --git a/core/lib/Thelia/Tests/Command/CacheClearTestSaved.php b/core/lib/Thelia/Tests/Command/CacheClearTestSaved.php
index 73a94e7dd..abd5a9239 100755
--- a/core/lib/Thelia/Tests/Command/CacheClearTestSaved.php
+++ b/core/lib/Thelia/Tests/Command/CacheClearTestSaved.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Tests\Command;
use Symfony\Component\Console\Tester\CommandTester;
diff --git a/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php
index d18c80a61..e95224e16 100755
--- a/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php
+++ b/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Tests\Command;
use Symfony\Component\Console\Tester\CommandTester;
diff --git a/core/lib/Thelia/Tests/Command/ModuleDeactivateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleDeactivateCommandTest.php
new file mode 100755
index 000000000..37a2187bd
--- /dev/null
+++ b/core/lib/Thelia/Tests/Command/ModuleDeactivateCommandTest.php
@@ -0,0 +1,103 @@
+
+ */
+class ModuleDeactivateCommandTest extends \PHPUnit_Framework_TestCase
+{
+ public function testModuleDeactivateCommand()
+ {
+ $module = ModuleQuery::create()->findOne();
+
+ if (null !== $module) {
+
+ $prev_activation_status = $module->getActivate();
+
+ $application = new Application($this->getKernel());
+
+ $module->setActivate(BaseModule::IS_ACTIVATED);
+ $module->save();
+
+ $moduleDeactivate = new ModuleDeactivateCommand();
+ $moduleDeactivate->setContainer($this->getContainer());
+
+ $application->add($moduleDeactivate);
+
+ $command = $application->find("module:deactivate");
+ $commandTester = new CommandTester($command);
+ $commandTester->execute(array(
+ "command" => $command->getName(),
+ "module" => $module->getCode(),
+ ));
+
+ $deactivated = ModuleQuery::create()->findPk($module->getId())->getActivate();
+
+ // Restore activation status
+ $module->setActivate($prev_activation_status)->save();
+
+ $this->assertEquals(BaseModule::IS_NOT_ACTIVATED, $deactivated);
+ }
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ * @expectedExceptionMessage module Letshopethismoduledoesnotexists not found
+ */
+ public function testModuleDeactivateCommandUnknownModule()
+ {
+ $testedModule = ModuleQuery::create()->findOneByCode('Letshopethismoduledoesnotexists');
+
+ if (null == $testedModule) {
+ $application = new Application($this->getKernel());
+
+ $moduleDeactivate = new ModuleDeactivateCommand();
+ $moduleDeactivate->setContainer($this->getContainer());
+
+ $application->add($moduleDeactivate);
+
+ $command = $application->find("module:deactivate");
+ $commandTester = new CommandTester($command);
+ $commandTester->execute(array(
+ "command" => $command->getName(),
+ "module" => "letshopethismoduledoesnotexists",
+ ));
+
+ $out = true;
+ }
+ }
+
+ public function getKernel()
+ {
+ $kernel = $this->getMock("Symfony\Component\HttpKernel\KernelInterface");
+
+ return $kernel;
+ }
+
+ public function getContainer()
+ {
+ $container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
+
+ return $container;
+ }
+}
diff --git a/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php
index 78d84ea78..3679660af 100755
--- a/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php
+++ b/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Tests\Command;
use Symfony\Component\Console\Tester\CommandTester;
diff --git a/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php b/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php
index 84b5a832d..679f22791 100644
--- a/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php
+++ b/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
use Thelia\Condition\Implementation\MatchForTotalAmount;
diff --git a/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php b/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php
index 37dce5120..38c9e43e3 100644
--- a/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php
+++ b/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
diff --git a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php
index a6181cddc..854803411 100644
--- a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php
+++ b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneTest.php
index 95c49ce58..ddf3d25ae 100644
--- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneTest.php
+++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php
index 4f28f32e4..102132196 100644
--- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php
+++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Tests\Condition\Implementation;
diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForXArticlesTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForXArticlesTest.php
index 92aa69564..3d96df4a2 100644
--- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForXArticlesTest.php
+++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForXArticlesTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition\Implementation;
diff --git a/core/lib/Thelia/Tests/Condition/OperatorsTest.php b/core/lib/Thelia/Tests/Condition/OperatorsTest.php
index 94f5bd1bf..c410fd975 100644
--- a/core/lib/Thelia/Tests/Condition/OperatorsTest.php
+++ b/core/lib/Thelia/Tests/Condition/OperatorsTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Condition;
@@ -55,35 +44,35 @@ class OperatorsTest extends \PHPUnit_Framework_TestCase
->will($this->returnCallback((array($this, 'callbackI18n'))));
$actual = Operators::getI18n($stubTranslator, Operators::INFERIOR);
- $expected = 'inferior to';
+ $expected = 'Less than';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::INFERIOR_OR_EQUAL);
- $expected = 'inferior or equal to';
+ $expected = 'Less than or equals';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::EQUAL);
- $expected = 'equal to';
+ $expected = 'Equals';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::SUPERIOR_OR_EQUAL);
- $expected = 'superior or equal to';
+ $expected = 'Greater than or equals';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::SUPERIOR);
- $expected = 'superior to';
+ $expected = 'Greater than';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::DIFFERENT);
- $expected = 'different from';
+ $expected = 'Not equals';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::IN);
- $expected = 'in';
+ $expected = 'In';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::OUT);
- $expected = 'not in';
+ $expected = 'Not in';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, 'unexpected operator');
diff --git a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
index 3ecae7c01..92b91d22b 100755
--- a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
+++ b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Controller;
diff --git a/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php b/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php
index 63ef64940..779de4076 100755
--- a/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php
+++ b/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php
@@ -1,4 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\HttpFoundation\Session;
diff --git a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php
index 1faa8ec81..69505ce62 100755
--- a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php
+++ b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Element;
@@ -29,6 +18,7 @@ use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Security\SecurityContext;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Thelia\Core\HttpFoundation\Session\Session;
+use Thelia\Core\Translation\Translator;
use Thelia\Tools\URL;
use Thelia\TaxEngine\TaxEngine;
@@ -106,6 +96,7 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase
$this->container->set('request', $request);
$this->container->set('event_dispatcher', new EventDispatcher());
+ $this->container->set('thelia.translator',new Translator($this->container));
$this->container->set('thelia.securityContext', new SecurityContext($request));
$this->container->set('router.admin', $stubRouterAdmin);
$this->container->set('thelia.url.manager', new URL($this->container));
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AccessoryTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AccessoryTest.php
index 64bd4b5b6..e64af5dfc 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/AccessoryTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/AccessoryTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AddressTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AddressTest.php
index 447646b8b..5d021f87b 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/AddressTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/AddressTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php
index fb0d95a69..ba5a3cdf2 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop\Argument;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php
index 5d6c2579c..79720d18a 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php
index ca880daa8..09ab71f9d 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php
index f811c7de9..a59f10ecd 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php
index 46b19e3ac..303d7cef1 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php
index ac371e71f..3d9c0de43 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php
index 0009b90d8..c650ad7c6 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CountryTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CountryTest.php
index 0eb37a6fd..420231682 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/CountryTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/CountryTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php
index a866fae0c..f503560c1 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CustomerTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CustomerTest.php
index 4239414fa..cd86b1ba4 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/CustomerTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/CustomerTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php
index cd3a47df0..301bbd9aa 100644
--- a/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php
index aae4ec254..c347fb65a 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureTest.php
index 7324856f6..c2a2811d6 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureValueTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureValueTest.php
index 19966ba71..81bb82316 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureValueTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureValueTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php
index 0dd3b6b0d..a1d7883a0 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php
index 8c4906293..af652c40d 100644
--- a/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php
index ea2ba403b..8951bd166 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php
index b071bde9c..8b2990fae 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php
index dd42a343e..c9015f3c4 100644
--- a/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/TitleTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/TitleTest.php
index 63e4a7a9a..b2e3db416 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/TitleTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/TitleTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Core\Template\Loop;
diff --git a/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php
index a673b805b..ad78dc670 100644
--- a/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Tests\Core\Smarty\Plugins;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
diff --git a/core/lib/Thelia/Tests/Coupon/BaseFacadeTest.php b/core/lib/Thelia/Tests/Coupon/BaseFacadeTest.php
index c2082edb4..7c8351552 100644
--- a/core/lib/Thelia/Tests/Coupon/BaseFacadeTest.php
+++ b/core/lib/Thelia/Tests/Coupon/BaseFacadeTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon;
diff --git a/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php b/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php
index 74d139c4e..8e37e50ec 100644
--- a/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php
+++ b/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon;
use Thelia\Condition\ConditionCollection;
diff --git a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php
index 0286efdd4..b14f781bb 100644
--- a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php
+++ b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon;
use Thelia\Condition\ConditionCollection;
diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php
index ae997d5cb..da349bb85 100644
--- a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php
+++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon\Type;
use Thelia\Condition\ConditionCollection;
diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php
index e4478808e..4ddeb7d12 100644
--- a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php
+++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Coupon\Type;
use Thelia\Condition\ConditionCollection;
diff --git a/core/lib/Thelia/Tests/Fixtures/Dumper/Config/Empty.php b/core/lib/Thelia/Tests/Fixtures/Dumper/Config/Empty.php
deleted file mode 100755
index 9e8bab2c8..000000000
--- a/core/lib/Thelia/Tests/Fixtures/Dumper/Config/Empty.php
+++ /dev/null
@@ -1,25 +0,0 @@
-. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Form;
diff --git a/core/lib/Thelia/Tests/Form/OrderDeliveryTest.php b/core/lib/Thelia/Tests/Form/OrderDeliveryTest.php
index 980c17d88..4943495ae 100755
--- a/core/lib/Thelia/Tests/Form/OrderDeliveryTest.php
+++ b/core/lib/Thelia/Tests/Form/OrderDeliveryTest.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Tests\Form;
class OrderDeliveryTest extends \PHPUnit_Framework_TestCase
diff --git a/core/lib/Thelia/Tests/Log/TlogTest.php b/core/lib/Thelia/Tests/Log/TlogTest.php
index d99b1f14d..23137cdf0 100755
--- a/core/lib/Thelia/Tests/Log/TlogTest.php
+++ b/core/lib/Thelia/Tests/Log/TlogTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Log;
diff --git a/core/lib/Thelia/Tests/Model/Message.php b/core/lib/Thelia/Tests/Model/Message.php
index 2c5101a43..37494f96b 100644
--- a/core/lib/Thelia/Tests/Model/Message.php
+++ b/core/lib/Thelia/Tests/Model/Message.php
@@ -1,31 +1,20 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Model;
use Thelia\Model\ConfigQuery;
use Symfony\Component\Filesystem\Filesystem;
-use Thelia\Model\Message;
+use Thelia\Model\Message as ModelMessage;
use Thelia\Core\Template\Smarty\SmartyParser;
use Thelia\Core\Template\ParserContext;
use Thelia\Core\Template\TemplateHelper;
@@ -86,7 +75,7 @@ class Message extends \PHPUnit_Framework_TestCase
*/
public function testMessageWithTextAndHtmlBody()
{
- $message = new Message();
+ $message = new ModelMessage();
$message->setLocale('fr_FR');
@@ -108,7 +97,7 @@ class Message extends \PHPUnit_Framework_TestCase
*/
public function testMessageWithTextOnlyBody()
{
- $message = new Message();
+ $message = new ModelMessage();
$message->setLocale('fr_FR');
@@ -130,7 +119,7 @@ class Message extends \PHPUnit_Framework_TestCase
*/
public function testMessageWithTextAndHtmlBodyAndTextAndHtmlLayout()
{
- $message = new Message();
+ $message = new ModelMessage();
$message->setLocale('fr_FR');
@@ -161,7 +150,7 @@ class Message extends \PHPUnit_Framework_TestCase
*/
public function testMessageWithTextOnlyBodyAndTextOnlyLayout()
{
- $message = new Message();
+ $message = new ModelMessage();
$message->setLocale('fr_FR');
@@ -189,7 +178,7 @@ class Message extends \PHPUnit_Framework_TestCase
*/
public function testMessageWithTextAndHtmlBodyAndTextOnlyLayout()
{
- $message = new Message();
+ $message = new ModelMessage();
$message->setLocale('fr_FR');
@@ -218,7 +207,7 @@ class Message extends \PHPUnit_Framework_TestCase
*/
public function testMessageWithTextAndHtmlBodyAndTextAndHtmlLayoutAndTextAndHtmlTemplate()
{
- $message = new Message();
+ $message = new ModelMessage();
$message->setLocale('fr_FR');
@@ -257,7 +246,7 @@ class Message extends \PHPUnit_Framework_TestCase
*/
public function testMessageWithTextAndHtmlBodyAndTextAndHtmlLayoutAndTextAndHtmlTemplateWichExtendsLayout()
{
- $message = new Message();
+ $message = new ModelMessage();
$message->setLocale('fr_FR');
@@ -296,7 +285,7 @@ class Message extends \PHPUnit_Framework_TestCase
*/
public function testMessageWithTextAndHtmlBodyAndTextAndHtmlExtendableLayout()
{
- $message = new Message();
+ $message = new ModelMessage();
$message->setLocale('fr_FR');
diff --git a/core/lib/Thelia/Tests/Module/BaseModuleTestor.php b/core/lib/Thelia/Tests/Module/BaseModuleTestor.php
index 1a8de083a..5a637aaaa 100644
--- a/core/lib/Thelia/Tests/Module/BaseModuleTestor.php
+++ b/core/lib/Thelia/Tests/Module/BaseModuleTestor.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Module;
diff --git a/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php b/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php
index 16b8e2f28..7521900f3 100644
--- a/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php
+++ b/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Rewriting;
diff --git a/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php
index f5ff56685..b07c240e1 100644
--- a/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php
+++ b/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Rewriting;
diff --git a/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php
index 97dd10bee..5429d4744 100644
--- a/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php
+++ b/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Rewriting;
diff --git a/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php
index 81e4154a2..c8db5a6c9 100644
--- a/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php
+++ b/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Rewriting;
diff --git a/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php b/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php
index 0a74587d5..6e7880ca5 100644
--- a/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php
+++ b/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Rewriting;
diff --git a/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php b/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php
index 97a6eebc0..55f795cb8 100755
--- a/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php
+++ b/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Rewriting;
diff --git a/core/lib/Thelia/Tests/Rewriting/RewritingRetrieverTest.php b/core/lib/Thelia/Tests/Rewriting/RewritingRetrieverTest.php
index e237d65fb..9636d3516 100755
--- a/core/lib/Thelia/Tests/Rewriting/RewritingRetrieverTest.php
+++ b/core/lib/Thelia/Tests/Rewriting/RewritingRetrieverTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Rewriting;
diff --git a/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php b/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php
index 4a3b7e80e..0f5ffb26c 100755
--- a/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php
+++ b/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\TaxEngine;
diff --git a/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php b/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php
index 1320c3020..77817b3bd 100644
--- a/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php
+++ b/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests;
diff --git a/core/lib/Thelia/Tests/Tools/FileManagerTest.php b/core/lib/Thelia/Tests/Tools/FileManagerTest.php
index a96ab3866..9fe76878b 100644
--- a/core/lib/Thelia/Tests/Tools/FileManagerTest.php
+++ b/core/lib/Thelia/Tests/Tools/FileManagerTest.php
@@ -1,11 +1,14 @@
- */
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Tests\Tools;
diff --git a/core/lib/Thelia/Tests/Tools/URLTest.php b/core/lib/Thelia/Tests/Tools/URLTest.php
index b996fe288..a6b934544 100755
--- a/core/lib/Thelia/Tests/Tools/URLTest.php
+++ b/core/lib/Thelia/Tests/Tools/URLTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/AlphaNumStringListTypeTest.php b/core/lib/Thelia/Tests/Type/AlphaNumStringListTypeTest.php
index 2a4409860..be36371f0 100755
--- a/core/lib/Thelia/Tests/Type/AlphaNumStringListTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/AlphaNumStringListTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/AlphaNumStringTypeTest.php b/core/lib/Thelia/Tests/Type/AlphaNumStringTypeTest.php
index 8f752432f..e5ba2dd9b 100755
--- a/core/lib/Thelia/Tests/Type/AlphaNumStringTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/AlphaNumStringTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/AnyTypeTest.php b/core/lib/Thelia/Tests/Type/AnyTypeTest.php
index e4750000e..5e07b18be 100755
--- a/core/lib/Thelia/Tests/Type/AnyTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/AnyTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/BooleanTypeTest.php b/core/lib/Thelia/Tests/Type/BooleanTypeTest.php
index a4842a39f..2166ca132 100755
--- a/core/lib/Thelia/Tests/Type/BooleanTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/BooleanTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/EnumListTypeTest.php b/core/lib/Thelia/Tests/Type/EnumListTypeTest.php
index a225464c1..fbc453465 100755
--- a/core/lib/Thelia/Tests/Type/EnumListTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/EnumListTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/EnumTypeTest.php b/core/lib/Thelia/Tests/Type/EnumTypeTest.php
index 10660ee38..1957ebe68 100755
--- a/core/lib/Thelia/Tests/Type/EnumTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/EnumTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/FloatTypeTest.php b/core/lib/Thelia/Tests/Type/FloatTypeTest.php
index 600c696f8..9f2452652 100755
--- a/core/lib/Thelia/Tests/Type/FloatTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/FloatTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/IntListTypeTest.php b/core/lib/Thelia/Tests/Type/IntListTypeTest.php
index a10d124e4..0f8ce00fc 100755
--- a/core/lib/Thelia/Tests/Type/IntListTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/IntListTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/IntToCombinedIntsListTypeTest.php b/core/lib/Thelia/Tests/Type/IntToCombinedIntsListTypeTest.php
index 9db5c96fd..015df3c37 100755
--- a/core/lib/Thelia/Tests/Type/IntToCombinedIntsListTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/IntToCombinedIntsListTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/IntToCombinedStringsListTypeTest.php b/core/lib/Thelia/Tests/Type/IntToCombinedStringsListTypeTest.php
index de308694f..c990e4bb3 100755
--- a/core/lib/Thelia/Tests/Type/IntToCombinedStringsListTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/IntToCombinedStringsListTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/IntTypeTest.php b/core/lib/Thelia/Tests/Type/IntTypeTest.php
index 7d39093dc..7f3144d27 100755
--- a/core/lib/Thelia/Tests/Type/IntTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/IntTypeTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tests/Type/JsonTypeTest.php b/core/lib/Thelia/Tests/Type/JsonTypeTest.php
index 1f4b0162b..a0f64986d 100755
--- a/core/lib/Thelia/Tests/Type/JsonTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/JsonTypeTest.php
@@ -1,26 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
-
namespace Thelia\Tests\Type;
use Thelia\Type\JsonType;
diff --git a/core/lib/Thelia/Tests/Type/TypeCollectionTest.php b/core/lib/Thelia/Tests/Type/TypeCollectionTest.php
index a1afb6889..6e16d2e90 100755
--- a/core/lib/Thelia/Tests/Type/TypeCollectionTest.php
+++ b/core/lib/Thelia/Tests/Type/TypeCollectionTest.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tests\Type;
diff --git a/core/lib/Thelia/Tools/DateTimeFormat.php b/core/lib/Thelia/Tools/DateTimeFormat.php
index 50c757536..f6a7139c4 100644
--- a/core/lib/Thelia/Tools/DateTimeFormat.php
+++ b/core/lib/Thelia/Tools/DateTimeFormat.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tools;
diff --git a/core/lib/Thelia/Tools/FileManager.php b/core/lib/Thelia/Tools/FileManager.php
index c3f02bcb8..351283d8c 100644
--- a/core/lib/Thelia/Tools/FileManager.php
+++ b/core/lib/Thelia/Tools/FileManager.php
@@ -1,25 +1,15 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
+
namespace Thelia\Tools;
use Symfony\Component\HttpFoundation\File\UploadedFile;
diff --git a/core/lib/Thelia/Tools/I18n.php b/core/lib/Thelia/Tools/I18n.php
index 9931f4087..57bf92e0b 100644
--- a/core/lib/Thelia/Tools/I18n.php
+++ b/core/lib/Thelia/Tools/I18n.php
@@ -1,25 +1,14 @@
. */
-/* */
-/**********************************************************************************/
+/*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
namespace Thelia\Tools;
diff --git a/core/lib/Thelia/Tools/Image.php b/core/lib/Thelia/Tools/Image.php
index 2558c9bd4..c3bfd07fa 100644
--- a/core/lib/Thelia/Tools/Image.php
+++ b/core/lib/Thelia/Tools/Image.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tools;
diff --git a/core/lib/Thelia/Tools/MoneyFormat.php b/core/lib/Thelia/Tools/MoneyFormat.php
index 11d3136d8..0fbfbca84 100644
--- a/core/lib/Thelia/Tools/MoneyFormat.php
+++ b/core/lib/Thelia/Tools/MoneyFormat.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tools;
diff --git a/core/lib/Thelia/Tools/NumberFormat.php b/core/lib/Thelia/Tools/NumberFormat.php
index b9f9bb7b5..21b86276f 100644
--- a/core/lib/Thelia/Tools/NumberFormat.php
+++ b/core/lib/Thelia/Tools/NumberFormat.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tools;
diff --git a/core/lib/Thelia/Tools/Password.php b/core/lib/Thelia/Tools/Password.php
index 8284136cc..c886337f2 100644
--- a/core/lib/Thelia/Tools/Password.php
+++ b/core/lib/Thelia/Tools/Password.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tools;
diff --git a/core/lib/Thelia/Tools/PhpUnitUtils.php b/core/lib/Thelia/Tools/PhpUnitUtils.php
deleted file mode 100644
index e60c22fe1..000000000
--- a/core/lib/Thelia/Tools/PhpUnitUtils.php
+++ /dev/null
@@ -1,56 +0,0 @@
-. */
-/* */
-/**********************************************************************************/
-
-namespace Thelia\Tools;
-
-/**
- * Created by JetBrains PhpStorm.
- * Date: 8/19/13
- * Time: 3:24 PM
- *
- * Helper for Unit Testing
- *
- * @package Coupon
- * @author Guillaume MOREL
- *
- */
-class PhpUnitUtils
-{
- /**
- * Allow to call a protected methods
- *
- * @param Object $obj Class name + namespace
- * @param string $name Method name
- * @param array $args Method arguments
- *
- * @return mixed protected method result
- */
- public static function callMethod($obj, $name, array $args)
- {
- $class = new \ReflectionClass(get_class($obj));
- $method = $class->getMethod($name);
- $method->setAccessible(true);
-
- return $method->invokeArgs($obj, $args);
- }
-}
diff --git a/core/lib/Thelia/Tools/Redirect.php b/core/lib/Thelia/Tools/Redirect.php
index 817cc6f33..faad58b2e 100644
--- a/core/lib/Thelia/Tools/Redirect.php
+++ b/core/lib/Thelia/Tools/Redirect.php
@@ -1,38 +1,33 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tools;
+use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Thelia\Log\Tlog;
class Redirect
{
- public static function exec($url, $status = 302)
+ public static function exec($url, $status = 302, $cookies = array())
{
if (false == Tlog::getInstance()->showRedirect($url)) {
$response = new RedirectResponse($url, $status);
-
+ foreach ($cookies as $cookie) {
+ if (!$cookie instanceof Cookie) {
+ throw new \InvalidArgumentException(sprintf('Third parameter is not a valid Cookie object.'));
+ }
+ $response->headers->setCookie($cookie);
+ }
$response->send();
}
}
diff --git a/core/lib/Thelia/Tools/Rest/ResponseRest.php b/core/lib/Thelia/Tools/Rest/ResponseRest.php
index 9df26e0d8..863b93447 100644
--- a/core/lib/Thelia/Tools/Rest/ResponseRest.php
+++ b/core/lib/Thelia/Tools/Rest/ResponseRest.php
@@ -1,5 +1,14 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Tools;
+use Symfony\Component\Routing\RequestContext;
use Thelia\Model\ConfigQuery;
use Thelia\Rewriting\RewritingResolver;
use Thelia\Rewriting\RewritingRetriever;
@@ -32,9 +22,13 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class URL
{
+ /** @var RewritingResolver $resolver */
protected $resolver = null;
+
+ /** @var RewritingRetriever $retriever */
protected $retriever = null;
+ /** @var RequestContext $requestContext */
protected $requestContext;
const PATH_TO_FILE = true;
@@ -42,10 +36,13 @@ class URL
protected static $instance = null;
+ /** @var string $baseUrlScheme a cache for the base URL scheme */
+ private $baseUrlScheme = null;
+
public function __construct(ContainerInterface $container = null)
{
- // Allow singleton style calls once intanciated.
- // For this to work, the URL service has to be instanciated very early. This is done manually
+ // Allow singleton style calls once instantiated.
+ // For this to work, the URL service has to be instantiated very early. This is done manually
// in TheliaHttpKernel, by calling $this->container->get('thelia.url.manager');
self::$instance = $this;
@@ -72,26 +69,34 @@ class URL
* Return the base URL, either the base_url defined in Config, or the URL
* of the current language, if 'one_domain_foreach_lang' is enabled.
*
+ * @param bool $scheme_only if true, only the scheme will be returned. If false, the complete base URL, including path, is returned.
+ *
* @return string the base URL, with a trailing '/'
*/
- public function getBaseUrl()
+ public function getBaseUrl($scheme_only = false)
{
- if ($host = $this->requestContext->getHost()) {
+ if (null === $this->baseUrlScheme) {
- $scheme = $this->requestContext->getScheme();
+ $scheme = "http";
+ $port = 80;
- $port = '';
+ if ($host = $this->requestContext->getHost()) {
- if ('http' === $scheme && 80 != $this->requestContext->getHttpPort()) {
- $port = ':'.$this->requestContext->getHttpPort();
- } elseif ('https' === $scheme && 443 != $this->requestContext->getHttpsPort()) {
- $port = ':'.$this->requestContext->getHttpsPort();
+ $scheme = $this->requestContext->getScheme();
+
+ $port = '';
+
+ if ('http' === $scheme && 80 != $this->requestContext->getHttpPort()) {
+ $port = ':'.$this->requestContext->getHttpPort();
+ } elseif ('https' === $scheme && 443 != $this->requestContext->getHttpsPort()) {
+ $port = ':'.$this->requestContext->getHttpsPort();
+ }
}
- $schemeAuthority = "$scheme://$host"."$port";
+ $this->baseUrlScheme = "$scheme://$host"."$port";
}
- return $schemeAuthority.$this->requestContext->getBaseUrl();
+ return $scheme_only ? $this->baseUrlScheme : $this->baseUrlScheme . $this->requestContext->getBaseUrl();
}
/**
@@ -119,17 +124,27 @@ class URL
// Already absolute ?
if (substr($path, 0, 4) != 'http') {
- $base_url = $this->getBaseUrl();
+ // Prevent duplication of the subdirectory name when Thelia is installed in a subdirectory.
+ // This happens when $path was calculated with Router::generate(), which returns an absolute URL,
+ // starting at web server root. For example, if Thelia is installed in /thelia2, we got something like /thelia2/my/path
+ // As base URL also contains /thelia2 (e.g. http://some.server.com/thelia2), we end up with
+ // http://some.server.com/thelia2/thelia2/my/path, instead of http://some.server.com/thelia2/my/path
+ // We have to compensate for this.
+ $rcbu = $this->requestContext->getBaseUrl();
+ $hasSubdirectory = ! empty($rcbu) && (0 === strpos($path, $rcbu));
+
+ $base_url = $this->getBaseUrl($hasSubdirectory);
+
+ /* Seems no longer required
// TODO fix this ugly patch
if (strpos($path, "index_dev.php")) {
$path = str_replace('index_dev.php', '', $path);
}
+ */
// If only a path is requested, be sure to remove the script name (index.php or index_dev.php), if any.
if ($path_only == self::PATH_TO_FILE) {
-
- // As the base_url always ends with '/', if we don't find / at the end, we have a script.
if (substr($base_url, -3) == 'php') $base_url = dirname($base_url);
}
diff --git a/core/lib/Thelia/Type/AlphaNumStringListType.php b/core/lib/Thelia/Type/AlphaNumStringListType.php
index 474a615db..d40175c4f 100644
--- a/core/lib/Thelia/Type/AlphaNumStringListType.php
+++ b/core/lib/Thelia/Type/AlphaNumStringListType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/AlphaNumStringType.php b/core/lib/Thelia/Type/AlphaNumStringType.php
index db788d4d6..039f97957 100644
--- a/core/lib/Thelia/Type/AlphaNumStringType.php
+++ b/core/lib/Thelia/Type/AlphaNumStringType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/AnyType.php b/core/lib/Thelia/Type/AnyType.php
index 4e844c6e9..ddf2139ef 100644
--- a/core/lib/Thelia/Type/AnyType.php
+++ b/core/lib/Thelia/Type/AnyType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/BaseType.php b/core/lib/Thelia/Type/BaseType.php
index 79a859632..0aa1b0545 100644
--- a/core/lib/Thelia/Type/BaseType.php
+++ b/core/lib/Thelia/Type/BaseType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
use Symfony\Component\Validator\ExecutionContextInterface;
diff --git a/core/lib/Thelia/Type/BooleanOrBothType.php b/core/lib/Thelia/Type/BooleanOrBothType.php
index 25f3d9994..dea41e7a1 100644
--- a/core/lib/Thelia/Type/BooleanOrBothType.php
+++ b/core/lib/Thelia/Type/BooleanOrBothType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/BooleanType.php b/core/lib/Thelia/Type/BooleanType.php
index 5f36453de..05be70bbd 100644
--- a/core/lib/Thelia/Type/BooleanType.php
+++ b/core/lib/Thelia/Type/BooleanType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/EnumListType.php b/core/lib/Thelia/Type/EnumListType.php
index 5b54c48bf..99e7599b1 100644
--- a/core/lib/Thelia/Type/EnumListType.php
+++ b/core/lib/Thelia/Type/EnumListType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/EnumType.php b/core/lib/Thelia/Type/EnumType.php
index 1283acde0..600842ec8 100644
--- a/core/lib/Thelia/Type/EnumType.php
+++ b/core/lib/Thelia/Type/EnumType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/FloatToFloatArrayType.php b/core/lib/Thelia/Type/FloatToFloatArrayType.php
index 08a310ef0..3628d5049 100644
--- a/core/lib/Thelia/Type/FloatToFloatArrayType.php
+++ b/core/lib/Thelia/Type/FloatToFloatArrayType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/FloatType.php b/core/lib/Thelia/Type/FloatType.php
index 830622a86..634731193 100644
--- a/core/lib/Thelia/Type/FloatType.php
+++ b/core/lib/Thelia/Type/FloatType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/IntListType.php b/core/lib/Thelia/Type/IntListType.php
index 5fe31aa3c..d52ff2d83 100644
--- a/core/lib/Thelia/Type/IntListType.php
+++ b/core/lib/Thelia/Type/IntListType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/IntToCombinedIntsListType.php b/core/lib/Thelia/Type/IntToCombinedIntsListType.php
index 777759bca..2574c9159 100644
--- a/core/lib/Thelia/Type/IntToCombinedIntsListType.php
+++ b/core/lib/Thelia/Type/IntToCombinedIntsListType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/IntToCombinedStringsListType.php b/core/lib/Thelia/Type/IntToCombinedStringsListType.php
index 017c60191..3d7066d45 100644
--- a/core/lib/Thelia/Type/IntToCombinedStringsListType.php
+++ b/core/lib/Thelia/Type/IntToCombinedStringsListType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/IntType.php b/core/lib/Thelia/Type/IntType.php
index 5aa146e60..a7e4aa042 100644
--- a/core/lib/Thelia/Type/IntType.php
+++ b/core/lib/Thelia/Type/IntType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/JsonType.php b/core/lib/Thelia/Type/JsonType.php
index 502a43953..c00661fbd 100644
--- a/core/lib/Thelia/Type/JsonType.php
+++ b/core/lib/Thelia/Type/JsonType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/ModelType.php b/core/lib/Thelia/Type/ModelType.php
index a8ab8c553..e2bb1d896 100644
--- a/core/lib/Thelia/Type/ModelType.php
+++ b/core/lib/Thelia/Type/ModelType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
diff --git a/core/lib/Thelia/Type/ModelValidIdType.php b/core/lib/Thelia/Type/ModelValidIdType.php
index b3579a51a..e3419fdd2 100644
--- a/core/lib/Thelia/Type/ModelValidIdType.php
+++ b/core/lib/Thelia/Type/ModelValidIdType.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
use Propel\Runtime\ActiveQuery\ModelCriteria;
diff --git a/core/lib/Thelia/Type/TypeCollection.php b/core/lib/Thelia/Type/TypeCollection.php
index 2ee5c9c66..16668b5a6 100644
--- a/core/lib/Thelia/Type/TypeCollection.php
+++ b/core/lib/Thelia/Type/TypeCollection.php
@@ -1,25 +1,15 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
+
namespace Thelia\Type;
/**
diff --git a/core/lib/Thelia/Type/TypeInterface.php b/core/lib/Thelia/Type/TypeInterface.php
index 99e2f77e0..8f8839bc1 100644
--- a/core/lib/Thelia/Type/TypeInterface.php
+++ b/core/lib/Thelia/Type/TypeInterface.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 7e9341bf4..5607438d1 100644
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -109,9 +109,9 @@
-
-
-
+
+
+
@@ -161,11 +161,11 @@
-
-
-
-
-
+
+
+
+
+
+
+
+{/elseloop}
diff --git a/local/modules/Colissimo/Colissimo.php b/local/modules/Colissimo/Colissimo.php
index 90d32df35..f343df269 100755
--- a/local/modules/Colissimo/Colissimo.php
+++ b/local/modules/Colissimo/Colissimo.php
@@ -1,39 +1,28 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************/
/*************************************************************************************/
namespace Colissimo;
use Colissimo\Model\ColissimoFreeshippingQuery;
use Propel\Runtime\Connection\ConnectionInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\HttpFoundation\Request;
+use Thelia\Core\Translation\Translator;
use Thelia\Exception\OrderException;
use Thelia\Install\Database;
use Thelia\Model\Country;
-use Thelia\Module\BaseModule;
-use Thelia\Module\DeliveryModuleInterface;
+use Thelia\Module\AbstractDeliveryModule;
+use Thelia\Module\Exception\DeliveryException;
-class Colissimo extends BaseModule implements DeliveryModuleInterface
+class Colissimo extends AbstractDeliveryModule
{
protected $request;
protected $dispatcher;
@@ -42,15 +31,42 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
const JSON_PRICE_RESOURCE = "/Config/prices.json";
+ const MESSAGE_DOMAIN = 'colissimo';
+
public static function getPrices()
{
- if(null === self::$prices) {
+ if (null === self::$prices) {
self::$prices = json_decode(file_get_contents(sprintf('%s%s', __DIR__, self::JSON_PRICE_RESOURCE)), true);
}
return self::$prices;
}
+ public function isValidDelivery(Country $country) {
+
+ $areaId = $country->getAreaId();
+
+ $prices = self::getPrices();
+
+ /* Check if Colissimo delivers the area */
+ if (isset($prices[$areaId]) && isset($prices[$areaId]["slices"])) {
+
+ // Yes ! Check if the cart weight is below slice limit
+ $areaPrices = $prices[$areaId]["slices"];
+ ksort($areaPrices);
+
+ /* Check cart weight is below the maximum weight */
+ end($areaPrices);
+ $maxWeight = key($areaPrices);
+
+ $cartWeight = $this->getRequest()->getSession()->getCart()->getWeight();
+
+ if ($cartWeight <= $maxWeight) return true;
+ }
+
+ return false;
+ }
+
/**
* @param $areaId
* @param $weight
@@ -61,29 +77,37 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
public static function getPostageAmount($areaId, $weight)
{
$freeshipping = ColissimoFreeshippingQuery::create()->getLast();
- $postage=0;
- if(!$freeshipping) {
+ $postage = 0;
+ if (!$freeshipping) {
$prices = self::getPrices();
/* check if Colissimo delivers the asked area */
- if(!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) {
- throw new OrderException("Colissimo delivery unavailable for the chosen delivery country", OrderException::DELIVERY_MODULE_UNAVAILABLE);
+ if (!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) {
+ throw new DeliveryException(
+ Translator::getInstance()->trans("Colissimo delivery unavailable for the delivery country", [], self::MESSAGE_DOMAIN)
+ );
}
$areaPrices = $prices[$areaId]["slices"];
ksort($areaPrices);
- /* check this weight is not too much */
+ /* Check cart weight is below the maximum weight */
end($areaPrices);
$maxWeight = key($areaPrices);
- if($weight > $maxWeight) {
- throw new OrderException(sprintf("Colissimo delivery unavailable for this cart weight (%s kg)", $weight), OrderException::DELIVERY_MODULE_UNAVAILABLE);
+ if ($weight > $maxWeight) {
+ throw new DeliveryException(
+ Translator::getInstance()->trans(
+ "Colissimo delivery unavailable for this cart weight (%weight kg)",
+ array("%weight" => $weight),
+ self::MESSAGE_DOMAIN
+ )
+ );
}
$postage = current($areaPrices);
- while(prev($areaPrices)) {
- if($weight > key($areaPrices)) {
+ while (prev($areaPrices)) {
+ if ($weight > key($areaPrices)) {
break;
}
@@ -94,29 +118,9 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
}
- public function setRequest(Request $request)
- {
- $this->request = $request;
- }
-
- public function getRequest()
- {
- return $this->request;
- }
-
- public function setDispatcher(EventDispatcherInterface $dispatcher)
- {
- $this->dispatcher = $dispatcher;
- }
-
- public function getDispatcher()
- {
- return $this->dispatcher;
- }
-
public function postActivation(ConnectionInterface $con = null)
{
- $database = new Database($con->getWrappedConnection());
+ $database = new Database($con);
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
}
@@ -131,7 +135,7 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
*/
public function getPostage(Country $country)
{
- $cartWeight = $this->getContainer()->get('request')->getSession()->getCart()->getWeight();
+ $cartWeight = $this->getRequest()->getSession()->getCart()->getWeight();
$postage = self::getPostageAmount(
$country->getAreaId(),
@@ -140,10 +144,4 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
return $postage;
}
-
- public function getCode()
- {
- return 'Colissimo';
- }
-
-}
+}
\ No newline at end of file
diff --git a/local/modules/Colissimo/Config/config.xml b/local/modules/Colissimo/Config/config.xml
index eb0ec4aa2..420bc821c 100755
--- a/local/modules/Colissimo/Config/config.xml
+++ b/local/modules/Colissimo/Config/config.xml
@@ -7,10 +7,12 @@
+
+
diff --git a/local/modules/Colissimo/Config/module.xml b/local/modules/Colissimo/Config/module.xml
index 1f47ad9c9..b05f70d7f 100755
--- a/local/modules/Colissimo/Config/module.xml
+++ b/local/modules/Colissimo/Config/module.xml
@@ -1,18 +1,18 @@
-
-
- Colissimo\Colissimo
-
- colisimo
-
-
- colisimo
-
- 1.0
-
- Manuel Raynaud
- mraynaud@openstudio.fr
-
- delivery
- 2.0.0
- alpha
-
+
+
+ Colissimo\Colissimo
+
+ Colissimo delivery
+
+
+ Livraison par Colissimo
+
+ 1.0
+
+ Manuel Raynaud
+ mraynaud@openstudio.fr
+
+ delivery
+ 2.0.0
+ alpha
+
diff --git a/local/modules/Colissimo/Config/prices.json b/local/modules/Colissimo/Config/prices.json
index 3fc2e0cd7..1b23c825c 100755
--- a/local/modules/Colissimo/Config/prices.json
+++ b/local/modules/Colissimo/Config/prices.json
@@ -1 +1,120 @@
-{"1":{"_info":"area 1 : France","slices":{"0.25":"5.23","0.5":5.8,"0.75":6.56,"1":7.13,"2":8.08,"3":9.22,"5":11.31,"7":13.4,"10":16.53,"15":19.14,"30":26.93}},"2":{"_info":"area 2 : A Zone - Union Europ\u00e9enne et Suisse","slices":{"1":15.34,"2":16.96,"3":20.47,"4":23.99,"5":27.5,"6":31.02,"7":34.53,"8":38.05,"9":41.56,"10":45.08,"15":51.92,"20":58.76,"25":65.6,"30":72.44}},"3":{"_info":"area 3 : B Zone - Pays de l\u2019Europe de l\u2019Est (hors Union Europ\u00e9enne), Norv\u00e8ge, Maghreb","slices":{"1":18.81,"2":20.62,"3":24.94,"4":29.26,"5":33.58,"6":37.91,"7":42.23,"8":46.55,"9":50.87,"10":55.2,"15":65.08,"20":74.96}},"4":{"_info":"area 4 : C Zone - Pays d\u2019Afrique hors Maghreb, Canada, Etats-Unis, Proche et Moyen Orient","slices":{"1":22.04,"2":29.55,"3":38.86,"4":48.17,"5":57.48,"6":66.79,"7":76.1,"8":85.41,"9":94.72,"10":104.03,"15":126.92,"20":149.82}},"5":{"_info":"area 5 : D Zone - Autres destinations","slices":{"1":25.08,"2":37.72,"3":50.26,"4":62.8,"5":75.34,"6":87.88,"7":100.42,"8":112.96,"9":125.5,"10":138.04,"15":162.74,"20":187.44}},"6":{"_info":"area 6 : France OM1","slices":{"0.5":8.27,"1":12.49,"2":17.05,"3":21.61,"4":26.17,"5":30.73,"6":35.29,"7":39.85,"8":44.41,"9":48.97,"10":53.53,"15":76.33,"20":99.13,"25":121.93,"30":144.73}},"7":{"_info":"area 7 : France OM2","slices":{"0.5":9.88,"1":14.92,"2":26.32,"3":37.72,"4":49.12,"5":60.52,"6":71.92,"7":83.32,"8":94.72,"9":106.12,"10":117.52,"15":174.52,"20":231.52,"25":288.52,"30":345.52}}}
\ No newline at end of file
+{"1": {
+ "_info": "area 1 : France",
+ "slices": {
+ "0.25": "5.23",
+ "0.5": 5.8,
+ "0.75": 6.56,
+ "1": 7.13,
+ "2": 8.08,
+ "3": 9.22,
+ "5": 11.31,
+ "7": 13.4,
+ "10": 16.53,
+ "15": 19.14,
+ "30": 26.93
+ }
+}, "2": {
+ "_info": "area 2 : A Zone - Union Europ\u00e9enne et Suisse",
+ "slices": {
+ "1": 15.34,
+ "2": 16.96,
+ "3": 20.47,
+ "4": 23.99,
+ "5": 27.5,
+ "6": 31.02,
+ "7": 34.53,
+ "8": 38.05,
+ "9": 41.56,
+ "10": 45.08,
+ "15": 51.92,
+ "20": 58.76,
+ "25": 65.6,
+ "30": 72.44
+ }
+}, "3": {
+ "_info": "area 3 : B Zone - Pays de l\u2019Europe de l\u2019Est (hors Union Europ\u00e9enne), Norv\u00e8ge, Maghreb",
+ "slices": {
+ "1": 18.81,
+ "2": 20.62,
+ "3": 24.94,
+ "4": 29.26,
+ "5": 33.58,
+ "6": 37.91,
+ "7": 42.23,
+ "8": 46.55,
+ "9": 50.87,
+ "10": 55.2,
+ "15": 65.08,
+ "20": 74.96
+ }
+}, "4": {
+ "_info": "area 4 : C Zone - Pays d\u2019Afrique hors Maghreb, Canada, Etats-Unis, Proche et Moyen Orient",
+ "slices": {
+ "1": 22.04,
+ "2": 29.55,
+ "3": 38.86,
+ "4": 48.17,
+ "5": 57.48,
+ "6": 66.79,
+ "7": 76.1,
+ "8": 85.41,
+ "9": 94.72,
+ "10": 104.03,
+ "15": 126.92,
+ "20": 149.82
+ }
+}, "5": {
+ "_info": "area 5 : D Zone - Autres destinations",
+ "slices": {
+ "1": 25.08,
+ "2": 37.72,
+ "3": 50.26,
+ "4": 62.8,
+ "5": 75.34,
+ "6": 87.88,
+ "7": 100.42,
+ "8": 112.96,
+ "9": 125.5,
+ "10": 138.04,
+ "15": 162.74,
+ "20": 187.44
+ }
+}, "6": {
+ "_info": "area 6 : France OM1",
+ "slices": {
+ "0.5": 8.27,
+ "1": 12.49,
+ "2": 17.05,
+ "3": 21.61,
+ "4": 26.17,
+ "5": 30.73,
+ "6": 35.29,
+ "7": 39.85,
+ "8": 44.41,
+ "9": 48.97,
+ "10": 53.53,
+ "15": 76.33,
+ "20": 99.13,
+ "25": 121.93,
+ "30": 144.73
+ }
+}, "7": {
+ "_info": "area 7 : France OM2",
+ "slices": {
+ "0.5": 9.88,
+ "1": 14.92,
+ "2": 26.32,
+ "3": 37.72,
+ "4": 49.12,
+ "5": 60.52,
+ "6": 71.92,
+ "7": 83.32,
+ "8": 94.72,
+ "9": 106.12,
+ "10": 117.52,
+ "15": 174.52,
+ "20": 231.52,
+ "25": 288.52,
+ "30": 345.52
+ }
+}}
\ No newline at end of file
diff --git a/local/modules/Colissimo/Config/routing.xml b/local/modules/Colissimo/Config/routing.xml
index 68fc231af..54fa8977e 100755
--- a/local/modules/Colissimo/Config/routing.xml
+++ b/local/modules/Colissimo/Config/routing.xml
@@ -10,4 +10,8 @@
Colissimo\Controller\FreeShipping::set
+
+
+ Colissimo\Controller\Export::exportAction
+
diff --git a/local/modules/Colissimo/Config/thelia.sql b/local/modules/Colissimo/Config/thelia.sql
index 4764a7244..6c690d3fe 100755
--- a/local/modules/Colissimo/Config/thelia.sql
+++ b/local/modules/Colissimo/Config/thelia.sql
@@ -1,50 +1,50 @@
-
-# This is a fix for InnoDB in MySQL >= 4.1.x
-# It "suspends judgement" for fkey relationships until are tables are set.
-SET FOREIGN_KEY_CHECKS = 0;
-
--- ---------------------------------------------------------------------
--- colissimo_freeshipping
--- ---------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `colissimo_freeshipping`;
-
-CREATE TABLE `colissimo_freeshipping`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `active` TINYINT(1) NOT NULL,
- `created_at` DATETIME,
- `updated_at` DATETIME,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB;
-
-INSERT INTO `colissimo_freeshipping`(`active`, `created_at`, `updated_at`) VALUES (0, NOW(), NOW());
-
--- ---------------------------------------------------------------------
--- Mail templates for colissimo
--- ---------------------------------------------------------------------
--- First, delete existing entries
-SET @var := 0;
-SELECT @var := `id` FROM `message` WHERE name="mail_colissimo";
-DELETE FROM `message` WHERE `id`=@var;
--- Try if ON DELETE constraint isn't set
-DELETE FROM `message_i18n` WHERE `id`=@var;
-
--- Then add new entries
-SELECT @max := MAX(`id`) FROM `message`;
-SET @max := @max+1;
--- insert message
-INSERT INTO `message` (`id`, `name`, `secured`) VALUES
-(@max,
-'mail_colissimo',
-'0'
-);
-
--- and template fr_FR
-INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES
-(@max, 'fr_FR', 'mail livraison colissimo', 'Suivi colissimo commande : {$order_ref}', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de Colissimo Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de Colissimo Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de Colissimo Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de Colissimo Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement');
-
-
-
-# This restores the fkey checks, after having unset them earlier
-SET FOREIGN_KEY_CHECKS = 1;
+
+# This is a fix for InnoDB in MySQL >= 4.1.x
+# It "suspends judgement" for fkey relationships until are tables are set.
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ---------------------------------------------------------------------
+-- colissimo_freeshipping
+-- ---------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `colissimo_freeshipping`;
+
+CREATE TABLE `colissimo_freeshipping`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `active` TINYINT(1) NOT NULL,
+ `created_at` DATETIME,
+ `updated_at` DATETIME,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB;
+
+INSERT INTO `colissimo_freeshipping`(`active`, `created_at`, `updated_at`) VALUES (0, NOW(), NOW());
+
+-- ---------------------------------------------------------------------
+-- Mail templates for colissimo
+-- ---------------------------------------------------------------------
+
+-- First, delete existing entries
+SET @var := 0;
+SELECT @var := `id` FROM `message` WHERE name="mail_colissimo";
+DELETE FROM `message` WHERE `id`=@var;
+-- Try if ON DELETE constraint isn't set
+DELETE FROM `message_i18n` WHERE `id`=@var;
+
+-- Then add new entries
+SELECT @max := MAX(`id`) FROM `message`;
+SET @max := @max+1;
+-- insert message
+INSERT INTO `message` (`id`, `name`, `secured`) VALUES
+(@max,
+'mail_colissimo',
+'0'
+);
+
+-- and template fr_FR
+INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES
+(@max, 'en_US', 'Colissimo shipping message', 'Your order {$order_ref} has been shipped', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\nDear {$FIRSTNAME} {$LASTNAME},\r\n{/loop}\r\nThank you for your order on our online store {config key="store_name"}.\r\nYour order {$order_ref} dated {format_date date=$order_date} has been shipped on {format_date date=$update_date}.\r\nThe tracking number for this delivery is {$package}. Please check the La Poste website for tracking your parcel: www.coliposte.net.\r\nYou can use this tracking number to get your parcel in your local La Poste office. If don''t get an advice in your mailbox after two working days, claim your parcel at your local La Poste office, using this tracking number.\r\nFeel free to contact us for any forther information\r\nBest Regards.', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n
Dear {$FIRSTNAME} {$LASTNAME},
\r\n{/loop}\r\n
Thank you for your order on our online store {config key="store_name"}.
\r\n
Your order {$order_ref} dated {format_date date=$order_date} has been shipped on {format_date date=$update_date}.\r\nThe tracking number for this delivery is {$package}. Please check the La Poste website for tracking your parcel: www.coliposte.net.
\r\n
You can use this tracking number to get your parcel in your local La Poste office. If don''t get an advice in your mailbox after two working days, claim your parcel at your local La Poste office, using this tracking number.
\r\n
Feel free to contact us for any forther information
\r\n
Best Regards.
'),
+(@max, 'fr_FR', 'Message d''expédition de colissimo', 'Suivi colissimo commande : {$order_ref}', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de Colissimo Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de Colissimo Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de Colissimo Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de Colissimo Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement');
+
+# This restores the fkey checks, after having unset them earlier
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/local/modules/Colissimo/Controller/EditPrices.php b/local/modules/Colissimo/Controller/EditPrices.php
index 989ed7d68..e732a4fd3 100755
--- a/local/modules/Colissimo/Controller/EditPrices.php
+++ b/local/modules/Colissimo/Controller/EditPrices.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Colissimo\Controller;
diff --git a/local/modules/Colissimo/Controller/Export.php b/local/modules/Colissimo/Controller/Export.php
new file mode 100644
index 000000000..98386f50c
--- /dev/null
+++ b/local/modules/Colissimo/Controller/Export.php
@@ -0,0 +1,158 @@
+
+ */
+class Export extends BaseAdminController
+{
+ const DEFAULT_PHONE = "0100000000";
+ const DEFAULT_CELLPHONE = "0600000000";
+
+ public function exportAction()
+ {
+ if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('Colissimo'), AccessManager::UPDATE)) {
+ return $response;
+ }
+
+ $form = new FormExport($this->getRequest());
+
+ try {
+ $exportForm = $this->validateForm($form);
+
+ $status_id = $exportForm->get('status_id')->getData();
+
+ $status = OrderStatusQuery::create()
+ ->filterByCode($status_id)
+ ->findOne();
+
+ $orders = ColissimoQuery::getOrders()
+ ->find();
+
+ $export = "";
+ $store_name = ConfigQuery::read("store_name");
+ /** @var $order \Thelia\Model\Order */
+ foreach ($orders as $order) {
+
+ $value = $exportForm->get('order_'.$order->getId())->getData();
+
+ if ($value) {
+
+ $customer = $order->getCustomer();
+ $locale = $order->getLang()->getLocale();
+ $address = $order->getOrderAddressRelatedByDeliveryOrderAddressId();
+ $country = CountryQuery::create()->findPk($address->getCountryId());
+ $country->setLocale($locale);
+ $customerTitle = CustomerTitleQuery::create()->findPk($address->getCustomerTitleId());
+ $customerTitle->setLocale($locale);
+
+ /**
+ * Get user's phone & cellphone
+ * First get invoice address phone,
+ * If empty, try to get default address' phone.
+ * If still empty, set default value
+ */
+ $phone = $address->getPhone();
+ if (empty($phone)) {
+ $phone = $customer->getDefaultAddress()->getPhone();
+
+ if (empty($phone)) {
+ $phone = self::DEFAULT_PHONE;
+ }
+ }
+
+ /**
+ * Cellp
+ */
+ $cellphone = $customer->getDefaultAddress()->getCellphone();
+
+ if (empty($cellphone)) {
+ $cellphone = $customer->getDefaultAddress()->getCellphone();
+
+ if (empty($cellphone)) {
+ $cellphone = self::DEFAULT_CELLPHONE;
+ }
+ }
+
+ /**
+ * Compute package weight
+ */
+ $weight = 0;
+ /** @var \Thelia\Model\OrderProduct $product */
+ foreach ($order->getOrderProducts() as $product) {
+ $weight+=(double) $product->getWeight();
+ }
+
+ $export .= "\"".$order->getRef()."\";\"".$address->getLastname()."\";\"".$address->getFirstname()."\";\"".$address->getAddress1()."\";\"".$address->getAddress2()."\";\"".$address->getAddress3()."\";\"".$address->getZipcode()."\";\"".$address->getCity()."\";\"".$country->getTitle()."\";\"".$phone."\";\"".$cellphone."\";\"".$weight."\";\"\";\"\";\"".$store_name."\";\"DOM\";\r\n";
+
+ if ($status) {
+ $event = new OrderEvent($order);
+ $event->setStatus($status->getId());
+ $this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
+ }
+
+
+ }
+
+ }
+
+ return Response::create(
+ $export,
+ 200,
+ array(
+ "Content-Type"=>"application/csv-tab-delimited-table",
+ "Content-disposition"=>"filename=export.csv"
+ )
+ );
+
+ } catch (FormValidationException $e) {
+ $this->setupFormErrorContext(
+ Translator::getInstance()->trans("colissimo expeditor export", [], Colissimo::MESSAGE_DOMAIN),
+ $e->getMessage(),
+ $form,
+ $e
+ );
+
+ return $this->render(
+ "module-configure",
+ array(
+ "module_code" => "Colissimo",
+ )
+ );
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/local/modules/Colissimo/Controller/FreeShipping.php b/local/modules/Colissimo/Controller/FreeShipping.php
index 040b9f75a..a8f5f334d 100644
--- a/local/modules/Colissimo/Controller/FreeShipping.php
+++ b/local/modules/Colissimo/Controller/FreeShipping.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Colissimo\Controller;
diff --git a/local/modules/Colissimo/Form/Export.php b/local/modules/Colissimo/Form/Export.php
new file mode 100644
index 000000000..006c8c2c0
--- /dev/null
+++ b/local/modules/Colissimo/Form/Export.php
@@ -0,0 +1,101 @@
+
+ */
+class Export extends BaseForm
+{
+
+ /**
+ *
+ * in this function you add all the fields you need for your Form.
+ * Form this you have to call add method on $this->formBuilder attribute :
+ *
+ * $this->formBuilder->add("name", "text")
+ * ->add("email", "email", array(
+ * "attr" => array(
+ * "class" => "field"
+ * ),
+ * "label" => "email",
+ * "constraints" => array(
+ * new \Symfony\Component\Validator\Constraints\NotBlank()
+ * )
+ * )
+ * )
+ * ->add('age', 'integer');
+ *
+ * @return null
+ */
+ protected function buildForm()
+ {
+ $orders = ColissimoQuery::getOrders()
+ ->find();
+
+ $this->formBuilder
+ ->add('status_id', 'text',[
+ 'constraints' => [
+ new NotBlank(),
+ new Callback(array(
+ "methods" => array(
+ array($this,
+ "verifyValue")
+ )
+ ))
+ ],
+ 'label' => Translator::getInstance()->trans('Modify status export after export', [], Colissimo::MESSAGE_DOMAIN),
+ 'label_attr' => [
+ 'for' => 'status_id'
+ ]
+ ]);
+
+ /** @var \Thelia\Model\Order $order */
+ foreach ($orders as $order) {
+ $this->formBuilder->add("order_".$order->getId(), "checkbox", array(
+ 'label'=>$order->getRef(),
+ 'label_attr'=>array('for'=>'export_'.$order->getId())
+ ));
+ }
+ }
+
+ public function verifyValue($value, ExecutionContextInterface $context)
+ {
+ if (!preg_match("#^nochange|processing|sent$#",$value)) {
+ $context->addViolation(Translator::getInstance()->trans('select a valid status', [], Colissimo::MESSAGE_DOMAIN));
+ }
+ }
+
+ /**
+ * @return string the name of you form. This name must be unique
+ */
+ public function getName()
+ {
+ return "colissimo_export";
+ }
+}
\ No newline at end of file
diff --git a/local/modules/Colissimo/Form/FreeShipping.php b/local/modules/Colissimo/Form/FreeShipping.php
index 87465c6a6..38f567d26 100644
--- a/local/modules/Colissimo/Form/FreeShipping.php
+++ b/local/modules/Colissimo/Form/FreeShipping.php
@@ -1,29 +1,19 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Colissimo\Form;
+use Colissimo\Colissimo;
use Colissimo\Model\ColissimoFreeshippingQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
@@ -55,7 +45,7 @@ class FreeShipping extends BaseForm {
$this->formBuilder
->add("freeshipping", "checkbox", array(
'data'=>$freeshipping,
- 'label'=>Translator::getInstance()->trans("Activate free shipping: ")
+ 'label'=>Translator::getInstance()->trans("Activate free shipping: ", [], Colissimo::MESSAGE_DOMAIN)
))
;
}
diff --git a/local/modules/Colissimo/I18n/AdminIncludes/fr_FR.php b/local/modules/Colissimo/I18n/AdminIncludes/fr_FR.php
new file mode 100644
index 000000000..4bd2a4bdc
--- /dev/null
+++ b/local/modules/Colissimo/I18n/AdminIncludes/fr_FR.php
@@ -0,0 +1,33 @@
+ '* Si vous choisissez cette option, les commandes exportées ne seront plus affichée sur cette page.',
+ 'Actions' => 'Actions',
+ 'An error occured' => 'Une erreur est survenue',
+ 'Area : ' => 'Zone de livraison : ',
+ 'Cancel' => 'Annuler',
+ 'Change orders status after export' => 'Modification du statut des commande après l\'export',
+ 'Colissimo Module allows to send your products all around the world with La Poste.' => 'Colissimo vous permet d’expédier vos colis dans le monde entier avec La Poste',
+ 'Create' => 'Créer',
+ 'Create a new price slice' => 'Créer une nouvelle tranche de prix',
+ 'Create a price slice' => 'Créer une tranche de prix',
+ 'Date' => 'Date',
+ 'Delete' => 'Supprimer',
+ 'Delete a price slice' => 'Supprimer une tranche de prix',
+ 'Delete this price slice' => 'Supprimer cette tranche de prix',
+ 'Do not change' => 'Ne pas modifier',
+ 'Do you really want to delete this slice ?' => 'Confirmez-vous la suppression de cette tranche de prix',
+ 'Edit' => 'Modifier',
+ 'Edit a price slice' => 'Modifier une tranche de prix',
+ 'Edit this price slice' => 'Modifier cette tranche de prix',
+ 'Export' => 'Export',
+ 'Export expeditor inet file' => 'Exporter le fichier Expeditor INET',
+ 'Please change the access rights' => 'Merci de modifier les droits d\'accès',
+ 'Price (€)' => 'Price (€)',
+ 'Price slices' => 'Prix et poids',
+ 'Processing' => 'Traitement',
+ 'REF' => 'REF',
+ 'Sent' => 'Envoyé',
+ 'Total taxed amount' => 'Total TTC',
+ 'Weight up to ... (kg)' => 'Jusqu\'au poids (Kg)',
+);
diff --git a/local/modules/Colissimo/I18n/en_US.php b/local/modules/Colissimo/I18n/en_US.php
index 59dc5c33b..f49a9f1df 100644
--- a/local/modules/Colissimo/I18n/en_US.php
+++ b/local/modules/Colissimo/I18n/en_US.php
@@ -1,22 +1,12 @@
'Can\'t read Config directory',
- 'Can\'t write Config directory'=>'Can\'t write Config directory',
- 'Can\'t read file'=>'Can\'t read file',
- 'Can\'t write file'=>'Can\'t write file',
- 'Please change the access rights'=>'Please change the access rights',
- 'Colissimo Module allows to send your products all around the world with La Poste.'=>'Colissimo Module allows to send your products all around the world with La Poste.',
- 'Create a price slice'=>'Create a price slice',
- 'Weight up to ... (kg)'=>'Weight up to ... (kg)',
- 'Price ('=>'Price (',
- 'Create'=>'Create',
- 'Cancel'=>'Cancel',
- 'Area '=>'Area ',
- 'Actions'=>'Actions',
- 'Edit a price slice'=>'Edit a price slice',
- 'Edit'=>'Edit',
- 'Delete a price slice'=>'Delete a price slice',
- 'Do you really want to delete this slice '=>'Do you really want to delete this slice ',
- 'Delete'=>'Delete',
- 'Activate free shipping: '=>'Activate free shipping: ',
- );
\ No newline at end of file
+
+return array(
+ 'Activate free shipping: ' => 'Activate free shipping: ',
+ 'Can\'t read Config directory' => 'Can\'t read Config directory',
+ 'Can\'t read file' => 'Can\'t read file',
+ 'Can\'t write Config directory' => 'Can\'t write Config directory',
+ 'Can\'t write file' => 'Can\'t write file',
+ 'Modify status export after export' => 'Change orders status after export',
+ 'colissimo expeditor export' => 'Colissimo Expeditor export',
+ 'select a valid status' => 'Select a valid order status',
+);
diff --git a/local/modules/Colissimo/I18n/fr_FR.php b/local/modules/Colissimo/I18n/fr_FR.php
index e85e6a8e4..89d222656 100644
--- a/local/modules/Colissimo/I18n/fr_FR.php
+++ b/local/modules/Colissimo/I18n/fr_FR.php
@@ -1,22 +1,14 @@
'Le dossier Config ne peut être lu',
- 'Can\'t write Config directory'=>'Le dossier Config ne peut être écrit',
- 'Can\'t read file'=>'Le fichier suivant ne peut être lu',
- 'Can\'t write file'=>'Le fichier suivant ne peut être écrit',
- 'Please change the access rights'=>'Veuillez changer les droits d\'accès',
- 'Colissimo Module allows to send your products all around the world with La Poste.'=>'Le module Colissimo vous permet d\'envoyer des colis dans le monde entier avec La Poste.',
- 'Create a price slice' => 'Créer une tranche de prix',
- 'Weight up to ... (kg)'=>'Poids ... (kg)',
- 'Price (€)'=>'Prix (€)',
- 'Create'=>'Créer',
- 'Cancel'=>'Annuler',
- 'Area : '=>'Zone de livraison : ',
- 'Actions'=>'Actions',
- 'Edit'=>'Modifer',
- 'Edit a price slice' => 'Modifier une tranche de prix',
- 'Delete a price slice' => 'Supprimer une tranche de prix',
- 'Do you really want to delete this slice ?'=>'Voulez-vous réellement supprimer cette tranche de prix ?',
- 'Delete'=>'Supprimer',
- 'Activate free shipping: '=>'Livraison offerte: ',
- );
\ No newline at end of file
+
+return array(
+ 'Activate free shipping: ' => 'Activer la livraison offerte: ',
+ 'Can\'t read Config directory' => 'Le dossier Config ne peut être lu',
+ 'Can\'t read file' => 'Le fichier suivant ne peut être lu',
+ 'Can\'t write Config directory' => 'Le dossier Config ne peut être écrit',
+ 'Can\'t write file' => 'Le fichier suivant ne peut être écrit',
+ 'Colissimo delivery unavailable for the delivery country' => 'La livraison par Colissimo n\'est pas disponible dans ce pays',
+ 'Colissimo delivery unavailable for this cart weight (%weight kg)' => 'La livraison par Colissimo n\'est pas disponible pour un panier de %weight Kg',
+ 'Modify status export after export' => 'Modification du statut des commandes après l\'export',
+ 'colissimo expeditor export' => 'Export pour le logiciel Expeditor',
+ 'select a valid status' => 'Choisissez un statut de commande valide.',
+);
diff --git a/local/modules/Colissimo/Listener/SendMail.php b/local/modules/Colissimo/Listener/SendMail.php
index 1c781ec29..58fb0d4c4 100755
--- a/local/modules/Colissimo/Listener/SendMail.php
+++ b/local/modules/Colissimo/Listener/SendMail.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Colissimo\Listener;
diff --git a/local/modules/Colissimo/Loop/CheckRightsLoop.php b/local/modules/Colissimo/Loop/CheckRightsLoop.php
index 05afc70ca..da4163b36 100755
--- a/local/modules/Colissimo/Loop/CheckRightsLoop.php
+++ b/local/modules/Colissimo/Loop/CheckRightsLoop.php
@@ -1,28 +1,17 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
-
namespace Colissimo\Loop;
+use Colissimo\Colissimo;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResultRow;
@@ -48,19 +37,19 @@ class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface
$ret = array();
$dir = __DIR__."/../Config/";
if (!is_readable($dir)) {
- $ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't read Config directory"), "ERRFILE"=>"");
+ $ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't read Config directory", [], Colissimo::MESSAGE_DOMAIN), "ERRFILE"=>"");
}
if (!is_writable($dir)) {
- $ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't write Config directory"), "ERRFILE"=>"");
+ $ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't write Config directory", [], Colissimo::MESSAGE_DOMAIN), "ERRFILE"=>"");
}
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (strlen($file) > 5 && substr($file, -5) === ".json") {
if (!is_readable($dir.$file)) {
- $ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't read file"), "ERRFILE"=>"Colissimo/Config/".$file);
+ $ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't read file", [], Colissimo::MESSAGE_DOMAIN), "ERRFILE"=>"Colissimo/Config/".$file);
}
if (!is_writable($dir.$file)) {
- $ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't write file"), "ERRFILE"=>"Colissimo/Config/".$file);
+ $ret[] = array("ERRMES"=>Translator::getInstance()->trans("Can't write file", [], Colissimo::MESSAGE_DOMAIN), "ERRFILE"=>"Colissimo/Config/".$file);
}
}
}
diff --git a/local/modules/Colissimo/Loop/NotSendLoop.php b/local/modules/Colissimo/Loop/NotSendLoop.php
new file mode 100644
index 000000000..ad4f320fb
--- /dev/null
+++ b/local/modules/Colissimo/Loop/NotSendLoop.php
@@ -0,0 +1,80 @@
+
+ */
+class NotSendLoop extends Order
+{
+ /**
+ *
+ * define all args used in your loop
+ *
+ *
+ * example :
+ *
+ * public function getArgDefinitions()
+ * {
+ * return new ArgumentCollection(
+ * Argument::createIntListTypeArgument('id'),
+ * new Argument(
+ * 'ref',
+ * new TypeCollection(
+ * new Type\AlphaNumStringListType()
+ * )
+ * ),
+ * Argument::createIntListTypeArgument('category'),
+ * Argument::createBooleanTypeArgument('new'),
+ * Argument::createBooleanTypeArgument('promo'),
+ * Argument::createFloatTypeArgument('min_price'),
+ * Argument::createFloatTypeArgument('max_price'),
+ * Argument::createIntTypeArgument('min_stock'),
+ * Argument::createFloatTypeArgument('min_weight'),
+ * Argument::createFloatTypeArgument('max_weight'),
+ * Argument::createBooleanTypeArgument('current'),
+ *
+ * );
+ * }
+ *
+ * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
+ */
+ public function getArgDefinitions()
+ {
+ return new ArgumentCollection();
+ }
+
+ /**
+ * this method returns a Propel ModelCriteria
+ *
+ * @return \Propel\Runtime\ActiveQuery\ModelCriteria
+ */
+ public function buildModelCriteria()
+ {
+
+
+ return ColissimoQuery::getOrders();
+ }
+}
\ No newline at end of file
diff --git a/local/modules/Colissimo/Loop/Price.php b/local/modules/Colissimo/Loop/Price.php
index 1f68df8a5..450527a2c 100755
--- a/local/modules/Colissimo/Loop/Price.php
+++ b/local/modules/Colissimo/Loop/Price.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Colissimo\Loop;
diff --git a/local/modules/Colissimo/Model/ColissimoQuery.php b/local/modules/Colissimo/Model/ColissimoQuery.php
new file mode 100644
index 000000000..191a1213f
--- /dev/null
+++ b/local/modules/Colissimo/Model/ColissimoQuery.php
@@ -0,0 +1,70 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Colissimo\Model;
+
+use Colissimo\Colissimo;
+use Propel\Runtime\ActiveQuery\Criteria;
+use Thelia\Model\OrderQuery;
+use Thelia\Model\OrderStatus;
+use Thelia\Model\OrderStatusQuery;
+
+
+/**
+ * Class ColissimoQuery
+ * @package Colissimo\Model
+ * @author Manuel Raynaud
+ */
+class ColissimoQuery
+{
+ /**
+ * @return OrderQuery
+ */
+ public static function getOrders()
+ {
+ $status = OrderStatusQuery::create()
+ ->filterByCode(
+ array(
+ OrderStatus::CODE_PAID,
+ OrderStatus::CODE_PROCESSING,
+ ),
+ Criteria::IN
+ )
+ ->find()
+ ->toArray("code")
+ ;
+
+
+
+ $query = OrderQuery::create()
+ ->filterByDeliveryModuleId((new Colissimo())->getModuleModel()->getId())
+ ->filterByStatusId(
+ array(
+ $status[OrderStatus::CODE_PAID]['Id'],
+ $status[OrderStatus::CODE_PROCESSING]['Id']),
+ Criteria::IN
+ );
+
+ return $query;
+ }
+}
\ No newline at end of file
diff --git a/local/modules/Colissimo/THELIA_INET.FMT b/local/modules/Colissimo/THELIA_INET.FMT
new file mode 100644
index 000000000..972666485
--- /dev/null
+++ b/local/modules/Colissimo/THELIA_INET.FMT
@@ -0,0 +1,23 @@
+[GENERAL]
+DELIMITE=O
+SEPARATEUR=59
+DELIMITEUR=34
+FINDELIGNE=CRLF
+Unité poids=KG
+[CHAMPS]
+ReferenceExpedition=1
+NomDestinataire=2
+Prenom=3
+Adresse1=4
+Adresse2=5
+Adresse3=6
+CodePostal=7
+Commune=8
+CodePays=9
+Telephone=10
+Portable=11
+Poids=12
+Mail=13
+CodePointRetrait=14
+CodeProduit=15
+NomCommercialChargeur=16
diff --git a/local/modules/Front/Config/front.xml b/local/modules/Front/Config/front.xml
index 74b42af5a..0a987eaa2 100644
--- a/local/modules/Front/Config/front.xml
+++ b/local/modules/Front/Config/front.xml
@@ -55,7 +55,7 @@
- Front\Controller\DefaultController::noAction
+ Thelia\Controller\Front\DefaultController::noActionaccount-password
@@ -63,6 +63,11 @@
Front\Controller\OrderController::generateDeliveryPdf\d+
+
+
+ Front\Controller\OrderController::generateInvoicePdf
+ \d+
+
@@ -118,6 +123,11 @@
Front\Controller\CartController::changeItemcart
+
+
+ Front\Controller\CartController::changeCountry
+ cart
+
@@ -158,6 +168,11 @@
Front\Controller\OrderController::orderPlacedorder-placed
+
+
+ Front\Controller\OrderController::orderFailed
+ order-failed
+
@@ -179,6 +194,21 @@
+
+
+ Front\Controller\SitemapController::generateAction
+
+
+
+
+
+ Front\Controller\FeedController::generateAction
+ catalog
+
+
+
+
+
Thelia\Controller\Front\DefaultController::noAction
diff --git a/local/modules/Front/Controller/AddressController.php b/local/modules/Front/Controller/AddressController.php
index f8cbde0a4..4b2de4568 100644
--- a/local/modules/Front/Controller/AddressController.php
+++ b/local/modules/Front/Controller/AddressController.php
@@ -1,227 +1,227 @@
-. */
-/* */
-/*************************************************************************************/
-
-namespace Front\Controller;
-use Thelia\Controller\Front\BaseFrontController;
-use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent;
-use Thelia\Core\Event\Address\AddressEvent;
-use Thelia\Core\Event\TheliaEvents;
-use Thelia\Core\Translation\Translator;
-use Thelia\Form\AddressCreateForm;
-use Thelia\Form\AddressUpdateForm;
-use Thelia\Form\Exception\FormValidationException;
-use Thelia\Model\AddressQuery;
-use Thelia\Model\Customer;
-
-/**
- * Class AddressController
- * @package Thelia\Controller\Front
- * @author Manuel Raynaud
- */
-class AddressController extends BaseFrontController
-{
-
- /**
- * Controller for generate modal containing update form
- * Check if request is a XmlHttpRequest and address owner is the current customer
- * @param $address_id
- */
- public function generateModalAction($address_id)
- {
-
- $this->checkAuth();
- $this->checkXmlHttpRequest();
-
- }
-
- /**
- * Create controller.
- * Check if customer is logged in
- *
- * Dispatch TheliaEvents::ADDRESS_CREATE event
- */
- public function createAction()
- {
-
- $this->checkAuth();
-
- $addressCreate = new AddressCreateForm($this->getRequest());
-
- try {
- $customer = $this->getSecurityContext()->getCustomerUser();
-
- $form = $this->validateForm($addressCreate, "post");
- $event = $this->createAddressEvent($form);
- $event->setCustomer($customer);
-
- $this->dispatch(TheliaEvents::ADDRESS_CREATE, $event);
- $this->redirectSuccess($addressCreate);
-
- } catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
- } catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
- }
-
- if ($message !== false) {
- \Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
-
- $addressCreate->setErrorMessage($message);
-
- $this->getParserContext()
- ->addForm($addressCreate)
- ->setGeneralError($message)
- ;
- }
- }
-
- public function updateViewAction($address_id)
- {
- $this->checkAuth();
-
- $customer = $this->getSecurityContext()->getCustomerUser();
- $address = AddressQuery::create()->findPk($address_id);
-
- if (!$address || $customer->getId() != $address->getCustomerId()) {
- $this->redirectToRoute('default');
- }
-
- $this->getParserContext()->set("address_id", $address_id);
- }
-
- public function processUpdateAction($address_id)
- {
- $this->checkAuth();
- $request = $this->getRequest();
-
- $addressUpdate = new AddressUpdateForm($request);
-
- try {
- $customer = $this->getSecurityContext()->getCustomerUser();
-
- $form = $this->validateForm($addressUpdate);
-
- $address = AddressQuery::create()->findPk($address_id);
-
- if (null === $address) {
- $this->redirectToRoute('default');
- }
-
- if ($address->getCustomer()->getId() != $customer->getId()) {
- $this->redirectToRoute('default');
- }
-
- $event = $this->createAddressEvent($form);
- $event->setAddress($address);
-
- $this->dispatch(TheliaEvents::ADDRESS_UPDATE, $event);
-
- $this->redirectSuccess($addressUpdate);
- } catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
- } catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
- }
- $this->getParserContext()->set("address_id", $address_id);
- if ($message !== false) {
- \Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
-
- $addressUpdate->setErrorMessage($message);
-
- $this->getParserContext()
- ->addForm($addressUpdate)
- ->setGeneralError($message)
- ;
- }
- }
-
- public function deleteAction($address_id)
- {
- $this->checkAuth();
- $error_message = false;
-
- $customer = $this->getSecurityContext()->getCustomerUser();
- $address = AddressQuery::create()->findPk($address_id);
-
- if (!$address || $customer->getId() != $address->getCustomerId()) {
- // If Ajax Request
- if ($this->getRequest()->isXmlHttpRequest()) {
- return $this->jsonResponse(json_encode(array(
- "success" => false,
- "message" => "Error during address deletion process"
- )));
- } else {
- $this->redirectToRoute('default');
- }
- }
-
- try {
- $this->dispatch(TheliaEvents::ADDRESS_DELETE, new AddressEvent($address));
- } catch (\Exception $e) {
- $error_message = $e->getMessage();
- }
-
- \Thelia\Log\Tlog::getInstance()->error(sprintf('Error during address deletion : %s', $error_message));
-
-
- // If Ajax Request
- if ($this->getRequest()->isXmlHttpRequest()) {
- if ($error_message) {
- $response = $this->jsonResponse(json_encode(array(
- "success" => false,
- "message" => $error_message
- )));
- } else {
- $response = $this->jsonResponse(json_encode(array(
- "success" => true,
- "message" => ""
- )));;
- }
-
- return $response;
-
- } else {
- $this->redirectToRoute('default', array('view'=>'account'));
- }
- }
-
- protected function createAddressEvent($form)
- {
- return new AddressCreateOrUpdateEvent(
- $form->get("label")->getData(),
- $form->get("title")->getData(),
- $form->get("firstname")->getData(),
- $form->get("lastname")->getData(),
- $form->get("address1")->getData(),
- $form->get("address2")->getData(),
- $form->get("address3")->getData(),
- $form->get("zipcode")->getData(),
- $form->get("city")->getData(),
- $form->get("country")->getData(),
- $form->get("cellphone")->getData(),
- $form->get("phone")->getData(),
- $form->get("company")->getData(),
- $form->get("is_default")->getData()
- );
- }
-}
+. */
+/* */
+/*************************************************************************************/
+
+namespace Front\Controller;
+use Front\Front;
+use Thelia\Controller\Front\BaseFrontController;
+use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent;
+use Thelia\Core\Event\Address\AddressEvent;
+use Thelia\Core\Event\TheliaEvents;
+use Thelia\Core\Translation\Translator;
+use Thelia\Form\AddressCreateForm;
+use Thelia\Form\AddressUpdateForm;
+use Thelia\Form\Exception\FormValidationException;
+use Thelia\Model\AddressQuery;
+use Thelia\Model\Customer;
+
+/**
+ * Class AddressController
+ * @package Thelia\Controller\Front
+ * @author Manuel Raynaud
+ */
+class AddressController extends BaseFrontController
+{
+
+ /**
+ * Controller for generate modal containing update form
+ * Check if request is a XmlHttpRequest and address owner is the current customer
+ * @param $address_id
+ */
+ public function generateModalAction($address_id)
+ {
+
+ $this->checkAuth();
+ $this->checkXmlHttpRequest();
+
+ }
+
+ /**
+ * Create controller.
+ * Check if customer is logged in
+ *
+ * Dispatch TheliaEvents::ADDRESS_CREATE event
+ */
+ public function createAction()
+ {
+
+ $this->checkAuth();
+
+ $addressCreate = new AddressCreateForm($this->getRequest());
+
+ try {
+ $customer = $this->getSecurityContext()->getCustomerUser();
+
+ $form = $this->validateForm($addressCreate, "post");
+ $event = $this->createAddressEvent($form);
+ $event->setCustomer($customer);
+
+ $this->dispatch(TheliaEvents::ADDRESS_CREATE, $event);
+ $this->redirectSuccess($addressCreate);
+
+ } catch (FormValidationException $e) {
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ } catch (\Exception $e) {
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ }
+
+ if ($message !== false) {
+ \Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
+
+ $addressCreate->setErrorMessage($message);
+
+ $this->getParserContext()
+ ->addForm($addressCreate)
+ ->setGeneralError($message)
+ ;
+ }
+ }
+
+ public function updateViewAction($address_id)
+ {
+ $this->checkAuth();
+
+ $customer = $this->getSecurityContext()->getCustomerUser();
+ $address = AddressQuery::create()->findPk($address_id);
+
+ if (!$address || $customer->getId() != $address->getCustomerId()) {
+ $this->redirectToRoute('default');
+ }
+
+ $this->getParserContext()->set("address_id", $address_id);
+ }
+
+ public function processUpdateAction($address_id)
+ {
+ $this->checkAuth();
+ $request = $this->getRequest();
+
+ $addressUpdate = new AddressUpdateForm($request);
+
+ try {
+ $customer = $this->getSecurityContext()->getCustomerUser();
+
+ $form = $this->validateForm($addressUpdate);
+
+ $address = AddressQuery::create()->findPk($address_id);
+
+ if (null === $address) {
+ $this->redirectToRoute('default');
+ }
+
+ if ($address->getCustomer()->getId() != $customer->getId()) {
+ $this->redirectToRoute('default');
+ }
+
+ $event = $this->createAddressEvent($form);
+ $event->setAddress($address);
+
+ $this->dispatch(TheliaEvents::ADDRESS_UPDATE, $event);
+
+ $this->redirectSuccess($addressUpdate);
+ } catch (FormValidationException $e) {
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ } catch (\Exception $e) {
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ }
+ $this->getParserContext()->set("address_id", $address_id);
+ if ($message !== false) {
+ \Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
+
+ $addressUpdate->setErrorMessage($message);
+
+ $this->getParserContext()
+ ->addForm($addressUpdate)
+ ->setGeneralError($message)
+ ;
+ }
+ }
+
+ public function deleteAction($address_id)
+ {
+ $this->checkAuth();
+ $error_message = false;
+
+ $customer = $this->getSecurityContext()->getCustomerUser();
+ $address = AddressQuery::create()->findPk($address_id);
+
+ if (!$address || $customer->getId() != $address->getCustomerId()) {
+ // If Ajax Request
+ if ($this->getRequest()->isXmlHttpRequest()) {
+ return $this->jsonResponse(json_encode(array(
+ "success" => false,
+ "message" => "Error during address deletion process"
+ )));
+ } else {
+ $this->redirectToRoute('default');
+ }
+ }
+
+ try {
+ $this->dispatch(TheliaEvents::ADDRESS_DELETE, new AddressEvent($address));
+ } catch (\Exception $e) {
+ $error_message = $e->getMessage();
+ }
+
+ \Thelia\Log\Tlog::getInstance()->error(sprintf('Error during address deletion : %s', $error_message));
+
+ // If Ajax Request
+ if ($this->getRequest()->isXmlHttpRequest()) {
+ if ($error_message) {
+ $response = $this->jsonResponse(json_encode(array(
+ "success" => false,
+ "message" => $error_message
+ )));
+ } else {
+ $response = $this->jsonResponse(json_encode(array(
+ "success" => true,
+ "message" => ""
+ )));;
+ }
+
+ return $response;
+
+ } else {
+ $this->redirectToRoute('default', array('view'=>'account'));
+ }
+ }
+
+ protected function createAddressEvent($form)
+ {
+ return new AddressCreateOrUpdateEvent(
+ $form->get("label")->getData(),
+ $form->get("title")->getData(),
+ $form->get("firstname")->getData(),
+ $form->get("lastname")->getData(),
+ $form->get("address1")->getData(),
+ $form->get("address2")->getData(),
+ $form->get("address3")->getData(),
+ $form->get("zipcode")->getData(),
+ $form->get("city")->getData(),
+ $form->get("country")->getData(),
+ $form->get("cellphone")->getData(),
+ $form->get("phone")->getData(),
+ $form->get("company")->getData(),
+ $form->get("is_default")->getData()
+ );
+ }
+}
diff --git a/local/modules/Front/Controller/CartController.php b/local/modules/Front/Controller/CartController.php
index 5985dedb5..587866950 100644
--- a/local/modules/Front/Controller/CartController.php
+++ b/local/modules/Front/Controller/CartController.php
@@ -23,14 +23,19 @@
namespace Front\Controller;
use Propel\Runtime\Exception\PropelException;
-use Thelia\Controller\Front\BaseFrontController;
-use Thelia\Core\Event\Order\OrderEvent;
-use Thelia\Form\Exception\FormValidationException;
-use Thelia\Core\Event\Cart\CartEvent;
-use Thelia\Core\Event\TheliaEvents;
+use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Request;
+use Thelia\Controller\Front\BaseFrontController;
+use Thelia\Core\Event\Cart\CartEvent;
+use Thelia\Core\Event\Order\OrderEvent;
+use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\CartAdd;
+use Thelia\Form\Exception\FormValidationException;
+use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery;
+use Thelia\Model\ConfigQuery;
+use Thelia\Module\Exception\DeliveryException;
+use Thelia\Tools\URL;
class CartController extends BaseFrontController
{
@@ -60,7 +65,7 @@ class CartController extends BaseFrontController
$this->redirectSuccess();
} catch (PropelException $e) {
- \Thelia\Log\Tlog::getInstance()->error(sprintf("Failed to add item to cart with message : %s", $e->getMessage()));
+ Tlog::getInstance()->error(sprintf("Failed to add item to cart with message : %s", $e->getMessage()));
$message = "Failed to add this article to your cart, please try again";
} catch (FormValidationException $e) {
$message = $e->getMessage();
@@ -108,12 +113,25 @@ class CartController extends BaseFrontController
$this->redirectSuccess();
} catch (PropelException $e) {
- \Thelia\Log\Tlog::getInstance()->error(sprintf("error during deleting cartItem with message : %s", $e->getMessage()));
+ Tlog::getInstance()->error(sprintf("error during deleting cartItem with message : %s", $e->getMessage()));
$this->getParserContext()->setGeneralError($e->getMessage());
}
}
+ public function changeCountry()
+ {
+ $redirectUrl = URL::getInstance()->absoluteUrl("/cart");
+ $deliveryId = $this->getRequest()->get("country");
+ $cookieName = ConfigQuery::read('front_cart_country_cookie_name', 'fcccn');
+ $cookieExpires = ConfigQuery::read('front_cart_country_cookie_expires', 2592000);
+ $cookieExpires = intval($cookieExpires) ?: 2592000;
+
+ $cookie = new Cookie($cookieName, $deliveryId, time() + $cookieExpires, '/');
+
+ $this->redirect($redirectUrl, 302, array($cookie));
+ }
+
/**
* use Thelia\Cart\CartTrait for searching current cart or create a new one
*
@@ -154,21 +172,30 @@ class CartController extends BaseFrontController
{
/* recalculate postage amount */
$order = $this->getSession()->getOrder();
- if(null !== $order) {
+ if (null !== $order) {
$deliveryModule = $order->getModuleRelatedByDeliveryModuleId();
$deliveryAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress);
- if(null !== $deliveryModule && null !== $deliveryAddress) {
+ if (null !== $deliveryModule && null !== $deliveryAddress) {
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
- $postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
$orderEvent = new OrderEvent($order);
- $orderEvent->setPostage($postage);
- $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
+ try {
+ $postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
+
+ $orderEvent->setPostage($postage);
+
+ $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
+ }
+ catch (DeliveryException $ex) {
+ // The postage has been chosen, but changes in the cart causes an exception.
+ // Reset the postage data in the order
+ $orderEvent->setDeliveryModule(0);
+
+ $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
+ }
}
}
}
-
-
}
diff --git a/local/modules/Front/Controller/CouponController.php b/local/modules/Front/Controller/CouponController.php
index 73eef34b7..3c3c025ab 100644
--- a/local/modules/Front/Controller/CouponController.php
+++ b/local/modules/Front/Controller/CouponController.php
@@ -26,11 +26,12 @@ use Propel\Runtime\Exception\PropelException;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
use Thelia\Core\Event\Order\OrderEvent;
+use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\CouponCode;
use Thelia\Form\Exception\FormValidationException;
-use Thelia\Core\Event\TheliaEvents;
use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery;
+use Thelia\Module\Exception\DeliveryException;
/**
* Class CouponController
@@ -68,18 +69,29 @@ class CouponController extends BaseFrontController
/* recalculate postage amount */
$order = $this->getSession()->getOrder();
- if(null !== $order) {
+ if (null !== $order) {
$deliveryModule = $order->getModuleRelatedByDeliveryModuleId();
$deliveryAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress);
- if(null !== $deliveryModule && null !== $deliveryAddress) {
+ if (null !== $deliveryModule && null !== $deliveryAddress) {
$moduleInstance = $this->container->get(sprintf('module.%s', $deliveryModule->getCode()));
- $postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
$orderEvent = new OrderEvent($order);
- $orderEvent->setPostage($postage);
- $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
+ try {
+ $postage = $moduleInstance->getPostage($deliveryAddress->getCountry());
+
+ $orderEvent->setPostage($postage);
+
+ $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
+ }
+ catch (DeliveryException $ex) {
+ // The postage has been chosen, but changes dues to coupon causes an exception.
+ // Reset the postage data in the order
+ $orderEvent->setDeliveryModule(0);
+
+ $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
+ }
}
}
diff --git a/local/modules/Front/Controller/CustomerController.php b/local/modules/Front/Controller/CustomerController.php
index ec8c83c82..1dee4aa45 100644
--- a/local/modules/Front/Controller/CustomerController.php
+++ b/local/modules/Front/Controller/CustomerController.php
@@ -1,391 +1,395 @@
-. */
-/* */
-/*************************************************************************************/
-namespace Front\Controller;
-
-use Thelia\Controller\Front\BaseFrontController;
-use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
-use Thelia\Core\Event\Customer\CustomerLoginEvent;
-use Thelia\Core\Event\LostPasswordEvent;
-use Thelia\Core\Event\Newsletter\NewsletterEvent;
-use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
-use Thelia\Core\Security\Exception\AuthenticationException;
-use Thelia\Core\Security\Exception\UsernameNotFoundException;
-use Thelia\Core\Translation\Translator;
-use Thelia\Form\CustomerCreateForm;
-use Thelia\Form\CustomerLogin;
-use Thelia\Form\CustomerLostPasswordForm;
-use Thelia\Form\CustomerPasswordUpdateForm;
-use Thelia\Form\CustomerProfileUpdateForm;
-use Thelia\Form\Exception\FormValidationException;
-use Thelia\Model\Customer;
-use Thelia\Core\Event\TheliaEvents;
-use Thelia\Model\NewsletterQuery;
-use Thelia\Tools\URL;
-use Thelia\Log\Tlog;
-use Thelia\Core\Security\Exception\WrongPasswordException;
-
-/**
- * Class CustomerController
- * @package Thelia\Controller\Front
- * @author Manuel Raynaud
- */
-class CustomerController extends BaseFrontController
-{
- use \Thelia\Cart\CartTrait;
-
- public function newPasswordAction()
- {
- if (! $this->getSecurityContext()->hasCustomerUser()) {
- $message = false;
-
- $passwordLost = new CustomerLostPasswordForm($this->getRequest());
-
- try {
-
- $form = $this->validateForm($passwordLost);
-
- $event = new LostPasswordEvent($form->get("email")->getData());
-
- $this->dispatch(TheliaEvents::LOST_PASSWORD, $event);
-
- } catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
- } catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
- }
-
- if ($message !== false) {
- Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage()));
-
- $passwordLost->setErrorMessage($message);
-
- $this->getParserContext()
- ->addForm($passwordLost)
- ->setGeneralError($message)
- ;
- }
- }
- }
-
- /**
- * Create a new customer.
- * On success, redirect to success_url if exists, otherwise, display the same view again.
- */
- public function createAction()
- {
- if (! $this->getSecurityContext()->hasCustomerUser()) {
-
- $message = false;
-
- $customerCreation = new CustomerCreateForm($this->getRequest());
-
- try {
- $form = $this->validateForm($customerCreation, "post");
-
- $customerCreateEvent = $this->createEventInstance($form->getData());
-
- $this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent);
-
- $newCustomer = $customerCreateEvent->getCustomer();
-
- // Newsletter
- if (true === $form->get('newsletter')->getData()) {
- $newsletterEmail = $newCustomer->getEmail();
- $nlEvent = new NewsletterEvent($newsletterEmail, $this->getRequest()->getSession()->getLang()->getLocale());
- $nlEvent->setFirstname($newCustomer->getFirstname());
- $nlEvent->setLastname($newCustomer->getLastname());
-
- // Security : Check if this new Email address already exist
- if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterEmail)) {
- $nlEvent->setId($newsletter->getId());
- $this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent);
- } else {
- $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent);
- }
- }
-
- $this->processLogin($customerCreateEvent->getCustomer());
-
- $cart = $this->getCart($this->getDispatcher(), $this->getRequest());
- if ($cart->getCartItems()->count() > 0) {
- $this->redirectToRoute('cart.view');
- } else {
- $this->redirectSuccess($customerCreation);
- }
- } catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
- } catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
- }
-
- if ($message !== false) {
- Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage()));
-
- $customerCreation->setErrorMessage($message);
-
- $this->getParserContext()
- ->addForm($customerCreation)
- ->setGeneralError($message)
- ;
- }
- }
- }
-
- /**
- * Update customer data. On success, redirect to success_url if exists.
- * Otherwise, display the same view again.
- */
- public function viewAction()
- {
- $this->checkAuth();
-
- $customer = $this->getSecurityContext()->getCustomerUser();
- $data = array(
- 'id' => $customer->getId(),
- 'title' => $customer->getTitleId(),
- 'firstname' => $customer->getFirstName(),
- 'lastname' => $customer->getLastName(),
- 'email' => $customer->getEmail(),
- 'newsletter' => null !== NewsletterQuery::create()->findOneByEmail($customer->getEmail()),
- );
-
- $customerProfileUpdateForm = new CustomerProfileUpdateForm($this->getRequest(), 'form', $data);
-
- // Pass it to the parser
- $this->getParserContext()->addForm($customerProfileUpdateForm);
- }
-
- public function updatePasswordAction()
- {
- if ($this->getSecurityContext()->hasCustomerUser()) {
- $message = false;
-
- $customerPasswordUpdateForm = new CustomerPasswordUpdateForm($this->getRequest());
-
- try {
- $customer = $this->getSecurityContext()->getCustomerUser();
-
- $form = $this->validateForm($customerPasswordUpdateForm, "post");
-
- $customerChangeEvent = $this->createEventInstance($form->getData());
- $customerChangeEvent->setCustomer($customer);
- $this->dispatch(TheliaEvents::CUSTOMER_UPDATEPROFILE, $customerChangeEvent);
-
- $this->redirectSuccess($customerPasswordUpdateForm);
-
- } catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
- } catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
- }
-
- if ($message !== false) {
- Tlog::getInstance()->error(sprintf("Error during customer password modification process : %s.", $message));
-
- $customerPasswordUpdateForm->setErrorMessage($message);
-
- $this->getParserContext()
- ->addForm($customerPasswordUpdateForm)
- ->setGeneralError($message)
- ;
- }
- }
- }
-
- public function updateAction()
- {
- if ($this->getSecurityContext()->hasCustomerUser()) {
-
- $message = false;
-
- $customerProfileUpdateForm = new CustomerProfileUpdateForm($this->getRequest());
-
- try {
- $customer = $this->getSecurityContext()->getCustomerUser();
- $newsletterOldEmail = $customer->getEmail();
-
- $form = $this->validateForm($customerProfileUpdateForm, "post");
-
- $customerChangeEvent = $this->createEventInstance($form->getData());
- $customerChangeEvent->setCustomer($customer);
- $this->dispatch(TheliaEvents::CUSTOMER_UPDATEPROFILE, $customerChangeEvent);
-
- $updatedCustomer = $customerChangeEvent->getCustomer();
-
- // Newsletter
- if (true === $form->get('newsletter')->getData()) {
- $nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale());
- $nlEvent->setFirstname($updatedCustomer->getFirstname());
- $nlEvent->setLastname($updatedCustomer->getLastname());
-
- if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) {
- $nlEvent->setId($newsletter->getId());
- $this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent);
- } else {
- $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent);
- }
- } else {
- if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) {
- $nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale());
- $nlEvent->setId($newsletter->getId());
- $this->dispatch(TheliaEvents::NEWSLETTER_UNSUBSCRIBE, $nlEvent);
- }
- }
-
- $this->processLogin($updatedCustomer);
-
- $this->redirectSuccess($customerProfileUpdateForm);
-
- } catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
- } catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
- }
-
- if ($message !== false) {
- Tlog::getInstance()->error(sprintf("Error during customer modification process : %s.", $message));
-
- $customerProfileUpdateForm->setErrorMessage($message);
-
- $this->getParserContext()
- ->addForm($customerProfileUpdateForm)
- ->setGeneralError($message)
- ;
- }
- }
- }
-
- /**
- * Perform user login. On a successful login, the user is redirected to the URL
- * found in the success_url form parameter, or / if none was found.
- *
- * If login is not successfull, the same view is displayed again.
- *
- */
- public function loginAction()
- {
- if (! $this->getSecurityContext()->hasCustomerUser()) {
- $message = false;
-
- $request = $this->getRequest();
- $customerLoginForm = new CustomerLogin($request);
-
- try {
-
- $form = $this->validateForm($customerLoginForm, "post");
-
- // If User is a new customer
- if ($form->get('account')->getData() == 0 && !$form->get("email")->getErrors()) {
- $this->redirectToRoute("customer.create.process", array("email" => $form->get("email")->getData()));
- } else {
-
- try {
-
- $authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
-
- $customer = $authenticator->getAuthentifiedUser();
-
- $this->processLogin($customer);
-
- $this->redirectSuccess($customerLoginForm);
-
- } catch (UsernameNotFoundException $e) {
- $message = "Wrong email or password. Please try again";
- } catch (WrongPasswordException $e) {
- $message = "Wrong email or password. Please try again";
- } catch (AuthenticationException $e) {
- $message = "Wrong email or password. Please try again";
- }
-
- }
-
- } catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
- } catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
- }
-
- if ($message !== false) {
- Tlog::getInstance()->error(sprintf("Error during customer login process : %s. Exception was %s", $message, $e->getMessage()));
-
- $customerLoginForm->setErrorMessage($message);
-
- $this->getParserContext()->addForm($customerLoginForm);
- }
- }
- }
-
- /**
- * Perform customer logout.
- */
- public function logoutAction()
- {
- if ($this->getSecurityContext()->hasCustomerUser()) {
- $this->dispatch(TheliaEvents::CUSTOMER_LOGOUT);
- }
-
- // Redirect to home page
- $this->redirect(URL::getInstance()->getIndexPage());
- }
-
- /**
- * Dispatch event for customer login action
- *
- * @param Customer $customer
- */
- protected function processLogin(Customer $customer)
- {
- $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer));
- }
-
- /**
- * @param $data
- * @return \Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent
- */
- private function createEventInstance($data)
- {
- $customerCreateEvent = new CustomerCreateOrUpdateEvent(
- isset($data["title"])?$data["title"]:null,
- isset($data["firstname"])?$data["firstname"]:null,
- isset($data["lastname"])?$data["lastname"]:null,
- isset($data["address1"])?$data["address1"]:null,
- isset($data["address2"])?$data["address2"]:null,
- isset($data["address3"])?$data["address3"]:null,
- isset($data["phone"])?$data["phone"]:null,
- isset($data["cellphone"])?$data["cellphone"]:null,
- isset($data["zipcode"])?$data["zipcode"]:null,
- isset($data["city"])?$data["city"]:null,
- isset($data["country"])?$data["country"]:null,
- isset($data["email"])?$data["email"]:null,
- isset($data["password"]) ? $data["password"]:null,
- $this->getRequest()->getSession()->getLang()->getId(),
- isset($data["reseller"])?$data["reseller"]:null,
- isset($data["sponsor"])?$data["sponsor"]:null,
- isset($data["discount"])?$data["discount"]:null,
- isset($data["company"])?$data["company"]:null,
- null
- );
-
- return $customerCreateEvent;
- }
-}
+. */
+/* */
+/*************************************************************************************/
+namespace Front\Controller;
+
+use Front\Front;
+use Symfony\Component\HttpFoundation\RedirectResponse;
+use Thelia\Controller\Front\BaseFrontController;
+use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
+use Thelia\Core\Event\Customer\CustomerLoginEvent;
+use Thelia\Core\Event\LostPasswordEvent;
+use Thelia\Core\Event\Newsletter\NewsletterEvent;
+use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
+use Thelia\Core\Security\Exception\AuthenticationException;
+use Thelia\Core\Security\Exception\UsernameNotFoundException;
+use Thelia\Core\Translation\Translator;
+use Thelia\Form\CustomerCreateForm;
+use Thelia\Form\CustomerLogin;
+use Thelia\Form\CustomerLostPasswordForm;
+use Thelia\Form\CustomerPasswordUpdateForm;
+use Thelia\Form\CustomerProfileUpdateForm;
+use Thelia\Form\Exception\FormValidationException;
+use Thelia\Model\Customer;
+use Thelia\Core\Event\TheliaEvents;
+use Thelia\Model\NewsletterQuery;
+use Thelia\Tools\URL;
+use Thelia\Log\Tlog;
+use Thelia\Core\Security\Exception\WrongPasswordException;
+
+/**
+ * Class CustomerController
+ * @package Thelia\Controller\Front
+ * @author Manuel Raynaud
+ */
+class CustomerController extends BaseFrontController
+{
+ use \Thelia\Cart\CartTrait;
+
+ public function newPasswordAction()
+ {
+ if (! $this->getSecurityContext()->hasCustomerUser()) {
+ $message = false;
+
+ $passwordLost = new CustomerLostPasswordForm($this->getRequest());
+
+ try {
+
+ $form = $this->validateForm($passwordLost);
+
+ $event = new LostPasswordEvent($form->get("email")->getData());
+
+ $this->dispatch(TheliaEvents::LOST_PASSWORD, $event);
+
+ } catch (FormValidationException $e) {
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ } catch (\Exception $e) {
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ }
+
+ if ($message !== false) {
+ Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage()));
+
+ $passwordLost->setErrorMessage($message);
+
+ $this->getParserContext()
+ ->addForm($passwordLost)
+ ->setGeneralError($message)
+ ;
+ }
+ }
+ }
+
+ /**
+ * Create a new customer.
+ * On success, redirect to success_url if exists, otherwise, display the same view again.
+ */
+ public function createAction()
+ {
+ if (! $this->getSecurityContext()->hasCustomerUser()) {
+
+ $message = false;
+
+ $customerCreation = new CustomerCreateForm($this->getRequest());
+
+ try {
+ $form = $this->validateForm($customerCreation, "post");
+
+ $customerCreateEvent = $this->createEventInstance($form->getData());
+
+ $this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent);
+
+ $newCustomer = $customerCreateEvent->getCustomer();
+
+ // Newsletter
+ if (true === $form->get('newsletter')->getData()) {
+ $newsletterEmail = $newCustomer->getEmail();
+ $nlEvent = new NewsletterEvent($newsletterEmail, $this->getRequest()->getSession()->getLang()->getLocale());
+ $nlEvent->setFirstname($newCustomer->getFirstname());
+ $nlEvent->setLastname($newCustomer->getLastname());
+
+ // Security : Check if this new Email address already exist
+ if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterEmail)) {
+ $nlEvent->setId($newsletter->getId());
+ $this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent);
+ } else {
+ $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent);
+ }
+ }
+
+ $this->processLogin($customerCreateEvent->getCustomer());
+
+ $cart = $this->getCart($this->getDispatcher(), $this->getRequest());
+ if ($cart->getCartItems()->count() > 0) {
+ $this->redirectToRoute('cart.view');
+ } else {
+ $this->redirectSuccess($customerCreation);
+ }
+ } catch (FormValidationException $e) {
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ } catch (\Exception $e) {
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ }
+
+ if ($message !== false) {
+ Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage()));
+
+ $customerCreation->setErrorMessage($message);
+
+ $this->getParserContext()
+ ->addForm($customerCreation)
+ ->setGeneralError($message)
+ ;
+ }
+ }
+ }
+
+ /**
+ * Update customer data. On success, redirect to success_url if exists.
+ * Otherwise, display the same view again.
+ */
+ public function viewAction()
+ {
+ $this->checkAuth();
+
+ $customer = $this->getSecurityContext()->getCustomerUser();
+ $data = array(
+ 'id' => $customer->getId(),
+ 'title' => $customer->getTitleId(),
+ 'firstname' => $customer->getFirstName(),
+ 'lastname' => $customer->getLastName(),
+ 'email' => $customer->getEmail(),
+ 'newsletter' => null !== NewsletterQuery::create()->findOneByEmail($customer->getEmail()),
+ );
+
+ $customerProfileUpdateForm = new CustomerProfileUpdateForm($this->getRequest(), 'form', $data);
+
+ // Pass it to the parser
+ $this->getParserContext()->addForm($customerProfileUpdateForm);
+ }
+
+ public function updatePasswordAction()
+ {
+ if ($this->getSecurityContext()->hasCustomerUser()) {
+ $message = false;
+
+ $customerPasswordUpdateForm = new CustomerPasswordUpdateForm($this->getRequest());
+
+ try {
+ $customer = $this->getSecurityContext()->getCustomerUser();
+
+ $form = $this->validateForm($customerPasswordUpdateForm, "post");
+
+ $customerChangeEvent = $this->createEventInstance($form->getData());
+ $customerChangeEvent->setCustomer($customer);
+ $this->dispatch(TheliaEvents::CUSTOMER_UPDATEPROFILE, $customerChangeEvent);
+
+ $this->redirectSuccess($customerPasswordUpdateForm);
+
+ } catch (FormValidationException $e) {
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ } catch (\Exception $e) {
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ }
+
+ if ($message !== false) {
+ Tlog::getInstance()->error(sprintf("Error during customer password modification process : %s.", $message));
+
+ $customerPasswordUpdateForm->setErrorMessage($message);
+
+ $this->getParserContext()
+ ->addForm($customerPasswordUpdateForm)
+ ->setGeneralError($message)
+ ;
+ }
+ }
+ }
+
+ public function updateAction()
+ {
+ if ($this->getSecurityContext()->hasCustomerUser()) {
+
+ $message = false;
+
+ $customerProfileUpdateForm = new CustomerProfileUpdateForm($this->getRequest());
+
+ try {
+ $customer = $this->getSecurityContext()->getCustomerUser();
+ $newsletterOldEmail = $customer->getEmail();
+
+ $form = $this->validateForm($customerProfileUpdateForm, "post");
+
+ $customerChangeEvent = $this->createEventInstance($form->getData());
+ $customerChangeEvent->setCustomer($customer);
+ $this->dispatch(TheliaEvents::CUSTOMER_UPDATEPROFILE, $customerChangeEvent);
+
+ $updatedCustomer = $customerChangeEvent->getCustomer();
+
+ // Newsletter
+ if (true === $form->get('newsletter')->getData()) {
+ $nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale());
+ $nlEvent->setFirstname($updatedCustomer->getFirstname());
+ $nlEvent->setLastname($updatedCustomer->getLastname());
+
+ if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) {
+ $nlEvent->setId($newsletter->getId());
+ $this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent);
+ } else {
+ $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent);
+ }
+ } else {
+ if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) {
+ $nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale());
+ $nlEvent->setId($newsletter->getId());
+ $this->dispatch(TheliaEvents::NEWSLETTER_UNSUBSCRIBE, $nlEvent);
+ }
+ }
+
+ $this->processLogin($updatedCustomer);
+
+ $this->redirectSuccess($customerProfileUpdateForm);
+
+ } catch (FormValidationException $e) {
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ } catch (\Exception $e) {
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ }
+
+ if ($message !== false) {
+ Tlog::getInstance()->error(sprintf("Error during customer modification process : %s.", $message));
+
+ $customerProfileUpdateForm->setErrorMessage($message);
+
+ $this->getParserContext()
+ ->addForm($customerProfileUpdateForm)
+ ->setGeneralError($message)
+ ;
+ }
+ }
+ }
+
+ /**
+ * Perform user login. On a successful login, the user is redirected to the URL
+ * found in the success_url form parameter, or / if none was found.
+ *
+ * If login is not successfull, the same view is displayed again.
+ *
+ */
+ public function loginAction()
+ {
+ if (! $this->getSecurityContext()->hasCustomerUser()) {
+ $message = false;
+
+ $request = $this->getRequest();
+ $customerLoginForm = new CustomerLogin($request);
+
+ try {
+
+ $form = $this->validateForm($customerLoginForm, "post");
+
+ // If User is a new customer
+ if ($form->get('account')->getData() == 0 && !$form->get("email")->getErrors()) {
+ $this->redirectToRoute("customer.create.process", array("email" => $form->get("email")->getData()));
+ } else {
+
+ try {
+
+ $authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
+
+ $customer = $authenticator->getAuthentifiedUser();
+
+ $this->processLogin($customer);
+
+ $successUrl = $customerLoginForm->getSuccessUrl();
+
+ return RedirectResponse::create($successUrl);
+
+ } catch (UsernameNotFoundException $e) {
+ $message = "Wrong email or password. Please try again";
+ } catch (WrongPasswordException $e) {
+ $message = "Wrong email or password. Please try again";
+ } catch (AuthenticationException $e) {
+ $message = "Wrong email or password. Please try again";
+ }
+
+ }
+
+ } catch (FormValidationException $e) {
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ } catch (\Exception $e) {
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
+ }
+
+ if ($message !== false) {
+ Tlog::getInstance()->error(sprintf("Error during customer login process : %s. Exception was %s", $message, $e->getMessage()));
+
+ $customerLoginForm->setErrorMessage($message);
+
+ $this->getParserContext()->addForm($customerLoginForm);
+ }
+ }
+ }
+
+ /**
+ * Perform customer logout.
+ */
+ public function logoutAction()
+ {
+ if ($this->getSecurityContext()->hasCustomerUser()) {
+ $this->dispatch(TheliaEvents::CUSTOMER_LOGOUT);
+ }
+
+ // Redirect to home page
+ return RedirectResponse::create(URL::getInstance()->getIndexPage());
+ }
+
+ /**
+ * Dispatch event for customer login action
+ *
+ * @param Customer $customer
+ */
+ protected function processLogin(Customer $customer)
+ {
+ $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer));
+ }
+
+ /**
+ * @param $data
+ * @return \Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent
+ */
+ private function createEventInstance($data)
+ {
+ $customerCreateEvent = new CustomerCreateOrUpdateEvent(
+ isset($data["title"])?$data["title"]:null,
+ isset($data["firstname"])?$data["firstname"]:null,
+ isset($data["lastname"])?$data["lastname"]:null,
+ isset($data["address1"])?$data["address1"]:null,
+ isset($data["address2"])?$data["address2"]:null,
+ isset($data["address3"])?$data["address3"]:null,
+ isset($data["phone"])?$data["phone"]:null,
+ isset($data["cellphone"])?$data["cellphone"]:null,
+ isset($data["zipcode"])?$data["zipcode"]:null,
+ isset($data["city"])?$data["city"]:null,
+ isset($data["country"])?$data["country"]:null,
+ isset($data["email"])?$data["email"]:null,
+ isset($data["password"]) ? $data["password"]:null,
+ $this->getRequest()->getSession()->getLang()->getId(),
+ isset($data["reseller"])?$data["reseller"]:null,
+ isset($data["sponsor"])?$data["sponsor"]:null,
+ isset($data["discount"])?$data["discount"]:null,
+ isset($data["company"])?$data["company"]:null,
+ null
+ );
+
+ return $customerCreateEvent;
+ }
+}
diff --git a/local/modules/Front/Controller/FeedController.php b/local/modules/Front/Controller/FeedController.php
new file mode 100644
index 000000000..7fc95ed77
--- /dev/null
+++ b/local/modules/Front/Controller/FeedController.php
@@ -0,0 +1,200 @@
+
+ */
+class FeedController extends BaseFrontController {
+
+
+ /**
+ * Folder name for feeds cache
+ */
+ const FEED_CACHE_DIR = "feeds";
+
+ /**
+ * Key prefix for feed cache
+ */
+ const FEED_CACHE_KEY = "feed";
+
+
+ /**
+ * render the RSS feed
+ *
+ * @param $context string The context of the feed : catalog, content. default: catalog
+ * @param $lang string The lang of the feed : fr_FR, en_US, ... default: default language of the site
+ * @param $id string The id of the parent element. The id of the main parent category for catalog context.
+ * The id of the content folder for content context
+ * @return Response
+ */
+ public function generateAction($context, $lang, $id)
+ {
+
+ /** @var Request $request */
+ $request = $this->getRequest();
+
+ // context
+ if ("" === $context){
+ $context = "catalog";
+ } else if (! in_array($context, array("catalog", "content")) ){
+ $this->pageNotFound();
+ }
+
+ // the locale : fr_FR, en_US,
+ if ("" !== $lang) {
+ if (! $this->checkLang($lang)){
+ $this->pageNotFound();
+ }
+ } else {
+ try{
+ $lang = Lang::getDefaultLanguage();
+ $lang = $lang->getLocale();
+ } catch (\RuntimeException $ex){
+ // @todo generate error page
+ throw new \RuntimeException("No default language is defined. Please define one.");
+ }
+ }
+ if (null === $lang = LangQuery::create()->findOneByLocale($lang)){
+ $this->pageNotFound();
+ }
+ $lang = $lang->getId();
+
+ // check if element exists and is visible
+ if ("" !== $id){
+ if (false === $this->checkId($context, $id)){
+ $this->pageNotFound();
+ }
+ }
+
+ $flush = $request->query->get("flush", "");
+
+ // check if feed already in cache
+ $cacheContent = false;
+
+ $cacheDir = $this->getCacheDir();
+ $cacheKey = self::FEED_CACHE_KEY . $lang . $context . $id;
+ $cacheExpire = intval(ConfigQuery::read("feed_ttl", '7200')) ?: 7200;
+
+ $cacheDriver = new FilesystemCache($cacheDir);
+ if (!($this->checkAdmin() && "" !== $flush)){
+ $cacheContent = $cacheDriver->fetch($cacheKey);
+ } else {
+ $cacheDriver->delete($cacheKey);
+ }
+
+ // if not in cache
+ if (false === $cacheContent){
+ // render the view
+ $cacheContent = $this->renderRaw(
+ "feed",
+ array(
+ "_context_" => $context,
+ "_lang_" => $lang,
+ "_id_" => $id
+ )
+ );
+ // save cache
+ $cacheDriver->save($cacheKey, $cacheContent, $cacheExpire);
+ }
+
+ $response = new Response();
+ $response->setContent($cacheContent);
+ $response->headers->set('Content-Type', 'application/rss+xml');
+
+ return $response;
+ }
+
+
+ /**
+ * get the cache directory for feeds
+ *
+ * @return mixed|string
+ */
+ protected function getCacheDir()
+ {
+ $cacheDir = $this->container->getParameter("kernel.cache_dir");
+ $cacheDir = rtrim($cacheDir, '/');
+ $cacheDir .= '/' . self::FEED_CACHE_DIR . '/';
+
+ return $cacheDir;
+ }
+
+ /**
+ * Check if current user has ADMIN role
+ *
+ * @return bool
+ */
+ protected function checkAdmin(){
+ return $this->getSecurityContext()->hasAdminUser();
+ }
+
+
+ /**
+ * Check if a lang is used
+ *
+ * @param $lang string The lang code. e.g.: fr
+ * @return bool true if the language is used, otherwise false
+ */
+ private function checkLang($lang)
+ {
+ // load locals
+ $lang = LangQuery::create()
+ ->findOneByLocale($lang);
+
+ return (null !== $lang);
+ }
+
+
+ /**
+ * Check if the element exists and is visible
+ *
+ * @param $context string catalog or content
+ * @param $id string id of the element
+ * @return bool
+ */
+ private function checkId($context, $id)
+ {
+ $ret = false;
+ if (is_numeric($id)){
+ if ("catalog" === $context){
+ $cat = CategoryQuery::create()->findPk($id);
+ $ret = (null !== $cat && $cat->getVisible());
+ } else {
+ $folder = FolderQuery::create()->findPk($id);
+ $ret = (null !== $folder && $folder->getVisible());
+ }
+ }
+ return $ret;
+ }
+
+}
\ No newline at end of file
diff --git a/local/modules/Front/Controller/OrderController.php b/local/modules/Front/Controller/OrderController.php
index 4791663f0..2c6f3072e 100644
--- a/local/modules/Front/Controller/OrderController.php
+++ b/local/modules/Front/Controller/OrderController.php
@@ -22,12 +22,11 @@
/*************************************************************************************/
namespace Front\Controller;
+use Front\Front;
use Propel\Runtime\Exception\PropelException;
+use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Thelia\Cart\CartTrait;
use Thelia\Controller\Front\BaseFrontController;
-use Thelia\Core\Event\PdfEvent;
-use Thelia\Core\HttpFoundation\Response;
-use Thelia\Core\Template\TemplateHelper;
use Thelia\Core\Translation\Translator;
use Thelia\Exception\TheliaProcessException;
use Thelia\Form\Exception\FormValidationException;
@@ -39,7 +38,7 @@ use Thelia\Form\OrderPayment;
use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery;
use Thelia\Model\AreaDeliveryModuleQuery;
-use Thelia\Model\Base\OrderQuery;
+use Thelia\Model\OrderQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Model\Order;
@@ -104,11 +103,11 @@ class OrderController extends BaseFrontController
$this->redirectToRoute("order.invoice");
} catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
} catch (PropelException $e) {
$this->getParserContext()->setGeneralError($e->getMessage());
} catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
}
if ($message !== false) {
@@ -160,11 +159,11 @@ class OrderController extends BaseFrontController
$this->redirectToRoute("order.payment.process");
} catch (FormValidationException $e) {
- $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage());
+ $message = Translator::getInstance()->trans("Please check your input: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
} catch (PropelException $e) {
$this->getParserContext()->setGeneralError($e->getMessage());
} catch (\Exception $e) {
- $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage());
+ $message = Translator::getInstance()->trans("Sorry, an error occured: %s", ['%s' => $e->getMessage()], Front::MESSAGE_DOMAIN);
}
if ($message !== false) {
@@ -202,7 +201,7 @@ class OrderController extends BaseFrontController
if (null !== $placedOrder && null !== $placedOrder->getId()) {
/* order has been placed */
- if($orderEvent->hasResponse()) {
+ if ($orderEvent->hasResponse()) {
return $orderEvent->getResponse();
} else {
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId()))));
@@ -237,6 +236,29 @@ class OrderController extends BaseFrontController
$this->getParserContext()->set("placed_order_id", $placedOrder->getId());
}
+ public function orderFailed($order_id, $message)
+ {
+ /* check if the placed order matched the customer */
+ $failedOrder = OrderQuery::create()->findPk(
+ $this->getRequest()->attributes->get('order_id')
+ );
+
+ if (null === $failedOrder) {
+ throw new TheliaProcessException("No failed order", TheliaProcessException::NO_PLACED_ORDER, $failedOrder);
+ }
+
+ $customer = $this->getSecurityContext()->getCustomerUser();
+
+ if (null === $customer || $failedOrder->getCustomerId() !== $customer->getId()) {
+ throw new TheliaProcessException("Received failed order id does not belong to the current customer", TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER, $placedOrder);
+ }
+
+ $this->getParserContext()
+ ->set("failed_order_id", $failedOrder->getId())
+ ->set("failed_order_message", $message)
+ ;
+ }
+
protected function getOrderEvent()
{
$order = $this->getOrder($this->getRequest());
@@ -261,18 +283,41 @@ class OrderController extends BaseFrontController
public function generateInvoicePdf($order_id)
{
- /* check customer */
- $this->checkAuth();
+ $this->checkOrderCustomer($order_id);
+
+
return $this->generateOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice'));
}
public function generateDeliveryPdf($order_id)
{
- /* check customer */
- $this->checkAuth();
+ $this->checkOrderCustomer($order_id);
+
return $this->generateOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery'));
}
+ private function checkOrderCustomer($order_id)
+ {
+ $this->checkAuth();
+
+ $order = OrderQuery::create()->findPk($order_id);
+ $valid = true;
+ if ($order) {
+ $customerOrder = $order->getCustomer();
+ $customer = $this->getSecurityContext()->getCustomerUser();
+
+ if ($customerOrder->getId() != $customer->getId()) {
+ $valid = false;
+ }
+ } else {
+ $valid = false;
+ }
+
+ if (false === $valid) {
+ throw new AccessDeniedHttpException();
+ }
+ }
+
public function getDeliveryModuleListAjaxAction()
{
$country = $this->getRequest()->get(
@@ -286,5 +331,4 @@ class OrderController extends BaseFrontController
return $this->render('ajax/order-delivery-module-list', $args);
}
-
}
diff --git a/local/modules/Front/Controller/SitemapController.php b/local/modules/Front/Controller/SitemapController.php
new file mode 100644
index 000000000..df339c5bb
--- /dev/null
+++ b/local/modules/Front/Controller/SitemapController.php
@@ -0,0 +1,152 @@
+
+ */
+class SitemapController extends BaseFrontController {
+
+
+ /**
+ * Folder name for sitemap cache
+ */
+ const SITEMAP_CACHE_DIR = "sitemap";
+
+ /**
+ * Key prefix for sitemap cache
+ */
+ const SITEMAP_CACHE_KEY = "sitemap";
+
+ /**
+ * @return Response
+ */
+ public function generateAction()
+ {
+
+ /** @var Request $request */
+ $request = $this->getRequest();
+
+ // the locale : fr, en,
+ $lang = $request->query->get("lang", "");
+ if ("" !== $lang) {
+ if (! $this->checkLang($lang)){
+ $this->pageNotFound();
+ }
+ }
+ // specific content : product, category, cms
+ $context = $request->query->get("context", "");
+ if (! in_array($context, array("", "catalog", "content")) ){
+ $this->pageNotFound();
+ }
+
+ $flush = $request->query->get("flush", "");
+
+ // check if sitemap already in cache
+ $cacheContent = false;
+
+ $cacheDir = $this->getCacheDir();
+ $cacheKey = self::SITEMAP_CACHE_KEY . $lang . $context;
+ $cacheExpire = intval(ConfigQuery::read("sitemap_ttl", '7200')) ?: 7200;
+
+ $cacheDriver = new FilesystemCache($cacheDir);
+ if (!($this->checkAdmin() && "" !== $flush)){
+ $cacheContent = $cacheDriver->fetch($cacheKey);
+ } else {
+ $cacheDriver->delete($cacheKey);
+ }
+
+ // if not in cache
+ if (false === $cacheContent){
+ // render the view
+ $cacheContent = $this->renderRaw(
+ "sitemap",
+ array(
+ "_lang_" => $lang,
+ "_context_" => $context
+ )
+ );
+ // save cache
+ $cacheDriver->save($cacheKey, $cacheContent, $cacheExpire);
+ }
+
+ $response = new Response();
+ $response->setContent($cacheContent);
+ $response->headers->set('Content-Type', 'application/xml');
+
+ return $response;
+ }
+
+
+ /**
+ * get the cache directory for sitemap
+ *
+ * @return mixed|string
+ */
+ protected function getCacheDir()
+ {
+ $cacheDir = $this->container->getParameter("kernel.cache_dir");
+ $cacheDir = rtrim($cacheDir, '/');
+ $cacheDir .= '/' . self::SITEMAP_CACHE_DIR . '/';
+
+ return $cacheDir;
+ }
+
+ /**
+ * Check if current user has ADMIN role
+ *
+ * @return bool
+ */
+ protected function checkAdmin(){
+ return $this->getSecurityContext()->hasAdminUser();
+ }
+
+
+ /**
+ * Check if a lang is used
+ *
+ * @param $lang The lang code. e.g.: fr
+ * @return bool true if the language is used, otherwise false
+ */
+ private function checkLang($lang)
+ {
+ // load locals
+ $lang = LangQuery::create()
+ ->findOneByCode($lang);
+
+ return (null !== $lang);
+ }
+
+}
\ No newline at end of file
diff --git a/local/modules/Front/Front.php b/local/modules/Front/Front.php
index 67498ba24..c085f27fe 100644
--- a/local/modules/Front/Front.php
+++ b/local/modules/Front/Front.php
@@ -27,9 +27,5 @@ use Thelia\Module\BaseModule;
class Front extends BaseModule
{
- /**
- * YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
- * Like install and destroy
- */
-
+ const MESSAGE_DOMAIN = 'front';
}
diff --git a/local/modules/Klikandpay b/local/modules/Klikandpay
new file mode 160000
index 000000000..a72c066e7
--- /dev/null
+++ b/local/modules/Klikandpay
@@ -0,0 +1 @@
+Subproject commit a72c066e7400d2350dca24016a302582cb7e7b62
diff --git a/local/modules/TheliaDebugBar/Config/routing.xml b/local/modules/TheliaDebugBar/Config/routing.xml
index 14361a729..cfc20f812 100644
--- a/local/modules/TheliaDebugBar/Config/routing.xml
+++ b/local/modules/TheliaDebugBar/Config/routing.xml
@@ -2,8 +2,4 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
-
-
- TheliaDebugBar\Controller\Admin\TheliaDebugBarController::indexAction
-
\ No newline at end of file
diff --git a/local/modules/TheliaDebugBar/Controller/Admin/TheliaDebguBarController.php b/local/modules/TheliaDebugBar/Controller/Admin/TheliaDebguBarController.php
deleted file mode 100644
index e09ae6243..000000000
--- a/local/modules/TheliaDebugBar/Controller/Admin/TheliaDebguBarController.php
+++ /dev/null
@@ -1,18 +0,0 @@
-checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
-
- // Render the edition template.
- return $this->render('tdb-index');
- }
-}
\ No newline at end of file
diff --git a/local/modules/TheliaDebugBar/Controller/Admin/TheliaDebugBarController.php b/local/modules/TheliaDebugBar/Controller/Admin/TheliaDebugBarController.php
deleted file mode 100644
index e09ae6243..000000000
--- a/local/modules/TheliaDebugBar/Controller/Admin/TheliaDebugBarController.php
+++ /dev/null
@@ -1,18 +0,0 @@
-checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response;
-
- // Render the edition template.
- return $this->render('tdb-index');
- }
-}
\ No newline at end of file
diff --git a/local/modules/TheliaDebugBar/DataCollector/PropelCollector.php b/local/modules/TheliaDebugBar/DataCollector/PropelCollector.php
index 00d99f9d2..aab96bf40 100644
--- a/local/modules/TheliaDebugBar/DataCollector/PropelCollector.php
+++ b/local/modules/TheliaDebugBar/DataCollector/PropelCollector.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace TheliaDebugBar\DataCollector;
diff --git a/local/modules/TheliaDebugBar/Listeners/DebugBarListeners.php b/local/modules/TheliaDebugBar/Listeners/DebugBarListeners.php
index 190844e40..2bb4a7af3 100644
--- a/local/modules/TheliaDebugBar/Listeners/DebugBarListeners.php
+++ b/local/modules/TheliaDebugBar/Listeners/DebugBarListeners.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace TheliaDebugBar\Listeners;
diff --git a/local/modules/TheliaDebugBar/Smarty/Plugin/DebugBar.php b/local/modules/TheliaDebugBar/Smarty/Plugin/DebugBar.php
index e03b7797c..81e999b06 100644
--- a/local/modules/TheliaDebugBar/Smarty/Plugin/DebugBar.php
+++ b/local/modules/TheliaDebugBar/Smarty/Plugin/DebugBar.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace TheliaDebugBar\Smarty\Plugin;
diff --git a/local/modules/TheliaDebugBar/TheliaDebugBar.php b/local/modules/TheliaDebugBar/TheliaDebugBar.php
index 466f50d5a..999c8cd40 100644
--- a/local/modules/TheliaDebugBar/TheliaDebugBar.php
+++ b/local/modules/TheliaDebugBar/TheliaDebugBar.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace TheliaDebugBar;
diff --git a/local/modules/Tinymce/Config/module.xml b/local/modules/Tinymce/Config/module.xml
index 175017bd9..c27913441 100644
--- a/local/modules/Tinymce/Config/module.xml
+++ b/local/modules/Tinymce/Config/module.xml
@@ -2,10 +2,10 @@
Tinymce\Tinymce
- Tinymce wysiwyg editor
+ TinyMCE WYSIWYG editor
- éditeur wysiwyg Tinymce
+ Editeur visuel TinyMCE0.1
diff --git a/local/modules/Tinymce/Listener/VerifyTinymceListener.php b/local/modules/Tinymce/Listener/VerifyTinymceListener.php
index 4f984567f..2b8e5efce 100644
--- a/local/modules/Tinymce/Listener/VerifyTinymceListener.php
+++ b/local/modules/Tinymce/Listener/VerifyTinymceListener.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Tinymce\Listener;
@@ -54,7 +43,6 @@ class VerifyTinymceListener implements EventSubscriberInterface
public function clearCache(CacheEvent $event)
{
if (true === file_exists(THELIA_WEB_DIR . '/tinymce')) {
- echo "toto";
$fs = new Filesystem();
$directory = new \DirectoryIterator(THELIA_WEB_DIR . '/tinymce');
diff --git a/local/modules/Tinymce/Tinymce.php b/local/modules/Tinymce/Tinymce.php
index 6a75b3ee4..08fac3139 100644
--- a/local/modules/Tinymce/Tinymce.php
+++ b/local/modules/Tinymce/Tinymce.php
@@ -1,24 +1,13 @@
. */
-/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Tinymce;
diff --git a/reset_install.bat b/reset_install.bat
index 4deec3f46..1e2912f53 100644
--- a/reset_install.bat
+++ b/reset_install.bat
@@ -22,16 +22,16 @@ if exist local\config\database.yml (
..\..\bin\propel build -v --output-dir=../../core/lib/ --enable-identifier-quoting
echo [INFO] Building SQL CREATE file
- ..\..\bin\propel sql:build -v --output-dir=..\..\install
+ ..\..\bin\propel sql:build -v --output-dir=..\..\setup
echo [INFO] Reloading Thelia2 database
cd ..\..
- del install\sqldb.map
+ del setup\sqldb.map
php Thelia thelia:dev:reloadDB
echo [INFO] Installing fixtures
- php install\faker.php
+ php setup\faker.php
echo [INFO] Clearing caches
php Thelia cache:clear
diff --git a/reset_install.sh b/reset_install.sh
index 684b12abb..40216a643 100755
--- a/reset_install.sh
+++ b/reset_install.sh
@@ -21,15 +21,15 @@ echo -e "\n\033[01;34m[INFO] Building Models file\033[00m\n"
../../bin/propel build -v --output-dir=../../core/lib/ --enable-identifier-quoting
echo -e "\n\033[01;34m[INFO] Building SQL CREATE file\033[00m\n"
-../../bin/propel sql:build -v --output-dir=../../install/
+../../bin/propel sql:build -v --output-dir=../../setup/
echo -e "\n\033[01;34m[INFO] Reloading Thelia2 database\033[00m\n"
cd ../..
-rm install/sqldb.map
+rm setup/sqldb.map
php Thelia thelia:dev:reloadDB
echo -e "\n\033[01;34m[INFO] Installing fixtures\033[00m\n"
-php install/faker.php
+php setup/faker.php
echo -e "\n\033[01;34m[INFO] Adding admin\033[00m\n"
php Thelia admin:create --login_name thelia2 --password thelia2 --last_name thelia2 --first_name thelia2
diff --git a/run_casperjs.sh b/run_casperjs.sh
index 88636a9d1..5bdca95f4 100755
--- a/run_casperjs.sh
+++ b/run_casperjs.sh
@@ -9,7 +9,7 @@ echo -e "\n\e[01;34m[INFO] Building Models file\e[00m\n"
../../bin/propel build -v --output-dir=../../core/lib/
echo -e "\n\e[01;34m[INFO] Building SQL CREATE file\e[00m\n"
-../../bin/propel sql:build -v --output-dir=../../install/
+../../bin/propel sql:build -v --output-dir=../../setup/
echo -e "\n\e[01;34m[INFO] Reloaded Thelia2 database\e[00m\n"
cd ../..
@@ -17,7 +17,7 @@ rm install/sqldb.map
php Thelia thelia:dev:reloadDB
echo -e "\n\e[01;34m[INFO] Installing fixtures\e[00m\n"
-php install/faker.php
+php setup/faker.php
echo -e "\n\e[01;34m[INFO] Adding admin\e[00m\n"
php Thelia thelia:create-admin --login_name thelia2 --password thelia2 --last_name thelia2 --first_name thelia2
diff --git a/install/.gitkeep b/setup/.gitkeep
similarity index 100%
rename from install/.gitkeep
rename to setup/.gitkeep
diff --git a/setup/.htaccess b/setup/.htaccess
new file mode 100644
index 000000000..f239fe831
--- /dev/null
+++ b/setup/.htaccess
@@ -0,0 +1,2 @@
+order deny,allow
+deny from all
\ No newline at end of file
diff --git a/install/INSTALL-TODO.txt b/setup/INSTALL-TODO.txt
similarity index 100%
rename from install/INSTALL-TODO.txt
rename to setup/INSTALL-TODO.txt
diff --git a/install/faker-assets/FreeSans.ttf b/setup/faker-assets/FreeSans.ttf
similarity index 100%
rename from install/faker-assets/FreeSans.ttf
rename to setup/faker-assets/FreeSans.ttf
diff --git a/install/faker.php b/setup/faker.php
similarity index 99%
rename from install/faker.php
rename to setup/faker.php
index 5df84b32f..4ae74a0e5 100644
--- a/install/faker.php
+++ b/setup/faker.php
@@ -10,6 +10,10 @@ use Thelia\Condition\ConditionCollection;
use Thelia\Coupon\Type\RemoveXAmount;
use Thelia\Coupon\Type\RemoveXPercent;
+if (php_sapi_name() != 'cli') {
+ throw new \Exception('this script can only be launched with cli sapi');
+}
+
require __DIR__ . '/../core/bootstrap.php';
$thelia = new Thelia\Core\Thelia("dev", true);
@@ -498,6 +502,7 @@ try {
} catch (Exception $e) {
echo "error : ".$e->getMessage()."\n";
+ echo $e->getTraceAsString();
$con->rollBack();
}
diff --git a/install/faker_100categories_1000products_4locales.php b/setup/faker_100categories_1000products_4locales.php
similarity index 97%
rename from install/faker_100categories_1000products_4locales.php
rename to setup/faker_100categories_1000products_4locales.php
index 4e31ca296..91a0f3828 100644
--- a/install/faker_100categories_1000products_4locales.php
+++ b/setup/faker_100categories_1000products_4locales.php
@@ -1,5 +1,7 @@
. */
/* */
/*************************************************************************************/
-
+if (php_sapi_name() != 'cli') {
+ throw new \Exception('this script can only be launched with cli sapi');
+}
require __DIR__ . '/../core/bootstrap.php';
$thelia = new Thelia\Core\Thelia("dev", true);
@@ -81,7 +83,7 @@ function createProduct($faker, $categories, $template, $attribute, $feature, $co
{
echo "start creating products\n";
$fileSystem = new \Symfony\Component\Filesystem\Filesystem();
- if (($handle = fopen(THELIA_ROOT . '/install/import/products.csv', "r")) !== FALSE) {
+ if (($handle = fopen(THELIA_ROOT . '/setup/import/products.csv', "r")) !== FALSE) {
$row=0;
while (($data = fgetcsv($handle, 100000, ";")) !== FALSE) {
$row++;
@@ -132,7 +134,7 @@ function createProduct($faker, $categories, $template, $attribute, $feature, $co
->setProduct($product)
->setFile($image)
->save($con);
- $fileSystem->copy(THELIA_ROOT . 'install/import/images/'.$image, THELIA_ROOT . 'local/media/images/product/'.$image, true);
+ $fileSystem->copy(THELIA_ROOT . 'setup/import/images/'.$image, THELIA_ROOT . 'local/media/images/product/'.$image, true);
}
$pses = explode(";", $data[12]);
@@ -197,7 +199,7 @@ function createProduct($faker, $categories, $template, $attribute, $feature, $co
function createBrand($con)
{
echo "start creating brands feature\n";
- if (($handle = fopen(THELIA_ROOT . '/install/import/brand.csv', "r")) !== FALSE) {
+ if (($handle = fopen(THELIA_ROOT . '/setup/import/brand.csv', "r")) !== FALSE) {
$row=0;
$feature = new \Thelia\Model\Feature();
$feature
@@ -230,7 +232,7 @@ function createCategories($con)
{
echo "start creating categories\n";
$categories = array();
- if (($handle = fopen(THELIA_ROOT . '/install/import/categories.csv', "r")) !== FALSE) {
+ if (($handle = fopen(THELIA_ROOT . '/setup/import/categories.csv', "r")) !== FALSE) {
$row=0;
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
$row++;
@@ -257,7 +259,7 @@ function createCategories($con)
function createColors($con)
{
echo "start creating colors attributes\n";
- if (($handle = fopen(THELIA_ROOT . '/install/import/colors.csv', "r")) !== FALSE) {
+ if (($handle = fopen(THELIA_ROOT . '/setup/import/colors.csv', "r")) !== FALSE) {
$row=0;
$attribute = new \Thelia\Model\Attribute();
$attribute
diff --git a/install/import/brand.csv b/setup/import/brand.csv
similarity index 100%
rename from install/import/brand.csv
rename to setup/import/brand.csv
diff --git a/install/import/categories.csv b/setup/import/categories.csv
similarity index 100%
rename from install/import/categories.csv
rename to setup/import/categories.csv
diff --git a/install/import/colors.csv b/setup/import/colors.csv
similarity index 100%
rename from install/import/colors.csv
rename to setup/import/colors.csv
diff --git a/install/import/images/PROD001-1.jpg b/setup/import/images/PROD001-1.jpg
similarity index 100%
rename from install/import/images/PROD001-1.jpg
rename to setup/import/images/PROD001-1.jpg
diff --git a/install/import/images/PROD001-2.jpg b/setup/import/images/PROD001-2.jpg
similarity index 100%
rename from install/import/images/PROD001-2.jpg
rename to setup/import/images/PROD001-2.jpg
diff --git a/install/import/images/PROD001-3.jpg b/setup/import/images/PROD001-3.jpg
similarity index 100%
rename from install/import/images/PROD001-3.jpg
rename to setup/import/images/PROD001-3.jpg
diff --git a/install/import/images/PROD001-4.jpg b/setup/import/images/PROD001-4.jpg
similarity index 100%
rename from install/import/images/PROD001-4.jpg
rename to setup/import/images/PROD001-4.jpg
diff --git a/install/import/images/PROD001-5.jpg b/setup/import/images/PROD001-5.jpg
similarity index 100%
rename from install/import/images/PROD001-5.jpg
rename to setup/import/images/PROD001-5.jpg
diff --git a/install/import/images/PROD002-1.jpg b/setup/import/images/PROD002-1.jpg
similarity index 100%
rename from install/import/images/PROD002-1.jpg
rename to setup/import/images/PROD002-1.jpg
diff --git a/install/import/images/PROD002-2.jpg b/setup/import/images/PROD002-2.jpg
similarity index 100%
rename from install/import/images/PROD002-2.jpg
rename to setup/import/images/PROD002-2.jpg
diff --git a/install/import/images/PROD002-3.jpg b/setup/import/images/PROD002-3.jpg
similarity index 100%
rename from install/import/images/PROD002-3.jpg
rename to setup/import/images/PROD002-3.jpg
diff --git a/install/import/images/PROD002-4.jpg b/setup/import/images/PROD002-4.jpg
similarity index 100%
rename from install/import/images/PROD002-4.jpg
rename to setup/import/images/PROD002-4.jpg
diff --git a/install/import/images/PROD002-5.jpg b/setup/import/images/PROD002-5.jpg
similarity index 100%
rename from install/import/images/PROD002-5.jpg
rename to setup/import/images/PROD002-5.jpg
diff --git a/install/import/images/PROD002-6.jpg b/setup/import/images/PROD002-6.jpg
similarity index 100%
rename from install/import/images/PROD002-6.jpg
rename to setup/import/images/PROD002-6.jpg
diff --git a/install/import/images/PROD003-1.jpg b/setup/import/images/PROD003-1.jpg
similarity index 100%
rename from install/import/images/PROD003-1.jpg
rename to setup/import/images/PROD003-1.jpg
diff --git a/install/import/images/PROD003-2.jpg b/setup/import/images/PROD003-2.jpg
similarity index 100%
rename from install/import/images/PROD003-2.jpg
rename to setup/import/images/PROD003-2.jpg
diff --git a/install/import/images/PROD003-3.jpg b/setup/import/images/PROD003-3.jpg
similarity index 100%
rename from install/import/images/PROD003-3.jpg
rename to setup/import/images/PROD003-3.jpg
diff --git a/install/import/images/PROD004-1.jpg b/setup/import/images/PROD004-1.jpg
similarity index 100%
rename from install/import/images/PROD004-1.jpg
rename to setup/import/images/PROD004-1.jpg
diff --git a/install/import/images/PROD004-2.jpg b/setup/import/images/PROD004-2.jpg
similarity index 100%
rename from install/import/images/PROD004-2.jpg
rename to setup/import/images/PROD004-2.jpg
diff --git a/install/import/images/PROD005-1.jpg b/setup/import/images/PROD005-1.jpg
similarity index 100%
rename from install/import/images/PROD005-1.jpg
rename to setup/import/images/PROD005-1.jpg
diff --git a/install/import/images/PROD005-2.jpg b/setup/import/images/PROD005-2.jpg
similarity index 100%
rename from install/import/images/PROD005-2.jpg
rename to setup/import/images/PROD005-2.jpg
diff --git a/install/import/images/PROD005-3.jpg b/setup/import/images/PROD005-3.jpg
similarity index 100%
rename from install/import/images/PROD005-3.jpg
rename to setup/import/images/PROD005-3.jpg
diff --git a/install/import/images/PROD005-4.jpg b/setup/import/images/PROD005-4.jpg
similarity index 100%
rename from install/import/images/PROD005-4.jpg
rename to setup/import/images/PROD005-4.jpg
diff --git a/install/import/images/PROD005-5.jpg b/setup/import/images/PROD005-5.jpg
similarity index 100%
rename from install/import/images/PROD005-5.jpg
rename to setup/import/images/PROD005-5.jpg
diff --git a/install/import/images/PROD005-6.jpg b/setup/import/images/PROD005-6.jpg
similarity index 100%
rename from install/import/images/PROD005-6.jpg
rename to setup/import/images/PROD005-6.jpg
diff --git a/install/import/images/PROD006-1.jpg b/setup/import/images/PROD006-1.jpg
similarity index 100%
rename from install/import/images/PROD006-1.jpg
rename to setup/import/images/PROD006-1.jpg
diff --git a/install/import/images/PROD006-2.jpg b/setup/import/images/PROD006-2.jpg
similarity index 100%
rename from install/import/images/PROD006-2.jpg
rename to setup/import/images/PROD006-2.jpg
diff --git a/install/import/images/PROD006-3.jpg b/setup/import/images/PROD006-3.jpg
similarity index 100%
rename from install/import/images/PROD006-3.jpg
rename to setup/import/images/PROD006-3.jpg
diff --git a/install/import/images/PROD006-4.jpg b/setup/import/images/PROD006-4.jpg
similarity index 100%
rename from install/import/images/PROD006-4.jpg
rename to setup/import/images/PROD006-4.jpg
diff --git a/install/import/images/PROD006-5.jpg b/setup/import/images/PROD006-5.jpg
similarity index 100%
rename from install/import/images/PROD006-5.jpg
rename to setup/import/images/PROD006-5.jpg
diff --git a/install/import/images/PROD006-6.jpg b/setup/import/images/PROD006-6.jpg
similarity index 100%
rename from install/import/images/PROD006-6.jpg
rename to setup/import/images/PROD006-6.jpg
diff --git a/install/import/images/PROD007-1.jpg b/setup/import/images/PROD007-1.jpg
similarity index 100%
rename from install/import/images/PROD007-1.jpg
rename to setup/import/images/PROD007-1.jpg
diff --git a/install/import/images/PROD007-2.jpg b/setup/import/images/PROD007-2.jpg
similarity index 100%
rename from install/import/images/PROD007-2.jpg
rename to setup/import/images/PROD007-2.jpg
diff --git a/install/import/images/PROD007-3.jpg b/setup/import/images/PROD007-3.jpg
similarity index 100%
rename from install/import/images/PROD007-3.jpg
rename to setup/import/images/PROD007-3.jpg
diff --git a/install/import/images/PROD007-4.jpg b/setup/import/images/PROD007-4.jpg
similarity index 100%
rename from install/import/images/PROD007-4.jpg
rename to setup/import/images/PROD007-4.jpg
diff --git a/install/import/images/PROD008-1.jpg b/setup/import/images/PROD008-1.jpg
similarity index 100%
rename from install/import/images/PROD008-1.jpg
rename to setup/import/images/PROD008-1.jpg
diff --git a/install/import/images/PROD008-2.jpg b/setup/import/images/PROD008-2.jpg
similarity index 100%
rename from install/import/images/PROD008-2.jpg
rename to setup/import/images/PROD008-2.jpg
diff --git a/install/import/images/PROD008-3.jpg b/setup/import/images/PROD008-3.jpg
similarity index 100%
rename from install/import/images/PROD008-3.jpg
rename to setup/import/images/PROD008-3.jpg
diff --git a/install/import/images/PROD008-4.jpg b/setup/import/images/PROD008-4.jpg
similarity index 100%
rename from install/import/images/PROD008-4.jpg
rename to setup/import/images/PROD008-4.jpg
diff --git a/install/import/images/PROD008-5.jpg b/setup/import/images/PROD008-5.jpg
similarity index 100%
rename from install/import/images/PROD008-5.jpg
rename to setup/import/images/PROD008-5.jpg
diff --git a/install/import/images/PROD009-1.jpg b/setup/import/images/PROD009-1.jpg
similarity index 100%
rename from install/import/images/PROD009-1.jpg
rename to setup/import/images/PROD009-1.jpg
diff --git a/install/import/images/PROD009-2.jpg b/setup/import/images/PROD009-2.jpg
similarity index 100%
rename from install/import/images/PROD009-2.jpg
rename to setup/import/images/PROD009-2.jpg
diff --git a/install/import/images/PROD009-3.jpg b/setup/import/images/PROD009-3.jpg
similarity index 100%
rename from install/import/images/PROD009-3.jpg
rename to setup/import/images/PROD009-3.jpg
diff --git a/install/import/images/PROD010-1.jpg b/setup/import/images/PROD010-1.jpg
similarity index 100%
rename from install/import/images/PROD010-1.jpg
rename to setup/import/images/PROD010-1.jpg
diff --git a/install/import/images/PROD010-2.jpg b/setup/import/images/PROD010-2.jpg
similarity index 100%
rename from install/import/images/PROD010-2.jpg
rename to setup/import/images/PROD010-2.jpg
diff --git a/install/import/images/PROD010-3.jpg b/setup/import/images/PROD010-3.jpg
similarity index 100%
rename from install/import/images/PROD010-3.jpg
rename to setup/import/images/PROD010-3.jpg
diff --git a/install/import/images/PROD010-4.jpg b/setup/import/images/PROD010-4.jpg
similarity index 100%
rename from install/import/images/PROD010-4.jpg
rename to setup/import/images/PROD010-4.jpg
diff --git a/install/import/images/PROD011-1.jpg b/setup/import/images/PROD011-1.jpg
similarity index 100%
rename from install/import/images/PROD011-1.jpg
rename to setup/import/images/PROD011-1.jpg
diff --git a/install/import/images/PROD011-2.jpg b/setup/import/images/PROD011-2.jpg
similarity index 100%
rename from install/import/images/PROD011-2.jpg
rename to setup/import/images/PROD011-2.jpg
diff --git a/install/import/images/PROD011-3.jpg b/setup/import/images/PROD011-3.jpg
similarity index 100%
rename from install/import/images/PROD011-3.jpg
rename to setup/import/images/PROD011-3.jpg
diff --git a/install/import/images/PROD011-4.jpg b/setup/import/images/PROD011-4.jpg
similarity index 100%
rename from install/import/images/PROD011-4.jpg
rename to setup/import/images/PROD011-4.jpg
diff --git a/install/import/images/PROD012-1.jpg b/setup/import/images/PROD012-1.jpg
similarity index 100%
rename from install/import/images/PROD012-1.jpg
rename to setup/import/images/PROD012-1.jpg
diff --git a/install/import/images/PROD012-2.jpg b/setup/import/images/PROD012-2.jpg
similarity index 100%
rename from install/import/images/PROD012-2.jpg
rename to setup/import/images/PROD012-2.jpg
diff --git a/install/import/images/PROD013-1.jpg b/setup/import/images/PROD013-1.jpg
similarity index 100%
rename from install/import/images/PROD013-1.jpg
rename to setup/import/images/PROD013-1.jpg
diff --git a/install/import/images/PROD014-1.jpg b/setup/import/images/PROD014-1.jpg
similarity index 100%
rename from install/import/images/PROD014-1.jpg
rename to setup/import/images/PROD014-1.jpg
diff --git a/install/import/images/PROD014-2.jpg b/setup/import/images/PROD014-2.jpg
similarity index 100%
rename from install/import/images/PROD014-2.jpg
rename to setup/import/images/PROD014-2.jpg
diff --git a/install/import/images/PROD014-3.jpg b/setup/import/images/PROD014-3.jpg
similarity index 100%
rename from install/import/images/PROD014-3.jpg
rename to setup/import/images/PROD014-3.jpg
diff --git a/install/import/images/PROD014-4.jpg b/setup/import/images/PROD014-4.jpg
similarity index 100%
rename from install/import/images/PROD014-4.jpg
rename to setup/import/images/PROD014-4.jpg
diff --git a/install/import/images/PROD015-1.jpg b/setup/import/images/PROD015-1.jpg
similarity index 100%
rename from install/import/images/PROD015-1.jpg
rename to setup/import/images/PROD015-1.jpg
diff --git a/install/import/images/PROD015-2.jpg b/setup/import/images/PROD015-2.jpg
similarity index 100%
rename from install/import/images/PROD015-2.jpg
rename to setup/import/images/PROD015-2.jpg
diff --git a/install/import/images/PROD016-1.jpg b/setup/import/images/PROD016-1.jpg
similarity index 100%
rename from install/import/images/PROD016-1.jpg
rename to setup/import/images/PROD016-1.jpg
diff --git a/install/import/images/PROD017-1.jpg b/setup/import/images/PROD017-1.jpg
similarity index 100%
rename from install/import/images/PROD017-1.jpg
rename to setup/import/images/PROD017-1.jpg
diff --git a/install/import/images/PROD017-2.jpg b/setup/import/images/PROD017-2.jpg
similarity index 100%
rename from install/import/images/PROD017-2.jpg
rename to setup/import/images/PROD017-2.jpg
diff --git a/install/import/images/PROD017-3.jpg b/setup/import/images/PROD017-3.jpg
similarity index 100%
rename from install/import/images/PROD017-3.jpg
rename to setup/import/images/PROD017-3.jpg
diff --git a/install/import/images/PROD017-4.jpg b/setup/import/images/PROD017-4.jpg
similarity index 100%
rename from install/import/images/PROD017-4.jpg
rename to setup/import/images/PROD017-4.jpg
diff --git a/install/import/images/PROD018-1.jpg b/setup/import/images/PROD018-1.jpg
similarity index 100%
rename from install/import/images/PROD018-1.jpg
rename to setup/import/images/PROD018-1.jpg
diff --git a/install/import/images/PROD019-1.jpg b/setup/import/images/PROD019-1.jpg
similarity index 100%
rename from install/import/images/PROD019-1.jpg
rename to setup/import/images/PROD019-1.jpg
diff --git a/install/import/images/PROD019-2.jpg b/setup/import/images/PROD019-2.jpg
similarity index 100%
rename from install/import/images/PROD019-2.jpg
rename to setup/import/images/PROD019-2.jpg
diff --git a/install/import/images/PROD019-3.jpg b/setup/import/images/PROD019-3.jpg
similarity index 100%
rename from install/import/images/PROD019-3.jpg
rename to setup/import/images/PROD019-3.jpg
diff --git a/install/import/images/PROD019-4.jpg b/setup/import/images/PROD019-4.jpg
similarity index 100%
rename from install/import/images/PROD019-4.jpg
rename to setup/import/images/PROD019-4.jpg
diff --git a/install/import/images/PROD019-5.jpg b/setup/import/images/PROD019-5.jpg
similarity index 100%
rename from install/import/images/PROD019-5.jpg
rename to setup/import/images/PROD019-5.jpg
diff --git a/install/import/images/PROD020-1.jpg b/setup/import/images/PROD020-1.jpg
similarity index 100%
rename from install/import/images/PROD020-1.jpg
rename to setup/import/images/PROD020-1.jpg
diff --git a/install/import/images/PROD021-1.jpg b/setup/import/images/PROD021-1.jpg
similarity index 100%
rename from install/import/images/PROD021-1.jpg
rename to setup/import/images/PROD021-1.jpg
diff --git a/install/import/images/PROD021-2.jpg b/setup/import/images/PROD021-2.jpg
similarity index 100%
rename from install/import/images/PROD021-2.jpg
rename to setup/import/images/PROD021-2.jpg
diff --git a/install/import/images/PROD021-3.jpg b/setup/import/images/PROD021-3.jpg
similarity index 100%
rename from install/import/images/PROD021-3.jpg
rename to setup/import/images/PROD021-3.jpg
diff --git a/install/import/images/PROD021-4.jpg b/setup/import/images/PROD021-4.jpg
similarity index 100%
rename from install/import/images/PROD021-4.jpg
rename to setup/import/images/PROD021-4.jpg
diff --git a/install/import/images/PROD022-1.jpg b/setup/import/images/PROD022-1.jpg
similarity index 100%
rename from install/import/images/PROD022-1.jpg
rename to setup/import/images/PROD022-1.jpg
diff --git a/install/import/images/PROD022-2.jpg b/setup/import/images/PROD022-2.jpg
similarity index 100%
rename from install/import/images/PROD022-2.jpg
rename to setup/import/images/PROD022-2.jpg
diff --git a/install/import/images/PROD022-3.jpg b/setup/import/images/PROD022-3.jpg
similarity index 100%
rename from install/import/images/PROD022-3.jpg
rename to setup/import/images/PROD022-3.jpg
diff --git a/install/import/images/PROD022-4.jpg b/setup/import/images/PROD022-4.jpg
similarity index 100%
rename from install/import/images/PROD022-4.jpg
rename to setup/import/images/PROD022-4.jpg
diff --git a/install/import/images/PROD022-5.jpg b/setup/import/images/PROD022-5.jpg
similarity index 100%
rename from install/import/images/PROD022-5.jpg
rename to setup/import/images/PROD022-5.jpg
diff --git a/install/import/images/PROD023-1.jpg b/setup/import/images/PROD023-1.jpg
similarity index 100%
rename from install/import/images/PROD023-1.jpg
rename to setup/import/images/PROD023-1.jpg
diff --git a/install/import/images/PROD023-2.jpg b/setup/import/images/PROD023-2.jpg
similarity index 100%
rename from install/import/images/PROD023-2.jpg
rename to setup/import/images/PROD023-2.jpg
diff --git a/install/import/images/PROD023-3.jpg b/setup/import/images/PROD023-3.jpg
similarity index 100%
rename from install/import/images/PROD023-3.jpg
rename to setup/import/images/PROD023-3.jpg
diff --git a/install/import/images/PROD023-4.jpg b/setup/import/images/PROD023-4.jpg
similarity index 100%
rename from install/import/images/PROD023-4.jpg
rename to setup/import/images/PROD023-4.jpg
diff --git a/install/import/images/PROD023-5.jpg b/setup/import/images/PROD023-5.jpg
similarity index 100%
rename from install/import/images/PROD023-5.jpg
rename to setup/import/images/PROD023-5.jpg
diff --git a/install/import/images/PROD023-6.jpg b/setup/import/images/PROD023-6.jpg
similarity index 100%
rename from install/import/images/PROD023-6.jpg
rename to setup/import/images/PROD023-6.jpg
diff --git a/install/import/images/PROD024-1.jpg b/setup/import/images/PROD024-1.jpg
similarity index 100%
rename from install/import/images/PROD024-1.jpg
rename to setup/import/images/PROD024-1.jpg
diff --git a/install/import/images/PROD024-2.jpg b/setup/import/images/PROD024-2.jpg
similarity index 100%
rename from install/import/images/PROD024-2.jpg
rename to setup/import/images/PROD024-2.jpg
diff --git a/install/import/images/PROD024-3.jpg b/setup/import/images/PROD024-3.jpg
similarity index 100%
rename from install/import/images/PROD024-3.jpg
rename to setup/import/images/PROD024-3.jpg
diff --git a/install/import/images/PROD024-4.jpg b/setup/import/images/PROD024-4.jpg
similarity index 100%
rename from install/import/images/PROD024-4.jpg
rename to setup/import/images/PROD024-4.jpg
diff --git a/install/import/images/PROD024-5.jpg b/setup/import/images/PROD024-5.jpg
similarity index 100%
rename from install/import/images/PROD024-5.jpg
rename to setup/import/images/PROD024-5.jpg
diff --git a/install/import/images/PROD025-1.jpg b/setup/import/images/PROD025-1.jpg
similarity index 100%
rename from install/import/images/PROD025-1.jpg
rename to setup/import/images/PROD025-1.jpg
diff --git a/install/import/images/PROD025-2.jpg b/setup/import/images/PROD025-2.jpg
similarity index 100%
rename from install/import/images/PROD025-2.jpg
rename to setup/import/images/PROD025-2.jpg
diff --git a/install/import/images/PROD025-3.jpg b/setup/import/images/PROD025-3.jpg
similarity index 100%
rename from install/import/images/PROD025-3.jpg
rename to setup/import/images/PROD025-3.jpg
diff --git a/install/import/images/PROD026-1.jpg b/setup/import/images/PROD026-1.jpg
similarity index 100%
rename from install/import/images/PROD026-1.jpg
rename to setup/import/images/PROD026-1.jpg
diff --git a/install/import/images/PROD027-1.jpg b/setup/import/images/PROD027-1.jpg
similarity index 100%
rename from install/import/images/PROD027-1.jpg
rename to setup/import/images/PROD027-1.jpg
diff --git a/install/import/images/PROD028-1.jpg b/setup/import/images/PROD028-1.jpg
similarity index 100%
rename from install/import/images/PROD028-1.jpg
rename to setup/import/images/PROD028-1.jpg
diff --git a/install/import/images/PROD029-1.jpg b/setup/import/images/PROD029-1.jpg
similarity index 100%
rename from install/import/images/PROD029-1.jpg
rename to setup/import/images/PROD029-1.jpg
diff --git a/install/import/images/PROD030-1.jpg b/setup/import/images/PROD030-1.jpg
similarity index 100%
rename from install/import/images/PROD030-1.jpg
rename to setup/import/images/PROD030-1.jpg
diff --git a/install/import/images/PROD030-2.jpg b/setup/import/images/PROD030-2.jpg
similarity index 100%
rename from install/import/images/PROD030-2.jpg
rename to setup/import/images/PROD030-2.jpg
diff --git a/install/import/images/PROD030-3.jpg b/setup/import/images/PROD030-3.jpg
similarity index 100%
rename from install/import/images/PROD030-3.jpg
rename to setup/import/images/PROD030-3.jpg
diff --git a/install/import/images/PROD030-4.jpg b/setup/import/images/PROD030-4.jpg
similarity index 100%
rename from install/import/images/PROD030-4.jpg
rename to setup/import/images/PROD030-4.jpg
diff --git a/install/import/products.csv b/setup/import/products.csv
similarity index 100%
rename from install/import/products.csv
rename to setup/import/products.csv
diff --git a/install/insert.sql b/setup/insert.sql
similarity index 73%
rename from install/insert.sql
rename to setup/insert.sql
index 2d53b3801..2da553904 100644
--- a/install/insert.sql
+++ b/setup/insert.sql
@@ -1,8 +1,10 @@
INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`date_format`,`time_format`,`datetime_format`,`decimal_separator`,`thousands_separator`,`decimals`,`by_default`,`created_at`,`updated_at`)VALUES
(1, 'Français', 'fr', 'fr_FR', '', 'd/m/Y', 'H:i:s', 'd/m/y H:i:s', ',', ' ', '2', '0', NOW(), NOW()),
(2, 'English', 'en', 'en_US', '', 'm-d-Y', 'h:i:s', 'm-d-Y h:i:s', '.', ' ', '2', '1', NOW(), NOW()),
-(3, 'castellano', 'es', 'es_ES', '', 'm-d-Y', 'h:i:s', 'm-d-Y h:i:s', ',', '.', '2', '0', NOW(), NOW()),
-(4, 'Italiano', 'it', 'it_IT', '', 'd/m/Y', 'H:i:s', 'd/m/y H:i:s', ',', ' ', '2', '0', NOW(), NOW());
+(3, 'Castellano', 'es', 'es_ES', '', 'm-d-Y', 'h:i:s', 'm-d-Y h:i:s', ',', '.', '2', '0', NOW(), NOW()),
+(4, 'Italiano', 'it', 'it_IT', '', 'd/m/Y', 'H:i:s', 'd/m/y H:i:s', ',', ' ', '2', '0', NOW(), NOW()),
+(5, 'Russian', 'ru', 'ru_RU', '', 'j.n.Y', 'H:i:s', 'j.n.Y H:i:s', ',', ' ', '2', 0, NOW(), NOW()),
+(6, 'Czech', 'cs', 'cs_CZ', '', 'j.n.Y', 'H:i:s', 'j.n.Y H:i:s', ',', ' ', '2', 0, NOW(), NOW());
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
('session_config.handlers', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler', 0, 0, NOW(), NOW()),
@@ -39,11 +41,15 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('store_name','', 0, 1, NOW(), NOW()),
('store_email','', 0, 1, NOW(), NOW()),
('one_domain_foreach_lang','0', 1, 1, NOW(), NOW()),
-('thelia_version','2.0.0-RC1', 1, 1, NOW(), NOW()),
+('thelia_version','2.0.1', 1, 1, NOW(), NOW()),
('thelia_major_version','2', 1, 1, NOW(), NOW()),
('thelia_minus_version','0', 1, 1, NOW(), NOW()),
-('thelia_release_version','0', 1, 1, NOW(), NOW()),
-('thelia_extra_version','RC1', 1, 1, NOW(), NOW());
+('thelia_release_version','1', 1, 1, NOW(), NOW()),
+('thelia_extra_version','', 1, 1, NOW(), NOW()),
+('front_cart_country_cookie_name','fcccn', 1, 1, NOW(), NOW()),
+('front_cart_country_cookie_expires','2592000', 1, 1, NOW(), NOW()),
+('sitemap_ttl','7200', 1, 1, NOW(), NOW()),
+('feed_ttl','7200', 1, 1, NOW(), NOW());
INSERT INTO `config_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
@@ -1269,7 +1275,17 @@ INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES
(21, 'admin.configuration.shipping-zone', NOW(), NOW()),
(22, 'admin.configuration.tax', NOW(), NOW()),
(23, 'admin.configuration.template', NOW(), NOW()),
-(24, 'admin.configuration.system-log', NOW(), NOW());
+(24, 'admin.configuration.system-log', NOW(), NOW()),
+(25, 'admin.cache', NOW(), NOW()),
+(26, 'admin.home', NOW(), NOW()),
+(27, 'admin.configuration.store', NOW(), NOW()),
+(28, 'admin.configuration.variable', NOW(), NOW()),
+(29, 'admin.configuration.admin-logs', NOW(), NOW()),
+(30, 'admin.configuration.system-logs', NOW(), NOW()),
+(31, 'admin.configuration.advanced', NOW(), NOW()),
+(32, 'admin.configuration.translations', NOW(), NOW()),
+(33, 'admin.export', NOW(), NOW()),
+(34, 'admin.tools', NOW(), NOW());
/**
generated with command : php Thelia thelia:generate-resources --output sql-i18n
@@ -1322,16 +1338,35 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES
(23, 'en_US', 'Configuration / Template'),
(23, 'fr_FR', 'Configuration / Template'),
(24, 'en_US', 'Configuration / System Log'),
-(24, 'fr_FR', 'Configuration / Logs système');
+(24, 'fr_FR', 'Configuration / Logs système'),
+(25, 'en_US', 'Configuration / Cache'),
+(25, 'fr_FR', 'Configuration / Cache'),
+(26, 'en_US', 'Back-office home page'),
+(26, 'fr_FR', 'Page d''acceuil de l''administration'),
+(27, 'en_US', 'Store information configuration'),
+(27, 'fr_FR', 'Informations sur la boutique'),
+(28, 'en_US', 'Configuration variables'),
+(28, 'fr_FR', 'Variables de configuration'),
+(29, 'en_US', 'View administration logs'),
+(29, 'fr_FR', 'Consulter les logs d''administration'),
+(30, 'en_US', 'Logging system configuration'),
+(30, 'fr_FR', 'Configuration du système de log'),
+(31, 'en_US', 'Advanced configuration'),
+(31, 'fr_FR', 'Configuration avancée'),
+(32, 'en_US', 'Translations'),
+(32, 'fr_FR', 'Traductions'),
+(33, 'en_US', 'Back-office export management'),
+(33, 'fr_FR', 'gestion des exports'),
+(34, 'en_US', 'Tools panel'),
+(34, 'fr_FR', 'Outils');
-INSERT INTO `message` (`id`, `name`, `secured`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by`) VALUES
-(1, 'order_confirmation', NULL, NOW(), NOW(), 2, NOW(), NULL),
-(2, 'lost_password', NULL, NOW(), NOW(), 2, NOW(), NULL);
+INSERT INTO `message` (`id`, `name`, `secured`, `text_layout_file_name`, `text_template_file_name`, `html_layout_file_name`, `html_template_file_name`, `created_at`, `updated_at`) VALUES
+(1, 'order_confirmation', NULL, NULL, NULL, NULL, 'order_confirmation.html', NOW(), NOW()),
+(2, 'lost_password', NULL, NULL, NULL, NULL, 'password.html', NOW(), NOW());
INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES
-(1, 'en_US', 'order confirmation', 'Commande : Commande : {$order_ref}', '{assign var="order_id" value=1}\r\n\r\n{loop name="order.invoice" type="order" id=$order_id customer="*"}\r\n {loop name="currency.order" type="currency" id=$CURRENCY}\r\n {assign "orderCurrency" $CODE}\r\n {/loop}\r\n{loop type="order_address" name="delivery_address" id=$INVOICE_ADDRESS}\r\n{loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}{$FIRSTNAME} {$LASTNAME}\\r\\n\r\n{$ADDRESS1} {$ADDRESS2} {$ADDRESS3}\\r\\n\r\n{$ZIPCODE} {$CITY}\\r\\n\r\n{loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}\\r\\n\r\n{/loop}\r\nConfirmation de commande {$REF} du {format_date date=$INVOICE_DATE}\\r\\n\\r\\n\r\nLes articles commandés:\\r\\n\r\n{loop type="order_product" name="order-products" order=$ID}\r\n{if $WAS_IN_PROMO == 1}\r\n {assign "realPrice" $PROMO_PRICE}\r\n {assign "realTax" $PROMO_PRICE_TAX}\r\n {assign "realTaxedPrice" $TAXED_PROMO_PRICE}\r\n{else}\r\n {assign "realPrice" $PRICE}\r\n {assign "realTax" $PRICE_TAX}\r\n {assign "realTaxedPrice" $TAXED_PRICE}\r\n{/if}\r\n \\r\\n\r\n Article : {$TITLE}\r\n{ifloop rel="combinations"}\r\n {loop type="order_product_attribute_combination" name="combinations" order_product=$ID}\r\n {$ATTRIBUTE_TITLE} - {$ATTRIBUTE_AVAILABILITY_TITLE}\\r\\n\r\n{/loop}\r\n{/ifloop}\\r\\n\r\n Quantité : {$QUANTITY}\\r\\n\r\n Prix unitaire TTC : {$realTaxedPrice} {$orderCurrency}\\r\\n\r\n{/loop}\r\n\\r\\n-----------------------------------------\\r\\n\r\nMontant total TTC : {$TOTAL_TAXED_AMOUNT - $POSTAGE} {$orderCurrency} \\r\\n\r\nFrais de port TTC : {$POSTAGE} {$orderCurrency} \\r\\n\r\nSomme totale: {$TOTAL_TAXED_AMOUNT} {$orderCurrency} \\r\\n\r\n==================================\\r\\n\\r\\n\r\nVotre facture est disponible dans la rubrique mon compte sur {config key="url_site"}\r\n{/loop}', '{loop name="order.invoice" type="order" id=$order_id customer="*"}\r\n {loop name="currency.order" type="currency" id=$CURRENCY}\r\n {assign "orderCurrency" $SYMBOL}\r\n {/loop}\r\n{loop type="customer" name="customer.invoice" id=$CUSTOMER current="0"}\r\n {assign var="customer_ref" value=$REF}\r\n{/loop}\r\n\r\n\r\n\r\n \r\n courriel de confirmation de commande de {config key="url_site"} \r\n {literal}\r\n \r\n {/literal}\r\n\r\n\r\n
\r\n
{config key="store_name"}
\r\n
Confirmation de commande
\r\n
N° {$REF} du {format_date date=$INVOICE_DATE output="date"}
Nom :\r\n {loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop} {$FIRSTNAME} {$LASTNAME}
\r\n
N° et rue :\r\n {$ADDRESS1}
\r\n
Complément : {$ADDRESS2}\r\n {$ADDRESS3}
\r\n
Code postal : {$ZIPCODE}
\r\n
Ville : {$CITY}
\r\n
Pays : {loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
\r\n
\r\n {/loop}\r\n
Le suivi de votre commande est disponible dans la rubrique mon compte sur {config key="url_site"}
\r\n
\r\n\r\n\r\n{/loop}'),
-(2, 'en_US', 'Your new password', 'Your new password', 'Your new passord is : {$password}', '\r\n\r\n\r\n\r\nchanging password email for {config key="urlsite"} \r\n{literal}\r\n\r\n{/literal}\r\n\r\n\r\n
\r\n
\r\n
{config key="store_name"}
\r\n
Changement de mot de passe
\r\n
You have lost your password \r\nYour new password is {$password}.
\r\n
\r\n
\r\n
Vous pouvez à présent vous connecter sur {config key="urlsite"}. Please, change this password after your first connection
\r\n\r\n'),
-(2, 'fr_FR', 'Votre nouveau mot de passe', 'Votre nouveau mot de passe', 'Votre nouveau mot de passe est : {$password}', '\r\n\r\n\r\n\r\ncourriel de confirmation de changement de mot de passe de {config key="urlsite"} \r\n{literal}\r\n\r\n{/literal}\r\n\r\n\r\n
\r\n
\r\n
{config key="store_name"}
\r\n
Changement de mot de passe
\r\n
Vous avez perdu votre mot de passe. \r\nVotre nouveau mot de passe est {$password}.
\r\n
\r\n
\r\n
Vous pouvez à présent vous connecter sur {config key="urlsite"}. N''oubliez pas de modifier votre mot de passe.
{intl l='A content could be attached to more than one folder. Select here the additional folders for this content.'}
{loop name="default_folder" type="folder" id=$DEFAULT_FOLDER}
- {intl l='You can change the default folder (%title) in the "General" tab.' title=$TITLE}
+ {intl l='You can change the default folder (%title) in the "General" tab.' title={$TITLE}}
{/loop}
{$exclude_from_tree = "-1"}
diff --git a/templates/backOffice/default/includes/document-upload-form.html b/templates/backOffice/default/includes/document-upload-form.html
index 6d0574fd2..7296def68 100644
--- a/templates/backOffice/default/includes/document-upload-form.html
+++ b/templates/backOffice/default/includes/document-upload-form.html
@@ -8,7 +8,7 @@ Parameters:
*}
{intl l='There is no images attached to this %type.' type=$imageType}
+
{intl l='There is no images attached to this %type.' type={$imageType}}
{/elseloop}
\ No newline at end of file
diff --git a/templates/backOffice/default/includes/inner-form-toolbar.html b/templates/backOffice/default/includes/inner-form-toolbar.html
index 92bee1af8..59d8acde7 100644
--- a/templates/backOffice/default/includes/inner-form-toolbar.html
+++ b/templates/backOffice/default/includes/inner-form-toolbar.html
@@ -4,7 +4,9 @@ A toolbar displayed in forms, to display language change flags, submit and close
Parameters:
- hide_flags: true / false. If true, the flags will not be visible
- - hide_submit_buttons: true / false. If true, only the close button will be deplayed.
+ - hide_submit_buttons: true / false. If true, only the close button will be displayed.
+ - hide_save_buttons: true / false. If true, the "Save" button will be hidden
+ - hide_save_and_close_button: true / false. If true, the "Save and close" button will be hidden
- show_currencies: true/false. If true, show the currency selection bar
- page_url: the current page URL. Default is $current_url. Used to switchedition anguage.
- close_url: no default. URL displayed when close button is clicked. If empty, the close button is not displayed.
@@ -21,7 +23,7 @@ Parameters:
{else}
{$lang_url = {url path={$page_url|default:$current_url nofilter} edit_language_id=$ID}}
{/if}
-
+
@@ -36,7 +38,7 @@ Parameters:
{intl l="There is currently no active module here."}
+
+
+{else}
+ x="{$smarty.capture.module_include nofilter}"
+{/if}
\ No newline at end of file
diff --git a/templates/backOffice/default/includes/pagination.html b/templates/backOffice/default/includes/pagination.html
new file mode 100644
index 000000000..fd560ef79
--- /dev/null
+++ b/templates/backOffice/default/includes/pagination.html
@@ -0,0 +1,69 @@
+{*
+A generic pager for thelia back-office
+
+Parameters :
+
+$loop_ref: the name of the related loop
+$max_page_count : maximum number of pages to display
+$page_url : the URL of the page. The parameter page=x is appended to this URL.
+
+*}
+
+{* Prepare the URL so that the page=x parameter coumd be safely appended *}
+
+{if strpos($page_url, '?')}
+ {$page_url="$page_url&"}
+{else}
+ {$page_url="$page_url?"}
+{/if}
+
+
@@ -72,7 +89,7 @@
- {* Adding a new Shipping configuration *}
+ {* Adding a new Shipping zone *}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "creation_dialog"}
@@ -86,7 +103,7 @@
{form_field form=$form field="name"}
-
+
{/form_field}
@@ -99,10 +116,10 @@
file = "includes/generic-create-dialog.html"
dialog_id = "creation_dialog"
- dialog_title = {intl l="Create a new shipping configuration"}
+ dialog_title = {intl l="Create a new shipping zone"}
dialog_body = {$smarty.capture.creation_dialog nofilter}
- dialog_ok_label = {intl l="Create this shipping configuration"}
+ dialog_ok_label = {intl l="Create this shipping zone"}
dialog_cancel_label = {intl l="Cancel"}
form_action = {url path='/admin/configuration/shipping_configuration/create'}
@@ -123,8 +140,8 @@
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_dialog"
- dialog_title = {intl l="Delete shipping configuration"}
- dialog_message = {intl l="Do you really want to delete this shipping configuration ?"}
+ dialog_title = {intl l="Delete shipping zone"}
+ dialog_message = {intl l="Do you really want to delete this shipping zone ?"}
form_action = {url path='/admin/configuration/shipping_configuration/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
diff --git a/templates/backOffice/default/shipping-zones-edit.html b/templates/backOffice/default/shipping-zones-edit.html
index 6d76bc5eb..8a18a1f59 100644
--- a/templates/backOffice/default/shipping-zones-edit.html
+++ b/templates/backOffice/default/shipping-zones-edit.html
@@ -10,40 +10,51 @@
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
- {* the url the user is redirected to on login success *}
+ {* the url the user is redirected to on login success *}
{/form_field}
{form_field form=$form field='shipping_zone_id'}
-
+
{/form_field}
{form_field form=$form field='area_id'}
+ {intl l="There are no shipping zones attached to this module."}
+
+
+
+ {/elseloop}
@@ -86,6 +112,7 @@
+ {/loop}
@@ -96,17 +123,17 @@
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
- {* the url the user is redirected to on login success *}
+ {* the url the user is redirected to on login success *}
{/form_field}
{form_field form=$form field='shipping_zone_id'}
-
+
{/form_field}
{form_field form=$form field='area_id'}
{/form_field}
-
+ {module_include location='zone_delete_form'}
{/form}
{/capture}
diff --git a/templates/backOffice/default/shipping-zones.html b/templates/backOffice/default/shipping-zones.html
index 26f860770..6382930d2 100644
--- a/templates/backOffice/default/shipping-zones.html
+++ b/templates/backOffice/default/shipping-zones.html
@@ -21,18 +21,35 @@
+
+ {ifloop rel="area-not-attached"}
+
+
+
+ {intl l='Warning, some of your shipping zones are not attached to any delivery module:'}
+ {loop name="area-not-attached" type="area" unassigned=true}
+ {$NAME}{if $LOOP_COUNT < $LOOP_TOTAL},{else}.{/if}
+ {/loop}
+
{intl l='Enter one or more IP V4 addresses separated by ";". Leave empty to display logs for all IP addresses'}
- {intl l='Your current IP address is %ip' ip=$ip_address}
+ {intl l='Your current IP address is %ip' ip={$ip_address}}
{/form_field}
diff --git a/templates/backOffice/default/tax-edit.html b/templates/backOffice/default/tax-edit.html
index de2d39d1b..31ff9ccd9 100644
--- a/templates/backOffice/default/tax-edit.html
+++ b/templates/backOffice/default/tax-edit.html
@@ -54,7 +54,7 @@
{form_field form=$form field='title'}
- {intl l='Warning'}
- {intl l='Il seems that this string contains a Smarty variable ($). If \'s the case, it cannot be transleted properly.'}
-
- {/if}
-
-
-
-
-
-
-
-
-
-
- {else}
-
- {* Text is not displayed, put it in a hidden field *}
-
-
- {/if}
-
- {$idx = $idx + 1}
- {/foreach}
-
- {if isset($all_strings) }
-
- {if empty($all_strings) }
-
- {intl l='Did not found any text to translate. It\'s probably normal. If not, please be sure to use Smarty\'s "intl" function in templates, or the Translator::trans() method in PHP files.'}
-
- {intl l='Cannot translate all fields. According to your PHP configuration, forms cannot contains more than
- %current_max_input_vars input fields, but at least %required_max_input_vars are required. Please change the value of max_input_vars in your PHP configuration
- of change the translation file by hand.'
-
- current_max_input_vars=$current_max_input_vars
- required_max_input_vars=$required_max_input_vars
- }
-
+ {intl l='Warning'}
+ {intl l='Il seems that this string contains a Smarty variable ($). If \'s the case, it cannot be transleted properly.'}
+
+ {/if}
+
+
+
+
+
+
+
+
+
+
+ {else}
+
+ {* Text is not displayed, put it in a hidden field *}
+
+
+ {/if}
+
+ {$idx = $idx + 1}
+ {/foreach}
+
+ {if isset($all_strings) }
+
+ {if empty($all_strings) }
+
+ {intl l='Did not found any text to translate. It\'s probably normal. If not, please be sure to use Smarty\'s "intl" function in templates, or the Translator::trans() method in PHP files.'}
+
+ {intl l='Cannot translate all fields. According to your PHP configuration, forms cannot contains more than %current_max_input_vars input fields, but at least %required_max_input_vars are required. Please change the value of max_input_vars in your PHP configuration of change the translation file by hand.'
+ current_max_input_vars=$current_max_input_vars
+ required_max_input_vars=$required_max_input_vars
+ }
+
{intl l='Enter here the category name in the default language (%title)' title="$TITLE"}
+
{intl l='Enter here the category name in the default language (%title)' title={$TITLE}}
{form_field form=$form field='locale'}
diff --git a/templates/email/default/I18n/cs_CZ.php b/templates/email/default/I18n/cs_CZ.php
new file mode 100644
index 000000000..4906fa89d
--- /dev/null
+++ b/templates/email/default/I18n/cs_CZ.php
@@ -0,0 +1,36 @@
+ 'Všechna práva vyhrazena.',
+ 'Billing address:' => 'Fakturační adresa:',
+ 'Copyright' => 'Autorská práva',
+ 'Delivery address:' => 'Doručovací adresa:',
+ 'Delivery method:' => 'Způsob doručení:',
+ 'Email not displaying correctly?' => 'E-mail se nezobrazuje správně?',
+ 'For any questions, or concerns, feel free to contact %mail.' => 'V případě jakýchkoliv dotazů nebo připomínek, neváhejte nás kontaktovat na %mail.',
+ 'Here are the details of your purchase:' => 'Podrobnosti o nákupu:',
+ 'Hi there' => 'Zdravím',
+ 'Kind regards' => 'S pozdravem',
+ 'Order Number:' => 'Číslo objednávky:',
+ 'Order Total' => 'Objednávka celkem',
+ 'Order Total:' => 'Objednávka celkem:',
+ 'Our contact us at:' => 'Kontaktujte nás na:',
+ 'Our mailing address is:' => 'Naše poštovní adresa je:',
+ 'Paid With:' => 'Zaplaceno:',
+ 'Password' => 'Heslo',
+ 'Price in' => 'Cena v',
+ 'Purchase Date:' => 'Datum nákupu:',
+ 'Shipping:' => 'Poštovné:',
+ 'Support' => 'Podpora',
+ 'Thank you for your order!' => 'Děkujeme za objednávku!',
+ 'Thanks' => 'Děkuji',
+ 'Thelia V2' => 'Thelia V2',
+ 'Total' => 'Celkem',
+ 'View it in your browser' => 'Zobrazit v prohlížeči',
+ 'What You Purchased' => 'Co jste si zakoupili',
+ 'You can change your password in your user account by opening the "Change my password" link under your personal information' => 'Můžete změnit své heslo ve vašem uživatelském účtu tak, že otevře odkaz "Změnit heslo" v záložce vaše osobní údaje',
+ 'You have requested a new password for your account' => 'Požádali jste o nové heslo pro váš účet',
+ 'Your new password is' => 'Vaše nové heslo je',
+ 'Your order confirmation Nº %ref' => 'Potvrzení objednávky č. %ref',
+ 'Your password for %store' => 'Vaše heslo pro %store',
+);
diff --git a/templates/email/default/I18n/en_US.php b/templates/email/default/I18n/en_US.php
index 6d8ef0f1b..8e5c207ac 100644
--- a/templates/email/default/I18n/en_US.php
+++ b/templates/email/default/I18n/en_US.php
@@ -1,4 +1,36 @@
'All rights reserved.',
+ 'Billing address:' => 'Billing address:',
+ 'Copyright' => 'Copyright',
+ 'Delivery address:' => 'Delivery address:',
+ 'Delivery method:' => 'Delivery method:',
+ 'Email not displaying correctly?' => 'Email not displaying correctly?',
+ 'For any questions, or concerns, feel free to contact %mail.' => 'For any questions, or concerns, feel free to contact %mail.',
+ 'Here are the details of your purchase:' => 'Here are the details of your purchase:',
+ 'Hi there' => 'Hi there',
+ 'Kind regards' => 'Kind regards',
+ 'Order Number:' => 'Order Number:',
+ 'Order Total' => 'Order Total',
+ 'Order Total:' => 'Order Total:',
+ 'Our contact us at:' => 'Our contact us at:',
+ 'Our mailing address is:' => 'Our mailing address is:',
+ 'Paid With:' => 'Paid With:',
+ 'Password' => 'Password',
+ 'Price in' => 'Price in',
+ 'Purchase Date:' => 'Purchase Date:',
+ 'Shipping:' => 'Shipping:',
+ 'Support' => 'Support',
+ 'Thank you for your order!' => 'Thank you for your order!',
+ 'Thanks' => 'Thanks',
+ 'Thelia V2' => 'Thelia V2',
+ 'Total' => 'Total',
+ 'View it in your browser' => 'View it in your browser',
+ 'What You Purchased' => 'What You Purchased',
+ 'You can change your password in your user account by opening the "Change my password" link under your personal information' => 'You can change your password in your user account by opening the "Change my password" link under your personal information',
+ 'You have requested a new password for your account' => 'You have requested a new password for your account',
+ 'Your new password is' => 'Your new password is',
+ 'Your order confirmation Nº %ref' => 'Your order confirmation Nº %ref',
+ 'Your password for %store' => 'Your password for %store',
+);
diff --git a/templates/email/default/I18n/es_ES.php b/templates/email/default/I18n/es_ES.php
index 6d8ef0f1b..df9b7a9bf 100644
--- a/templates/email/default/I18n/es_ES.php
+++ b/templates/email/default/I18n/es_ES.php
@@ -1,4 +1,30 @@
'All rights reserved.',
+ 'Billing address:' => 'dirección de factura',
+ 'Copyright' => 'Copyright',
+ 'Delivery address:' => 'dirección de entraga',
+ 'Delivery method:' => 'entraga con : ',
+ 'Email not displaying correctly?' => 'No puedes ver correctamente el mail ?',
+ 'Here are the details of your purchase:' => 'Detalles del encarga',
+ 'Hi there' => 'Holà',
+ 'Kind regards' => 'Gracias',
+ 'Order Number:' => 'Entraga numero',
+ 'Order Total' => 'Total de la entraga',
+ 'Order Total:' => 'Total de la entraga',
+ 'Our mailing address is:' => 'Nuestra dirección',
+ 'Paid With:' => 'pagado con : ',
+ 'Password' => 'contraseña',
+ 'Shipping:' => 'envio',
+ 'Support' => 'Support',
+ 'Thank you for your order!' => 'Graciàs por su encarga',
+ 'Thanks' => 'Gracias ',
+ 'Thelia V2' => 'Thelia V2',
+ 'Total' => 'Total',
+ 'View it in your browser' => 'Ver en el navegador ',
+ 'You can change your password in your user account by opening the "Change my password" link under your personal information' => 'Puedes cambiar tu contraseña en tu cuenta',
+ 'Your new password is' => 'la nueva contraseña es',
+ 'Your order confirmation Nº %ref' => 'Numero de encarga : %ref',
+ 'Your password for %store' => 'contraseña por %store',
+);
diff --git a/templates/email/default/I18n/fr_FR.php b/templates/email/default/I18n/fr_FR.php
index 6d8ef0f1b..9e24f4495 100644
--- a/templates/email/default/I18n/fr_FR.php
+++ b/templates/email/default/I18n/fr_FR.php
@@ -1,4 +1,36 @@
'Tous droits réservés',
+ 'Billing address:' => 'Adresse de facturation : ',
+ 'Copyright' => 'Copyright',
+ 'Delivery address:' => 'Adresse de livraison : ',
+ 'Delivery method:' => 'Livré par : ',
+ 'Email not displaying correctly?' => 'Le mail ne s\'affiche pas correctement ?',
+ 'For any questions, or concerns, feel free to contact %mail.' => 'Pour toutes questions contactez nous par mail : %mail.',
+ 'Here are the details of your purchase:' => 'Voici les détails de votre commande',
+ 'Hi there' => 'Bonjour',
+ 'Kind regards' => 'Cordialement',
+ 'Order Number:' => 'Commande N° : ',
+ 'Order Total' => 'Total de la commande',
+ 'Order Total:' => 'Total de la commande : ',
+ 'Our contact us at:' => 'Contactez nous au',
+ 'Our mailing address is:' => 'Adresse postale',
+ 'Paid With:' => 'Payé par : ',
+ 'Password' => 'Mot de passe',
+ 'Price in' => 'Prix en',
+ 'Purchase Date:' => 'Date d\'achat : ',
+ 'Shipping:' => 'Frais de livraison',
+ 'Support' => 'SAV',
+ 'Thank you for your order!' => 'Merci pour votre commande',
+ 'Thanks' => 'Merci',
+ 'Thelia V2' => 'Thelia V2',
+ 'Total' => 'Total',
+ 'View it in your browser' => 'Voir dans le navigateur',
+ 'What You Purchased' => 'Ce que vous avez acheté',
+ 'You can change your password in your user account by opening the "Change my password" link under your personal information' => 'Vous pouvez changer votre mot de passe dans votre espace client',
+ 'You have requested a new password for your account' => 'Vous avez demandé un nouveau mot de passe',
+ 'Your new password is' => 'Votre nouveau mot de passe est',
+ 'Your order confirmation Nº %ref' => 'Confirmation de commande N° %ref',
+ 'Your password for %store' => 'Votre mot de passe pour %store',
+);
diff --git a/templates/email/default/I18n/ru_RU.php b/templates/email/default/I18n/ru_RU.php
new file mode 100644
index 000000000..73a6f76ff
--- /dev/null
+++ b/templates/email/default/I18n/ru_RU.php
@@ -0,0 +1,36 @@
+ 'Все права защищены.',
+ 'Billing address:' => 'Адрес плательщика:',
+ 'Copyright' => 'Авторское право',
+ 'Delivery address:' => 'Адрес доставки:',
+ 'Delivery method:' => 'Способ доставки:',
+ 'Email not displaying correctly?' => 'Письмо отображается неправильно?',
+ 'For any questions, or concerns, feel free to contact %mail.' => 'С любыми вопросами или предложениями Вы можете обратиться к нам на %mail.',
+ 'Here are the details of your purchase:' => 'Подробности Вашего заказа:',
+ 'Hi there' => 'Привет',
+ 'Kind regards' => 'С наилучшими пожеланиями',
+ 'Order Number:' => 'Номер заказа:',
+ 'Order Total' => 'Сумма заказа',
+ 'Order Total:' => 'Сумма заказа:',
+ 'Our contact us at:' => 'Наша контактная информация:',
+ 'Our mailing address is:' => 'Наш почтовый адрес:',
+ 'Paid With:' => 'Заплачено:',
+ 'Password' => 'Пароль',
+ 'Price in' => 'Цена в',
+ 'Purchase Date:' => 'Дата покупки:',
+ 'Shipping:' => 'Доставка:',
+ 'Support' => 'Поддержка',
+ 'Thank you for your order!' => 'Спасибо за заказ!',
+ 'Thanks' => 'Спасибо',
+ 'Thelia V2' => 'Thelia V2',
+ 'Total' => 'Итого',
+ 'View it in your browser' => 'Просмотреть в браузере',
+ 'What You Purchased' => 'То, что вы приобрели',
+ 'You can change your password in your user account by opening the "Change my password" link under your personal information' => 'Вы можете изменить свой пароль в учетной записи пользователя, открыв ссылку «Изменить пароль» в разделе личная информация',
+ 'You have requested a new password for your account' => 'Вы запросили новый пароль для Вашей учетной записи',
+ 'Your new password is' => 'Ваш новый пароль',
+ 'Your order confirmation Nº %ref' => 'Подтверждение заказа № %ref',
+ 'Your password for %store' => 'Ваш пароль на %store',
+);
diff --git a/templates/email/default/assets/img/header.jpg b/templates/email/default/assets/img/header.jpg
new file mode 100644
index 000000000..c80e16529
Binary files /dev/null and b/templates/email/default/assets/img/header.jpg differ
diff --git a/templates/email/default/assets/img/logo.gif b/templates/email/default/assets/img/logo.gif
new file mode 100644
index 000000000..cfa396641
Binary files /dev/null and b/templates/email/default/assets/img/logo.gif differ
diff --git a/templates/email/default/default-html-layout.tpl b/templates/email/default/default-html-layout.tpl
index 2e96d2f35..a40c9f013 100644
--- a/templates/email/default/default-html-layout.tpl
+++ b/templates/email/default/default-html-layout.tpl
@@ -1,3 +1,14 @@
+{*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************}
+
{*
This is the default HTML mail layout. Use {$message_body} as a placeholder for
the HTML message defined in the 'HTML Message' field in the back-office, or the
@@ -7,4 +18,8 @@ Be sure to use the nofilter modifier, to prevent HTML escaping.
DO NOT DELETE THIS FILE, some plugins may use it.
*}
+
+{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *}
+{default_translation_domain domain='email.default'}
+
{block name='message-body'}{$message_body nofilter}{/block}
\ No newline at end of file
diff --git a/templates/email/default/default-text-layout.tpl b/templates/email/default/default-text-layout.tpl
index aeb07e655..cd3d38a18 100644
--- a/templates/email/default/default-text-layout.tpl
+++ b/templates/email/default/default-text-layout.tpl
@@ -1,3 +1,14 @@
+{*************************************************************************************/
+/* This file is part of the Thelia package. */
+/* */
+/* Copyright (c) OpenStudio */
+/* email : dev@thelia.net */
+/* web : http://www.thelia.net */
+/* */
+/* For the full copyright and license information, please view the LICENSE.txt */
+/* file that was distributed with this source code. */
+/*************************************************************************************}
+
{*
This is the default TEXT mail layout. Use {$message_body} as a placeholder for
the text message defined in the 'TEXT Message' field in the back-office, or the
@@ -7,4 +18,8 @@ Be sure to use the nofilter modifier, to prevent HTML escaping.
DO NOT DELETE THIS FILE, some plugins may use it.
*}
+
+{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *}
+{default_translation_domain domain='email.default'}
+
{block name='message-body'}{$message_body nofilter}{/block}
\ No newline at end of file
diff --git a/templates/frontOffice/default/email/template.tpl b/templates/email/default/email-layout.tpl
similarity index 84%
rename from templates/frontOffice/default/email/template.tpl
rename to templates/email/default/email-layout.tpl
index 53eea9b00..72f8875a4 100644
--- a/templates/frontOffice/default/email/template.tpl
+++ b/templates/email/default/email-layout.tpl
@@ -1,5 +1,7 @@
+{default_translation_domain domain='email.default'}
+{declare_assets directory='assets'}
{assign var="url_site" value="{config key="url_site"}"}
-{assign var="company_name" value="{config key="company_name"}"}
+{assign var="company_name" value="{config key="store_name"}"}
{if not $company_name}
{assign var="company_name" value="{intl l='Thelia V2'}"}
{/if}
@@ -330,8 +332,8 @@ body,#bodyTable{
}
.preheaderContent a:link,.preheaderContent a:visited,.preheaderContent a .yshortcuts{
- color:#f49a17;
- }
+ color:#f49a17;
+}
.footerContent a:link,.footerContent a:visited,.footerContent a .yshortcuts{
color:#ffffff;
}
@@ -359,7 +361,7 @@ body,#bodyTable{
- {block name="email-intro"}{intl l="Welcome to Thelia. This is a demo site built with Thelia V2 an E-Commerce solution based on Symfony 2."}{/block}
+ {block name="email-intro"}{/block}
- If you don't want to change your password, just ignore this message.
- Thanks,
- - The Thelia V2 Team
-{/block}
diff --git a/templates/frontOffice/default/email/password.html b/templates/frontOffice/default/email/password.html
deleted file mode 100644
index ef58e0873..000000000
--- a/templates/frontOffice/default/email/password.html
+++ /dev/null
@@ -1,21 +0,0 @@
-{extends file="email/template.tpl"}
-
-{* Open in browser *}
-{block name="email-browsers"}{/block}
-
-{* Subject *}
-{block name="email-subject"}Your password for Thelia V2{/block}
-
-{* Title *}
-{block name="email-title"}Password{/block}
-
-{* Content *}
-{block name="email-content"}
- Hi there,
- You have requested a new password for your Thelia V2 account.
- Your new password is:
- __PASSWORD__
- You can change your password in your user account by opening the "Change my password" link under your personal information.
- Kind regards,
- - The Thelia V2 Team
-{/block}
diff --git a/templates/frontOffice/default/email/register.html b/templates/frontOffice/default/email/register.html
deleted file mode 100644
index 41b03418c..000000000
--- a/templates/frontOffice/default/email/register.html
+++ /dev/null
@@ -1,42 +0,0 @@
-{extends file="email/template.tpl"}
-
-{* Open in browser *}
-{block name="email-browsers"}{/block}
-
-{* Subject *}
-{block name="email-subject"}Welcome to Thelia V2{/block}
-
-{* Title *}
-{block name="email-title"}Welcome to Thelia V2{/block}
-
-{* Content *}
-{block name="email-content"}
- {assign var="customerId" value="1"}
-
-
-
Congratulations! You have successfully created an account on Thelia v2 demo site. Keep this email as a reference of your account details, and helpful links.