Il manquait quelques fichiers dans Git

This commit is contained in:
2024-01-18 12:02:32 +01:00
parent 485580e0b2
commit 15053f58f2
194 changed files with 63120 additions and 9403 deletions

15
.idea/deployment.xml generated Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" serverName="osiris.o2switch.net" remoteFilesAllowedToDisappearOnAutoupload="false" confirmBeforeUploading="false">
<option name="confirmBeforeUploading" value="false" />
<serverData>
<paths name="osiris.o2switch.net">
<serverdata>
<mappings>
<mapping deploy="/" local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>

1
.idea/php.xml generated
View File

@@ -105,6 +105,7 @@
<component name="PhpUnit"> <component name="PhpUnit">
<phpunit_settings> <phpunit_settings>
<PhpUnitSettings configuration_file_path="$PROJECT_DIR$/phpunit.xml" custom_loader_path="$PROJECT_DIR$/core/vendor/autoload.php" use_configuration_file="true" /> <PhpUnitSettings configuration_file_path="$PROJECT_DIR$/phpunit.xml" custom_loader_path="$PROJECT_DIR$/core/vendor/autoload.php" use_configuration_file="true" />
<PhpUnitSettings configuration_file_path="$PROJECT_DIR$/phpunit.xml" custom_loader_path="$PROJECT_DIR$/core/vendor/autoload.php" use_configuration_file="true" />
</phpunit_settings> </phpunit_settings>
</component> </component>
<component name="PsalmOptionsConfiguration"> <component name="PsalmOptionsConfiguration">

14
.idea/webServers.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WebServers">
<option name="servers">
<webServer id="09bd0d06-18db-4d53-9ae1-e0e7c57a6bdd" name="osiris.o2switch.net" url="http://osiris.o2switch.net">
<fileTransfer rootFolder="/public_html/thelia235" host="osiris.o2switch.net" port="21">
<advancedOptions>
<advancedOptions dataProtectionLevel="Private" passiveMode="true" shareSSLContext="true" />
</advancedOptions>
</fileTransfer>
</webServer>
</option>
</component>
</project>

242
.idea/workspace.xml generated
View File

@@ -9,87 +9,92 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e9efda16-0e17-4a4a-8328-e9581517920e" name="Default Changelist" comment="On rajoute le masquage des liens de connexion en haut du site, et les liens utiles dans le footer"> <list default="true" id="e9efda16-0e17-4a4a-8328-e9581517920e" name="Default Changelist" comment="On rajoute le masquage des liens de connexion en haut du site, et les liens utiles dans le footer">
<change afterPath="$PROJECT_DIR$/local/config/database.yml.old" afterDir="false" /> <change afterPath="$PROJECT_DIR$/local/media/images/module/Mercanet-4-logo-mercanet.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/HookContact/I18n/pt_PT.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/HookAdminHome/assets/css/82e8bbe.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Api/MercanetApi.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/assets/css/0199e40.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Config/config.xml" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/assets/css/616efc6.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Config/module.xml" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/css/c613eec.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Config/routing.xml" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/87491a1.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Controller/ConfigureController.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/ae92541.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Controller/PaymentController.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/flags/30f3da1.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/EventListeners/SendConfirmationEmail.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/flags/fb915a3.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Form/ConfigForm.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/007b503.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Hook/HookManager.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/69ba776.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/I18n/backOffice/default/en_US.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/6b8bbfb.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/I18n/backOffice/default/fr_FR.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/75a5d1e.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/I18n/email/default/en_US.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/a27cf27.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/I18n/email/default/fr_FR.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/bootstrap-datetimepicker/1a0822f.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/I18n/en_US.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/bootstrap-datetimepicker/9936e4f.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/I18n/fr_FR.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/bootstrap-editable/6857fd0.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Mercanet.php" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/bootstrap-select/a9acbf2.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/Readme.md" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/bootstrap-switch/19a5ecf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/composer.json" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/bootstrap/069555a.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/images/logo-mercanet.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/caee233.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/templates/backOffice/default/mercanet/module-configuration.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/ea058b9.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/templates/email/default/mercanet-payment-confirmation.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/f103bfb.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/local/modules/Mercanet/templates/email/default/mercanet-payment-confirmation.txt" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/jqplot/f1709f1.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/HookAdminHome/assets/css/ab7168b.css" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/jqplot/plugins/326464a.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/css/2a0bee8.css" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/jqplot/plugins/b168787.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/c3ec60c.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/4c98f91.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/d21c647.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/6927827.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/flags/0554b41.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/c3f114b.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/flags/c889d49.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/d724a4e.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/flags/cafae08.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/e24f148.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/flags/d447255.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/7dbe399.ico" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/52897dd.js" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/8a3a12f.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/bootstrap/ea5f30d.js" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/368cf99.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/525b2f7.js" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/8255475.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/8e9679c.js" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/3af6486.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/c8435fb.js" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/bootstrap/665888c.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/ca85678.js" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/libs/299a33e.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/js/libs/f1ee492.js" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/plugins/bootbox/a8b7803.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/2b80a46.ico" afterDir="false" /> <change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/less/5ca5826.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/a63a388.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/README.TXT" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/README.TXT" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/000b979.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/cache/utf8test.txt" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/cache/utf8test.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/0a3377d.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/doc/read_me.txt" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/doc/read_me.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/1ae366a.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/examples/read_me.txt" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/examples/read_me.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/85e916b.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/almohanad.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/almohanad.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/13498ac.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/arialunicid0.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/arialunicid0.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/bootstrap/00e1466.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/symbol.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/symbol.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/libs/3652b4c.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/utils/makeallttffonts.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/utils/makeallttffonts.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/plugins/bootbox/65ef9a2.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/utils/src/readme.txt" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/utils/src/readme.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/less/15f4a02.css" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/zapfdingbats.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/zapfdingbats.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/Capture décran 2021-02-18 à 18.15.49 2.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/zarbold.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/fonts/zarbold.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/Capture décran 2021-02-21 à 18.21.07.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/images/read_me.txt" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/images/read_me.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/Capture décran 2021-05-01 à 15.21.52.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/tcpdf.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/ensepar/tcpdf/tcpdf.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/Capture décran 2021-05-01 à 15.22.34.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Configurable.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Configurable.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/Capture décran 2021-05-01 à 15.23.19.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Exception/Chunk.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Exception/Chunk.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/EIS/image002.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Exception/Compiler.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Exception/Compiler.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/EIS/image003.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Exception/Parser.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Exception/Parser.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/IMG_8595.jpeg" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Output/Mapped.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/Output/Mapped.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/thumbs/image003 (4).png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/SourceMap/Generator.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/oyejorge/less.php/lib/Less/SourceMap/Generator.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/Capture décran 2021-02-18 à 18.15.49 2.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1250.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1250.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/Capture décran 2021-02-21 à 18.21.07.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1251.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1251.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/Capture décran 2021-05-01 à 15.21.52.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1252.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1252.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/Capture décran 2021-05-01 à 15.22.34.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1253.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1253.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/Capture décran 2021-05-01 à 15.23.19.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1254.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1254.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/EIS Sclerotherapie Echoguidee Initiation 1er decembre 2023 Programme.pdf" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1255.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1255.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/EIS Sclerotherapie Echoguidee Initiation 1er decembre 2023 Programme_1.pdf" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1257.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1257.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/EIS _ Sclérothérapie des veines réticulaires et des télangiectasies _ 9 decembre 2023.pdf" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1258.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp1258.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/EIS _ Sclérothérapie des veines réticulaires et des télangiectasies _ 9 decembre 2023_1.pdf" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp874.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/cp874.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/EIS/EIS _ 2022 _ Sclerotherapie Echoguidee à la Mousse _Expert 3 D_25 novembre 22.pdf" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-1.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-1.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/EIS/EIS _ 2022 _ Sclerotherapie Echoguidee à la Mousse _Perfectionnement_7 octobre 22.pdf" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-11.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-11.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/EIS/image002.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-15.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-15.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/EIS/image003.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-16.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-16.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/IMG_8595.jpeg" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-2.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-2.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/INICIO/INICIO.rtf" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-4.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-4.map" afterDir="false" />
<change afterPath="$PROJECT_DIR$/web/media/upload/image003 (4).png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-5.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-5.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-7.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-7.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/phpunit.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/phpunit.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-9.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/iso-8859-9.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/thelia.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/thelia.iml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/koi8-r.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/koi8-r.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/koi8-u.map" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/phenx/php-font-lib/maps/koi8-u.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/core/lib/Thelia/Config/I18n/pt_PT.php" beforeDir="false" afterPath="$PROJECT_DIR$/core/lib/Thelia/Config/I18n/pt_PT.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/core/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.bg.xlf" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.bg.xlf" afterDir="false" />
<change beforePath="$PROJECT_DIR$/core/vendor/symfony/validator/Symfony/Component/Validator/Resources/translations/validators.bg.xlf" beforeDir="false" afterPath="$PROJECT_DIR$/core/vendor/symfony/validator/Symfony/Component/Validator/Resources/translations/validators.bg.xlf" afterDir="false" />
<change beforePath="$PROJECT_DIR$/local/config/database.yml" beforeDir="false" afterPath="$PROJECT_DIR$/local/config/database.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/local/modules/Klikandpay" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/local/modules/PurgeFakeCustomer/Readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/local/modules/PurgeFakeCustomer/Readme.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/reset_install.bat" beforeDir="false" afterPath="$PROJECT_DIR$/reset_install.bat" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/I18n/en_US.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/I18n/en_US.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/I18n/fr_FR.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/I18n/fr_FR.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/bdd.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/bdd.php" beforeDir="false" />
@@ -97,14 +102,13 @@
<change beforePath="$PROJECT_DIR$/web/!install!/config.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/config.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/connection.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/connection.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/end.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/end.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/fd33fd0-6fda040.ico" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/d73bf49.ico" afterDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/fd33fd0-6fda040.ico" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/backOffice/default/template-assets/assets/img/257d6a0.ico" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/footer.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/footer.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/header.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/header.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/index.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/index.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/permission.php" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/permission.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/script.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/script.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/!install!/styles.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/!install!/styles.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/.htaccess" beforeDir="false" afterPath="$PROJECT_DIR$/web/.htaccess" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/0/.source-stamp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/0/.source-stamp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/0/assets/img/flags/c0aed68.png" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/0/assets/img/flags/c0aed68.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/0/assets/img/flags/c7a1d07.png" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/0/assets/img/flags/c7a1d07.png" beforeDir="false" />
@@ -671,18 +675,13 @@
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/1/js/jquery.ui/jquery.ui.datepicker/i18n/readme.txt" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/1/js/jquery.ui/jquery.ui.datepicker/i18n/readme.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/1/js/jquery.ui/jquery.ui.datepicker/jquery.ui.datepicker.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/1/js/jquery.ui/jquery.ui.datepicker/jquery.ui.datepicker.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/1/js/jquery.ui/jquery.ui.theme.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/1/js/jquery.ui/jquery.ui.theme.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/Colissimo/assets/.source-stamp" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/backOffice/default/Colissimo/assets/.source-stamp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/.source-stamp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/.source-stamp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/css/4b90c79.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/css/4b90c79.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/css/style.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/css/style.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/js/22548f6.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/js/22548f6.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/js/3add195.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/CustomerFamily/assets/js/3add195.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/HookAdminHome/assets/.source-stamp" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/backOffice/default/HookAdminHome/assets/.source-stamp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/HookAdminHome/assets/css/493cca4.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/HookAdminHome/assets/css/493cca4.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/HookAdminHome/assets/css/d61aaa9.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/HookAnalytics/assets/.source-stamp" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/backOffice/default/HookAnalytics/assets/.source-stamp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/HookAnalytics/assets/js/a872012.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/HookAnalytics/assets/js/a872012.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/HookSocial/assets/.source-stamp" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/backOffice/default/HookSocial/assets/.source-stamp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/.source-stamp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/.source-stamp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/assets/.source-stamp" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/assets/.source-stamp" afterDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/assets/.source-stamp" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/assets/.source-stamp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/css/e3d487b.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/backOffice/default/Tinymce/css/e3d487b.css" beforeDir="false" />
@@ -715,9 +714,6 @@
<change beforePath="$PROJECT_DIR$/web/assets/email/default/1/.source-stamp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/email/default/1/.source-stamp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/email/default/1/img/header.jpg" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/email/default/1/img/header.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/email/default/1/img/logo.gif" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/email/default/1/img/logo.gif" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/email/sterivein/template-assets/assets/.source-stamp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/email/sterivein/template-assets/assets/img/header.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/email/sterivein/template-assets/assets/img/logo.gif" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/0/.source-stamp" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/0/.source-stamp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/0/css/styles.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/0/css/styles.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/0/font/bambina/bambina-webfont.eot" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/0/font/bambina/bambina-webfont.eot" beforeDir="false" />
@@ -1351,30 +1347,18 @@
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/template-assets/assets/dist/js/vendors/808e2f7.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/template-assets/assets/dist/js/vendors/808e2f7.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/template-assets/assets/dist/js/vendors/98b8aaa.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/template-assets/assets/dist/js/vendors/98b8aaa.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/template-assets/assets/dist/js/vendors/9a0e4ff.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/default/template-assets/assets/dist/js/vendors/9a0e4ff.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/.source-stamp" beforeDir="false" afterPath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/.source-stamp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/3bc0f96.ico" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/3bc0f96.ico" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/571d8e4.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/6ff0745.ico" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/972c3ce.png" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/972c3ce.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/52730bd.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/92d3846.png" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/92d3846.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/c4461eb.png" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/c4461eb.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/img/flags/e36eec2.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/2f8228e.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/2f8228e.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/4638ce3.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/bootstrap/5bc8ef5.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/bootstrap/d01b4e2.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/bootstrap/d01b4e2.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/libs/8b313c8.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/libs/d8ecf0a.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/libs/d8ecf0a.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/plugins/bootbox/515e12f.js" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/plugins/bootbox/515e12f.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/js/plugins/bootbox/99df859.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/less/51ab1cc.css" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/less/51ab1cc.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/frontOffice/sterivein/template-assets/assets/less/b542842.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/pdf/default/0/assets/img/6f0479e.png" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/pdf/default/0/assets/img/6f0479e.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/assets/pdf/sterivein/template-assets/assets/img/df6e9a8.png" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/web/assets/pdf/sterivein/template-assets/assets/img/df6e9a8.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/favicon.ico" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/web/index_dev.php" beforeDir="false" afterPath="$PROJECT_DIR$/web/index_dev.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/web/index_dev.php" beforeDir="false" afterPath="$PROJECT_DIR$/web/index_dev.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/tinymce" beforeDir="false" afterPath="$PROJECT_DIR$/web/tinymce" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -1444,7 +1428,7 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY"> <option name="RECENT_BRANCH_BY_REPOSITORY">
<map> <map>
<entry key="$PROJECT_DIR$" value="main" /> <entry key="$PROJECT_DIR$" value="master" />
</map> </map>
</option> </option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -1573,34 +1557,34 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true", &quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
"Constants": "false", &quot;Constants&quot;: &quot;false&quot;,
"RunOnceActivity.OpenProjectViewOnStart": "true", &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"WebServerToolWindowFactoryState": "false", &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
"WebServerToolWindowPanel.toolwindow.highlight.mappings": "true", &quot;WebServerToolWindowPanel.toolwindow.highlight.mappings&quot;: &quot;true&quot;,
"WebServerToolWindowPanel.toolwindow.highlight.symlinks": "true", &quot;WebServerToolWindowPanel.toolwindow.highlight.symlinks&quot;: &quot;true&quot;,
"WebServerToolWindowPanel.toolwindow.show.date": "false", &quot;WebServerToolWindowPanel.toolwindow.show.date&quot;: &quot;false&quot;,
"WebServerToolWindowPanel.toolwindow.show.permissions": "false", &quot;WebServerToolWindowPanel.toolwindow.show.permissions&quot;: &quot;false&quot;,
"WebServerToolWindowPanel.toolwindow.show.size": "false", &quot;WebServerToolWindowPanel.toolwindow.show.size&quot;: &quot;false&quot;,
"git-widget-placeholder": "main", &quot;git-widget-placeholder&quot;: &quot;main&quot;,
"last_opened_file_path": "/Volumes/Documents/Dev/Sources/Clients/Sterivein/sterivein/local/modules/HookContact/I18n", &quot;last_opened_file_path&quot;: &quot;/Volumes/Documents/Dev/Sources/Clients/Sterivein/sterivein/local/modules/HookContact/I18n&quot;,
"node.js.detected.package.eslint": "true", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
"nodejs_package_manager_path": "npm", &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
"settings.editor.selected.configurable": "ml.llm.LLMProjectConfigurable", &quot;settings.editor.selected.configurable&quot;: &quot;ml.llm.LLMProjectConfigurable&quot;,
"vue.rearranger.settings.migration": "true" &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}, },
"keyToStringList": { &quot;keyToStringList&quot;: {
"DatabaseDriversLRU": [ &quot;DatabaseDriversLRU&quot;: [
"mysql" &quot;mysql&quot;
] ]
} }
}]]></component> }</component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/local/modules/HookContact/I18n" /> <recent name="$PROJECT_DIR$/local/modules/HookContact/I18n" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

146
local/modules/Axepta/Axepta.php Executable file
View File

@@ -0,0 +1,146 @@
<?php
/*************************************************************************************/
/* 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 Axepta;
use Axepta\Util\Axepta as AxeptaPayment;
use Thelia\Core\Translation\Translator;
use Thelia\Log\Tlog;
use Thelia\Model\Order;
use Thelia\Module\AbstractPaymentModule;
use Thelia\Tools\MoneyFormat;
use Thelia\Tools\URL;
class Axepta extends AbstractPaymentModule
{
/** @var string */
public const DOMAIN_NAME = 'axepta';
public const MERCHANT_ID = 'merchant_id';
public const HMAC = 'hmac';
public const CRYPT_KEY = 'crypt_key';
public const MODE = 'run_mode';
public const ALLOWED_IP_LIST = 'allowed_ip_list';
public const MINIMUM_AMOUNT = 'minimum_amount';
public const MAXIMUM_AMOUNT = 'maximum_amount';
public const SEND_CONFIRMATION_MESSAGE_ONLY_IF_PAID = 'send_confirmation_message_only_if_paid';
public function pay(Order $order)
{
$hmac = self::getConfigValue(self::HMAC, null);
$merchantId = self::getConfigValue(self::MERCHANT_ID, null);
$cryptKey = self::getConfigValue(self::CRYPT_KEY, null);
$mode = self::getConfigValue(self::MODE, null);
$urlAnnulation = $this->getPaymentFailurePageUrl($order->getId(), Translator::getInstance()->trans('Vous avez annulé le paiement', [], Axepta::DOMAIN_NAME));
$urlNotification = URL::getInstance()->absoluteUrl('/axepta/notification');
$paymentRequest = new AxeptaPayment($hmac);
$paymentRequest->setCryptKey($cryptKey);
$transId = time().$order->getId();
$paymentRequest->setUrl(AxeptaPayment::PAYSSL);
$paymentRequest->setMerchantID($merchantId);
$paymentRequest->setTransID($transId);
$paymentRequest->setAmount((int) ($order->getTotalAmount()*100));
$paymentRequest->setCurrency($order->getCurrency()->getCode());
$paymentRequest->setRefNr($order->getRef());
$paymentRequest->setURLSuccess($urlNotification);
$paymentRequest->setURLFailure($urlNotification);
$paymentRequest->setURLNotify($urlNotification);
$paymentRequest->setURLBack($urlAnnulation);
$paymentRequest->setReponse('encrypt');
$paymentRequest->setLanguage($this->getRequest()->getSession()->getLang()->getLocale());
if ($mode === 'TEST') {
// See https://docs.axepta.bnpparibas/display/DOCBNP/Test+environment
// In the encrypted data request, use the default parameter OrderDesc with the value "Test:0000". This will give you a correspondingly successful authorization after successful authentication.
$paymentRequest->setOrderDesc('Test:0000');
} else {
$paymentRequest->setOrderDesc($order->getCustomer()->getFirstname() . ' ' . $order->getCustomer()->getLastname());
}
$paymentRequest->validate();
$mac = $paymentRequest->getShaSign();
$data = $paymentRequest->getBfishCrypt();
$len = $paymentRequest->getLen();
$transmit = [
'MerchantID' => $paymentRequest->getMerchantID(),
'Len' => $len,
'Data' => $data,
'URLBack' => $urlAnnulation,
'CustomField1' => sprintf(
"%s, %s",
MoneyFormat::getInstance($this->getRequest())->format($order->getTotalAmount(), 2),
$order->getCurrency()->getCode()
),
'CustomField2' => $order->getRef()
];
TLog::getInstance()->error("Données Axcepta : " . print_r($paymentRequest->parameters, 1));
TLog::getInstance()->error("URL Axcepta : " . $paymentRequest->getUrl());
$order
->setTransactionRef($transId)
->save();
return $this->generateGatewayFormResponse($order, $paymentRequest->getUrl(), $transmit);
}
public function isValidPayment()
{
$hmac = self::getConfigValue(self::HMAC, null);
$merchantId = self::getConfigValue(self::MERCHANT_ID, null);
$cryptKey = self::getConfigValue(self::CRYPT_KEY, null);
$mode = self::getConfigValue(self::MODE, null);
$valid = true;
if (($hmac === null || $merchantId === null || $cryptKey === null) && $mode !== 'TEST') {
Tlog::getInstance()->errro("Axepta module is not properly configured, some configuration data are missing.");
return false;
}
if ($mode === 'TEST') {
$raw_ips = explode("\n", self::getConfigValue(self::ALLOWED_IP_LIST, ''));
$allowed_client_ips = array();
foreach ($raw_ips as $ip) {
$allowed_client_ips[] = trim($ip);
}
$client_ip = $this->getRequest()->getClientIp();
$valid = in_array($client_ip, $allowed_client_ips) || in_array('*', $allowed_client_ips);
}
if ($valid) {
// Check if total order amount is in the module's limits
$valid = $this->checkMinMaxAmount(self::MINIMUM_AMOUNT, self::MAXIMUM_AMOUNT);
}
return $valid;
}
protected function checkMinMaxAmount($min, $max)
{
$order_total = $this->getCurrentOrderTotalAmount();
$min_amount = self::getConfigValue($min, 0);
$max_amount = self::getConfigValue($max, 0);
return $order_total > 0 && ($min_amount <= 0 || $order_total >= $min_amount) && ($max_amount <= 0 || $order_total <= $max_amount);
}
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<forms>
<form name="axepta_configuration" class="Axepta\Form\ConfigurationForm" />
</forms>
<services>
<service id="axepta.send.confirmation_mail" class="Axepta\EventListeners\SendConfirmationEmail">
<tag name="kernel.event_subscriber"/>
</service>
</services>
<hooks>
<hook id="axepta.configuration.hook" class="Axepta\Hook\HookManager">
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfigure" />
</hook>
<hook id="axepta.orderpaymentgateway.hook" class="Axepta\Hook\HookManager">
<tag name="hook.event_listener" event="order-payment-gateway.javascript" type="front" method="onOrderPaymentGatewayJavascript" />
</hook>
</hooks>
</config>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
<fullnamespace>Axepta\Axepta</fullnamespace>
<descriptive locale="en_US">
<title>Payement with Axepta</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Paiement avec Axepta</title>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.0.1</version>
<authors>
<author>
<name>Nicolas Barbey</name>
<email>nbarbey@openstudio.fr</email>
</author>
</authors>
<type>classic</type>
<thelia>2.3.0</thelia>
<stability>other</stability>
<mandatory>0</mandatory>
<hidden>0</hidden>
</module>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
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">
<route id="axepta.configure" path="/admin/module/axepta/configure" methods="post">
<default key="_controller">Axepta\Controller\ConfigurationController::configure</default>
</route>
<route id="axepta.notification_url" path="/axepta/notification">
<default key="_controller">Axepta\Controller\NotificationController::notificationAction</default>
</route>
</routes>

View File

@@ -0,0 +1,80 @@
<?php
namespace Axepta\Controller;
use Axepta\Axepta;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Tools\URL;
class ConfigurationController extends BaseAdminController
{
public function configure()
{
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'Axepta', AccessManager::UPDATE)) {
return $response;
}
// Create the Form from the request
$configurationForm = $this->createForm('axepta_configuration');
try {
// Check the form against constraints violations
$form = $this->validateForm($configurationForm, "POST");
// Get the form field values
$data = $form->getData();
foreach ($data as $name => $value) {
if (is_array($value)) {
$value = implode(';', $value);
}
Axepta::setConfigValue($name, $value);
}
// Log configuration modification
$this->adminLogAppend(
"axepta.configuration.message",
AccessManager::UPDATE,
"Axepta configuration updated"
);
// Redirect to the success URL,
if ($this->getRequest()->get('save_mode') === 'stay') {
// If we have to stay on the same page, redisplay the configuration page/
$route = '/admin/module/Axepta';
} else {
// If we have to close the page, go back to the module back-office page.
$route = '/admin/modules';
}
return $this->generateRedirect(URL::getInstance()->absoluteUrl($route));
// An exit is performed after redirect.+
} catch (FormValidationException $ex) {
// Form cannot be validated. Create the error message using
// the BaseAdminController helper method.
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
} catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();
}
// At this point, the form has errors, and should be redisplayed. We do not redirect,
// just redisplay the same template.
// Set up the Form error context, to make error information available in the template.
$this->setupFormErrorContext(
$this->getTranslator()->trans("Axepta configuration", [], Axepta::DOMAIN_NAME),
$error_msg,
$configurationForm,
$ex
);
// Do not redirect at this point, or the error context will be lost.
// Just redisplay the current template.
return $this->render('module-configure', array('module_code' => 'Payline'));
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace Axepta\Controller;
use Axepta\Axepta;
use Axepta\Util\Axepta as AxeptaPayment;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Translation\Translator;
use Thelia\Exception\TheliaProcessException;
use Thelia\Model\Base\OrderQuery;
use Thelia\Model\OrderStatusQuery;
use Thelia\Module\BasePaymentModuleController;
class NotificationController extends BasePaymentModuleController
{
protected function getModuleCode()
{
return 'Axepta';
}
/**
* @throws \Propel\Runtime\Exception\PropelException
*/
public function notificationAction()
{
$this->getLog()->addInfo("Processing Axcepta notification");
$paymentResponse = new AxeptaPayment(Axepta::getConfigValue(Axepta::HMAC));
$paymentResponse->setCryptKey(Axepta::getConfigValue(Axepta::CRYPT_KEY));
$paymentResponse->setResponse($this->getRequest()->query->all());
$this->getLog()->addError("Notification parameters: ".print_r($paymentResponse->parameters, 1));
$transId = $paymentResponse->getTransID();
if (null === $order = OrderQuery::create()->filterByTransactionRef($transId)->findOne()) {
$this->getLog()->addInfo("Failed to fin order for transaction ID $transId. Aborting.");
throw new TheliaProcessException(
Translator::getInstance()->trans("Failed to find order for transaction ID %id", ['id' => $transId ], Axepta::DOMAIN_NAME)
);
}
$this->getLog()->addInfo("Processing payment of order " . $order->getRef());
$event = new OrderEvent($order);
if ($paymentResponse->isValid() && $paymentResponse->isSuccessful()) {
$this->getLog()->addInfo("Payment of order ".$order->getRef()." is successful.");
if (!$order->isPaid()) {
$this->getLog()->addInfo("Setting order status to 'paid'.");
$event->setStatus(OrderStatusQuery::getPaidStatus()->getId());
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
}
$this->redirectToSuccessPage($order->getId());
}
$this->getLog()->addInfo("Payment failed, cancelling order " . $order->getRef());
$event->setStatus(OrderStatusQuery::getCancelledStatus()->getId());
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
$this->getLog()->addInfo("Failure cause:".$paymentResponse->getDescription() . ' ('.$paymentResponse->getCode());
$this->redirectToFailurePage($order->getId(), $paymentResponse->getDescription() . ' ('.$paymentResponse->getCode().')');
}
}

View File

@@ -0,0 +1,82 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Axepta\EventListeners;
use Axepta\Axepta;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Action\BaseAction;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
/**
* Axepta payment module
*
* @author Franck Allimant <franck@cqfdev.fr>
*/
class SendConfirmationEmail extends BaseAction implements EventSubscriberInterface
{
/**
* @param OrderEvent $event
*
* @throws \Exception if the message cannot be loaded.
*/
public function sendConfirmationEmail(OrderEvent $event)
{
if (Axepta::getConfigValue(Axepta::SEND_CONFIRMATION_MESSAGE_ONLY_IF_PAID, true)) {
// We send the order confirmation email only if the order is paid
$order = $event->getOrder();
if (!$order->isPaid() && $order->getPaymentModuleId() === (int) Axepta::getModuleId()) {
$event->stopPropagation();
}
}
}
/**
* Checks if order payment module is Axepta and if order new status is paid, send a confirmation email to the customer.
*
* @param OrderEvent $event
* @param $eventName
* @param EventDispatcherInterface $dispatcher
*
* @throws \Propel\Runtime\Exception\PropelException
*/
public function updateStatus(OrderEvent $event, $eventName, EventDispatcherInterface $dispatcher)
{
$order = $event->getOrder();
if ($order->isPaid() && $order->getPaymentModuleId() === Axepta::getModuleId()) {
$dispatcher->dispatch(TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL, $event);
}
}
public static function getSubscribedEvents()
{
return array(
TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128),
TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL => array("sendConfirmationEmail", 129)
);
}
}

View File

@@ -0,0 +1,150 @@
<?php
namespace Axepta\Form;
use Axepta\Axepta;
use Payline\Payline;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
class ConfigurationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
Axepta::MODE,
ChoiceType::class,
[
'constraints' => [new NotBlank()],
'required' => true,
'choices' => [
'TEST' => 'Test',
'PRODUCTION' => 'Production',
],
'label' => $this->trans('Mode de fonctionnement', []),
'data' => Axepta::getConfigValue(Axepta::MODE),
]
)
->add(
Axepta::MERCHANT_ID,
TextType::class,
[
'constraints' => [new NotBlank()],
'required' => true,
'label' => $this->trans('Merchant ID'),
'data' => Axepta::getConfigValue(Axepta::MERCHANT_ID, ''),
]
)
->add(
Axepta::HMAC,
TextType::class,
[
'constraints' => [new NotBlank()],
'required' => true,
'label' => $this->trans('HMAC key'),
'data' => Axepta::getConfigValue(Axepta::HMAC, ''),
]
)
->add(
Axepta::CRYPT_KEY,
TextType::class,
[
'constraints' => [new NotBlank()],
'required' => true,
'label' => $this->trans('Blowfish encryption key'),
'data' => Axepta::getConfigValue(Axepta::CRYPT_KEY, ''),
]
)
->add(
Axepta::ALLOWED_IP_LIST,
TextareaType::class,
[
'required' => false,
'label' => $this->trans('Allowed IPs in test mode'),
'data' => Axepta::getConfigValue(Axepta::ALLOWED_IP_LIST),
'label_attr' => array(
'for' => Axepta::ALLOWED_IP_LIST,
'help' => $this->trans(
'List of IP addresses allowed to use this payment on the front-office when in test mode (your current IP is %ip). One address per line',
array('%ip' => $this->getRequest()->getClientIp())
),
'rows' => 3
)
]
)
->add(
Axepta::MINIMUM_AMOUNT,
NumberType::class,
array(
'constraints' => array(
new NotBlank(),
new GreaterThanOrEqual(array('value' => 0))
),
'required' => true,
'label' => $this->trans('Minimum order total'),
'data' => Axepta::getConfigValue(Axepta::MINIMUM_AMOUNT, 0),
'label_attr' => array(
'for' => 'minimum_amount',
'help' => $this->trans('Minimum order total in the default currency for which this payment method is available. Enter 0 for no minimum')
),
'attr' => [
'step' => 'any'
]
)
)
->add(
Axepta::MAXIMUM_AMOUNT,
NumberType::class,
array(
'constraints' => array(
new NotBlank(),
new GreaterThanOrEqual(array('value' => 0))
),
'required' => true,
'label' => $this->trans('Maximum order total'),
'data' => Axepta::getConfigValue(Axepta::MAXIMUM_AMOUNT, 0),
'label_attr' => array(
'for' => 'maximum_amount',
'help' => $this->trans('Maximum order total in the default currency for which this payment method is available. Enter 0 for no maximum')
),
'attr' => [
'step' => 'any'
]
)
)
->add(
Axepta::SEND_CONFIRMATION_MESSAGE_ONLY_IF_PAID,
'checkbox',
[
'value' => 1,
'required' => false,
'label' => $this->trans('Send order confirmation on payment success'),
'data' => (boolean)(Axepta::getConfigValue(Axepta::SEND_CONFIRMATION_MESSAGE_ONLY_IF_PAID, true)),
'label_attr' => [
'help' => $this->trans(
'If checked, the order confirmation message is sent to the customer only when the payment is successful. The order notification is always sent to the shop administrator'
)
]
]
)
;
}
public function getName()
{
return 'axepta_configuration';
}
protected function trans($str, $params = [])
{
return Translator::getInstance()->trans($str, $params, Axepta::DOMAIN_NAME);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Axepta\Hook;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
class HookManager extends BaseHook
{
public function onModuleConfigure(HookRenderEvent $event)
{
$event->add(
$this->render('module-configuration.html')
);
}
public function onOrderPaymentGatewayJavascript(HookRenderEvent $event)
{
$event->add(
$this->render('hook/order-payment-gateway-javascript.html')
);
}
}

View File

@@ -0,0 +1,6 @@
<?php
return array(
'Access to Axepta Platform' => 'Accès a Axepta',
'Payment configuration' => 'Configuration de paiement',
);

View File

@@ -0,0 +1,6 @@
<?php
return array(
'Mode de fonctionnement' => 'Operation Mode',
'Vous avez annulé le paiement' => 'You have cancel the payment',
);

View File

@@ -0,0 +1,16 @@
<?php
return array(
'Allowed IPs in test mode' => 'Adresse IP autorisé en mode de test ',
'Blowfish encryption key' => 'Clé de cryptage Blowfish',
'Failed to find order reference %ref' => 'La référence de commande %ref n\'a pas été trouvé',
'HMAC key' => 'Clé HMAC',
'If checked, the order confirmation message is sent to the customer only when the payment is successful. The order notification is always sent to the shop administrator' => 'Si cette case est cochée, le mail de confirmation de commande sera envoyé au client seulement si son paiement est validé.',
'List of IP addresses allowed to use this payment on the front-office when in test mode (your current IP is %ip). One address per line' => 'Liste des adresses IP qui pourront choisir ce module de paiement en front-office pendant la phase de test (votre IP est 127.0.0.1). Une adresse par ligne.',
'Maximum order total' => 'Montant maximum de commande',
'Maximum order total in the default currency for which this payment method is available. Enter 0 for no maximum' => 'Montant maximum dans la devise par défaut pour proposer ce moyen de paiement. Laisser 0 pour ne pas fixer de maximum',
'Merchant ID' => 'Id du commerçant',
'Minimum order total' => 'Montant minimum de commande',
'Minimum order total in the default currency for which this payment method is available. Enter 0 for no minimum' => 'Montant minimum dans la devise par défaut pour proposer ce moyen de paiement. Laisser 0 pour ne pas fixer de minimum',
'Send order confirmation on payment success' => 'Confirmation de commande si le paiement réussit',
);

27
local/modules/Axepta/Readme.md Executable file
View File

@@ -0,0 +1,27 @@
# Axepta
This module adds the payment solution Axepta.
## Installation
### Manually
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is Axepta.
* Activate it in your thelia administration panel
### Composer
Add it in your main thelia composer.json file
```
composer require thelia/axepta-module:~1.0
```
## Usage
* Contact Axepta to create an account.
* Go to the module configuration and add your HMAC key, Blowfish encryption key, and your merchant id.
* Set the operation mode to production
Documentation : https://docs.axepta.bnpparibas
If you want to test your configuration you can use this credit cards : https://docs.axepta.bnpparibas/display/DOCBNP/Test+Cards

View File

@@ -0,0 +1,488 @@
<?php
namespace Axepta\Util;
class Axepta
{
const PAYSSL = "https://paymentpage.axepta.bnpparibas/payssl.aspx";
const DIRECT = "https://paymentpage.axepta.bnpparibas/direct.aspx";
const DIRECT3D = "https://paymentpage.axepta.bnpparibas/direct3d.aspx";
const CAPTURE = "https://paymentpage.axepta.bnpparibas/capture.aspx";
const CREDIT = "https://paymentpage.axepta.bnpparibas/credit.aspx";
const INSTALMENT = "INSTALMENT";
private $secretKey;
private $cryptKey;
private $pspURL = self::PAYSSL;
public $parameters = array();
/** Axepta fields **/
private $pspFields = array(
'Debug',
'PayID',
'TransID',
'MerchantID',
'Amount',
'Currency',
'MAC',
'RefNr',
'Amount3D',
'URLSuccess',
'URLFailure',
'URLNotify',
'Response',
'UserData',
'Capture',
'OrderDesc',
'ReqID',
'Plain',
'Custom',
'expirationTime',
'AccVerify',
'RTF',
'ChDesc',
'Len',
'Data',
'Template',
'Language',
'Background',
'URLBack',
'CCSelect',
'MID',
'mid',
'refnr',
'XID',
'Status',
'Description',
'Code',
'PCNr',
'CCNr',
'CCCVC',
'CCBrand',
'CCExpiry',
'TermURL',
'UserAgent',
'HTTPAccept',
'AboID',
'ACSXID',
'MaskedPan',
'CAVV',
'ECI',
'DDD',
'Type',
'Plain',
'Custom',
'CustomField1','CustomField2','CustomField3','CustomField4','CustomField5','CustomField6','CustomField7',
'CustomField8','CustomField9','CustomField10','CustomField11','CustomField12','CustomField13','CustomField14'
);
/** Axepta request hmac fields **/
private $QHMACFields = array(
'PayID', 'TransID', 'MerchantID', 'Amount','Currency'
);
/** Axepta response hmac fields **/
private $RHMACFields = array(
'PayID', 'TransID', 'MerchantID', 'Status','Code'
);
/** Axepta blowfish crypt fields **/
private $BfishFields = array(
'PayID','TransID','Amount','Currency','MAC',
'RefNr','Amount3D','URLSuccess','URLFailure','URLNotify','Response','UserData','Capture','OrderDesc','ReqID',
'Plain','Custom','expirationTime','AccVerify','RTF','ChDesc',
'MID','XID','Status','Description','Code','PCNr','CCNr','CCCVC','CCBrand','CCExpiry','TermURL','UserAgent',
'HTTPAccept','AboID','ACSXID','MaskedPan','CAVV','ECI','DDD','Type','Plain','Custom'
// 'CustomField1','CustomField2','CustomField3','CustomField4','CustomField5','CustomField6','CustomField7',
// 'CustomField8','CustomField9','CustomField10','CustomField11','CustomField12','CustomField13','CustomField14'
);
/** Axepta request required fields **/
private $requiredFields = array(
// 'MerchantID', 'TransID', 'Amount', 'Currency','URLSuccess','URLFailure','URLNotify','OrderDesc'
'MerchantID', 'TransID', 'Amount', 'Currency','OrderDesc'
);
public $allowedlanguages = array(
'nl', 'fr', 'de', 'it', 'es', 'cy', 'en'
);
public function __construct($secret)
{
$this->secretKey = $secret; // HMAC key
}
public function setCryptKey($secret)
{
$this->cryptKey = $secret; // blowfish crypt key
}
/** hack to retrieve response field **/
public function setReponse($encrypt='encrypt')
{
$this->parameters['Response'] = $encrypt;
}
/** HMAC compute and store in MAC field**/
public function shaCompose(array $parameters)
{
// compose SHA string
$shaString = '';
foreach($parameters as $key) {
if(array_key_exists($key, $this->parameters) && !empty($this->parameters[$key])) {
$value = $this->parameters[$key];
$shaString .= $value;
}
$shaString .= (array_search($key, $parameters) != (count($parameters)-1)) ? '*' : '';
}
$this->parameters['MAC'] = hash_hmac('sha256', $shaString, $this->secretKey);
return $this->parameters['MAC'];
}
/** @return string */
public function getShaSign()
{
$this->validate();
return $this->shaCompose($this->QHMACFields);
}
public function BfishCompose(array $parameters)
{
// compose Blowfish hex string
$blowfishString = '';
foreach($parameters as $key) {
if(array_key_exists($key, $this->parameters) && !empty($this->parameters[$key])) {
$value = $this->parameters[$key];
$blowfishString .= $key.'='.$value.'&';
}
}
$blowfishString = rtrim($blowfishString,'&');
$this->parameters['Debug'] = $blowfishString;
$this->parameters['Len'] = strlen($blowfishString);
$this->parameters[self::DATA_FIELD] = bin2hex($this->encrypt($blowfishString,$this->cryptKey));
return $this->parameters[self::DATA_FIELD];
}
/** @return string */
public function getBfishCrypt()
{
$this->validate();
return $this->BFishCompose($this->BfishFields);
}
private function encrypt($data, $key)
{
$l = strlen($key);
if ($l < 16)
$key = str_repeat($key, ceil(16/$l));
if ($m = strlen($data)%8)
$data .= str_repeat("\x00", 8 - $m);
if (function_exists('mcrypt_encrypt'))
$val = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $data, MCRYPT_MODE_ECB);
else
$val = openssl_encrypt($data, 'BF-ECB', $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING);
return $val;
}
private function decrypt($data, $key)
{
$l = strlen($key);
if ($l < 16)
$key = str_repeat($key, ceil(16/$l));
if (function_exists('mcrypt_encrypt'))
$val = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $data, MCRYPT_MODE_ECB);
else
$val = openssl_decrypt($data, 'BF-ECB', $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING);
return rtrim($val, "\0");
}
/** @return string */
public function getUrl()
{
return $this->pspURL;
}
public function setUrl($pspUrl)
{
$this->validateUri($pspUrl);
$this->pspURL = $pspUrl;
}
public function setURLSuccess($url)
{
$this->validateUri($url);
$this->parameters['URLSuccess'] = $url;
}
public function setURLFailure($url)
{
$this->validateUri($url);
$this->parameters['URLFailure'] = $url;
}
public function setURLNotify($url)
{
$this->validateUri($url);
$this->parameters['URLNotify'] = $url;
}
public function setTransID($transactionReference)
{
if(preg_match('/[^a-zA-Z0-9_-]/', $transactionReference)) {
throw new \InvalidArgumentException("TransactionReference cannot contain special characters");
}
$this->parameters['TransID'] = $transactionReference;
}
/**
* Set amount in cents, eg EUR 12.34 is written as 1234
*/
public function setAmount($amount)
{
if(!is_int($amount)) {
throw new \InvalidArgumentException("Integer expected. Amount is always in cents");
}
if($amount <= 0) {
throw new \InvalidArgumentException("Amount must be a positive number");
}
$this->parameters['Amount'] = $amount;
}
public function setCaptureDay($number)
{
if (strlen($number) > 2) {
throw new \InvalidArgumentException("captureDay is too long");
}
$this->parameters['captureDay'] = $number;
}
// Methodes liees a la lutte contre la fraude
public function setFraudDataBypass3DS($value)
{
if(strlen($value) > 128) {
throw new \InvalidArgumentException("fraudData.bypass3DS is too long");
}
$this->parameters['fraudData.bypass3DS'] = $value;
}
// Methodes liees au paiement one-click
public function setMerchantWalletId($wallet)
{
if(strlen($wallet) > 21) {
throw new \InvalidArgumentException("merchantWalletId is too long");
}
$this->parameters['merchantWalletId'] = $wallet;
}
public function setPaymentPattern($paymentPattern)
{
$this->parameters['paymentPattern'] = $paymentPattern;
}
public function __call($method, $args)
{
if(substr($method, 0, 3) == 'set') {
// $field = lcfirst(substr($method, 3));
$field = substr($method, 3);
if(in_array($field, $this->pspFields)) {
$this->parameters[$field] = $args[0];
return;
}
}
if(substr($method, 0, 3) == 'get') {
// $field = lcfirst(substr($method, 3));
$field = substr($method, 3);
if(array_key_exists($field, $this->parameters)) {
return $this->parameters[$field];
}
}
throw new \BadMethodCallException("Unknown method $method");
}
public function toArray()
{
return $this->parameters;
}
public function toParameterString()
{
$parameterString = "";
foreach($this->parameters as $key => $value) {
$parameterString .= $key . '=' . $value;
$parameterString .= (array_search($key, array_keys($this->parameters)) != (count($this->parameters)-1)) ? '|' : '';
}
return $parameterString;
}
public static function createFromArray($shaComposer, array $parameters)
{
$instance = new static($shaComposer);
foreach($parameters as $key => $value)
{
$instance->{"set$key"}($value);
}
return $instance;
}
public function validate()
{
foreach($this->requiredFields as $field) {
if(empty($this->parameters[$field])) {
throw new \RuntimeException($field . " can not be empty");
}
}
}
protected function validateUri($uri)
{
if(!filter_var($uri, FILTER_VALIDATE_URL)) {
throw new \InvalidArgumentException("Uri is not valid");
}
if(strlen($uri) > 200) {
throw new \InvalidArgumentException("Uri is too long");
}
}
// Traitement des reponses d'Axepta
// -----------------------------------
/** @var string */
const SHASIGN_FIELD = "MAC";
/** @var string */
const DATA_FIELD = "Data";
public function setResponse(array $httpRequest)
{
// use lowercase internally
// $httpRequest = array_change_key_case($httpRequest, CASE_UPPER);
// set sha sign
// $this->shaSign = $this->extractShaSign($httpRequest);
// filter request for Sips parameters
$this->parameters = $this->filterRequestParameters($httpRequest);
}
/**
* @var string
*/
private $shaSign;
private $dataString;
/**
* Filter http request parameters
* @param array $requestParameters
*/
private function filterRequestParameters(array $httpRequest)
{
//filter request for Sips parameters
$parameters = $this->parameters;
if(!array_key_exists(self::DATA_FIELD, $httpRequest) || $httpRequest[self::DATA_FIELD] == '') {
// throw new InvalidArgumentException('Data parameter not present in parameters.');
$parameters['Debug'] = implode('&',$httpRequest);
foreach($httpRequest as $key=>$value) {
$key = ($key=='mid')? 'MerchantID':$key;
$parameters[$key]=$value;
}
} else {
$parameters[self::DATA_FIELD] = $httpRequest[self::DATA_FIELD];
$this->dataString = $this->decrypt(hex2bin($parameters[self::DATA_FIELD]),$this->cryptKey);
$parameters['Debug'] = $this->dataString;
$dataParams = explode('&', $this->dataString);
foreach($dataParams as $dataParamString) {
$dataKeyValue = explode('=',$dataParamString,2);
$key = ($dataKeyValue[0]=='mid')?'MerchantID':$dataKeyValue[0];
$parameters[$key] = $dataKeyValue[1];
}
}
return $parameters;
}
public function getSeal()
{
return $this->shaSign;
}
private function extractShaSign(array $parameters)
{
if(!array_key_exists(self::SHASIGN_FIELD, $parameters) || $parameters[self::SHASIGN_FIELD] == '') {
throw new \InvalidArgumentException('SHASIGN parameter not present in parameters.');
}
return $parameters[self::SHASIGN_FIELD];
}
public function isValid()
{
// return $this->shaCompose($this->RHMACFields) == $this->shaSign;
return $this->shaCompose($this->RHMACFields) == $this->parameters['MAC'];
}
/**
* Retrieves a response parameter
* @param string $param
* @throws \InvalidArgumentException
*/
public function getParam($key)
{
if(method_exists($this, 'get'.$key)) {
return $this->{'get'.$key}();
}
// always use uppercase
// $key = strtoupper($key);
// $parameters = array_change_key_case($this->parameters,CASE_UPPER);
$parameters = $this->parameters;
if(!array_key_exists($key, $parameters)) {
throw new \InvalidArgumentException('Parameter ' . $key . ' does not exist.');
}
return $parameters[$key];
}
/**
* @return int Amount in cents
*/
public function getAmount()
{
$value = trim($this->parameters['Amount']);
return (int) ($value);
}
public function isSuccessful()
{
return in_array($this->getParam('Status'), array("OK", "AUTHORIZED"));
}
public function getDataString()
{
return $this->dataString;
}
}

View File

@@ -0,0 +1,12 @@
{
"name": "thelia/axepta-module",
"description": "Axepta payment module for Thelia",
"license": "LGPL-3.0-or-later",
"type": "thelia-module",
"require": {
"thelia/installer": "~1.1"
},
"extra": {
"installer-name": "Axepta"
}
}

View File

@@ -0,0 +1,52 @@
<div class="row">
<div class="col-md-12 general-block-decorator">
<div class="row">
<div class="col-md-12 title title-without-tabs">
{intl d='axepta.bo.default' l="Axepta Configuration"}
</div>
</div>
<div class="form-container">
<div class="row">
<div class="col-md-12">
{form name="axepta_configuration"}
<form action="{url path="/admin/module/axepta/configure"}" method="post">
{form_hidden_fields}
{include file = "includes/inner-form-toolbar.html"
hide_flags = true
page_url = "{url path='/admin/module/Axepta'}"
close_url = "{url path='/admin/modules'}"
}
{if $form_error}
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger">{$form_error_message}</div>
</div>
</div>
{/if}
<div class="row">
<div class="col-md-4">
<p class="title title-without-tabs">{intl d='axepta.bo.default' l="Access to Axepta Platform"}</p>
{render_form_field field="merchant_id"}
{render_form_field field="hmac"}
{render_form_field field="crypt_key"}
</div>
<div class="col-md-4">
<p class="title title-without-tabs">{intl d='axepta.bo.default' l="Payment configuration"}</p>
{render_form_field field="send_confirmation_message_only_if_paid"}
{render_form_field field="run_mode"}
{render_form_field field="allowed_ip_list"}
{render_form_field field="minimum_amount"}
{render_form_field field="maximum_amount"}
</div>
</div>
</form>
{/form}
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,16 @@
{* We shoud use the "GET" method fo rsome fields to be properly processed byt the gateway *}
{* see https://docs.axepta.bnpparibas/display/DOCBNP/Payment+page#Paymentpage-Howtocallthepaymentmethodsselectionpage? *}
<script type="text/javascript">
jQuery(function($) {
var $form = $('#payement_gateway_form');
$form.attr('method', 'get');
$form.submit();
$('#force-submit-payment-form').click(function(ev) {
$form.submit();
ev.preventDefault();
});
});
</script>

View File

@@ -0,0 +1,3 @@
#2.3.0
- First public version, OpenSource <3

View File

@@ -0,0 +1,10 @@
# 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;
ALTER TABLE `credit_note` ADD `discount_without_tax` DECIMAL(16,6) DEFAULT 0.000000 AFTER `total_price_with_tax`, ADD `discount_with_tax` DECIMAL(16,6) DEFAULT 0.000000 AFTER `discount_without_tax`;
ALTER TABLE `credit_note_version` ADD `discount_without_tax` DECIMAL(16,6) DEFAULT 0.000000 AFTER `total_price_with_tax`, ADD `discount_with_tax` DECIMAL(16,6) DEFAULT 0.000000 AFTER `discount_without_tax`;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,16 @@
# 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;
SELECT @max_id := IFNULL(MAX(`id`),0) FROM `credit_note_type`;
INSERT INTO `credit_note_type` (`id`, `code`, `position`, `color`, `required_order`, `created_at`, `updated_at`) VALUES
(@max_id+1, 'difference_refund', @max_id+1, '#CF7973', 0, NOW(), NOW());
INSERT INTO `credit_note_type_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
(@max_id+1, 'en_US', 'Difference refund', '', '', ''),
(@max_id+1, 'fr_FR', 'Remboursement de la différence', '', '', '');
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,18 @@
# 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;
ALTER TABLE credit_note
DROP COLUMN version;
ALTER TABLE credit_note
DROP COLUMN version_created_at;
ALTER TABLE credit_note
DROP COLUMN version_created_by;
DROP TABLE IF EXISTS `credit_note_version`;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://thelia.net/schema/dic/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<loop name="credit-note" class="CreditNote\Loop\CreditNote" />
<loop name="credit-note-type" class="CreditNote\Loop\CreditNoteType" />
<loop name="credit-note-status" class="CreditNote\Loop\CreditNoteStatus" />
<loop name="credit-note-comment" class="CreditNote\Loop\CreditNoteComment" />
<loop name="credit-note-version" class="CreditNote\Loop\CreditNoteVersion" />
<loop name="credit-note-address" class="CreditNote\Loop\CreditNoteAddress" />
<loop name="credit-note-detail" class="CreditNote\Loop\CreditNoteDetail" />
<loop name="order-credit-note" class="CreditNote\Loop\OrderCreditNote" />
</loops>
<forms>
<form name="credit-note.create" class="CreditNote\Form\CreditNoteCreateForm" />
<form name="credit-note.empty" class="CreditNote\Form\CreditNoteEmptyForm" />
</forms>
<services>
<service id="creditnote.listener" class="CreditNote\EventListener\CreditNoteListener">
<tag name="kernel.event_subscriber" />
</service>
<service id="creditnote.smarty.plugin.format" class="CreditNote\Smarty\Plugins\CreditNoteFormat">
<argument type="service" id="request_stack"/>
<tag name="thelia.parser.register_plugin"/>
</service>
</services>
<hooks>
<hook id="creditnote.hook.back.order_edit" class="CreditNote\Hook\Back\OrderEditHook">
<tag name="hook.event_listener" event="order.tab" type="back" method="onOrderTab" />
<tag name="hook.event_listener" event="order-edit.bottom" type="back" method="onOrderEditBottom" />
<tag name="hook.event_listener" event="order.edit-js" type="back" method="onOrderEditJs" />
<tag name="hook.event_listener" event="order-edit.product-list" type="back" method="onOrderEditProductList" />
</hook>
<hook id="creditnote.hook.back.customer_edit" class="CreditNote\Hook\Back\CustomerEditHook">
<tag name="hook.event_listener" event="customer.edit" type="back" method="onCustomerEdit" />
<tag name="hook.event_listener" event="customer-edit.bottom" type="back" method="onCustomerEditBottom" />
<tag name="hook.event_listener" event="customer.edit-js" type="back" method="onCustomerEditJs" />
</hook>
<hook id="creditnote.hook.back.main" class="CreditNote\Hook\Back\MainHook">
<tag name="hook.event_listener" event="main.footer-js" type="back" method="onMainFooterJs" />
</hook>
</hooks>
</config>

View File

@@ -0,0 +1,47 @@
SET FOREIGN_KEY_CHECKS = 0;
INSERT INTO `credit_note_status` (`id`, `code`, `position`, `color`, `invoiced`, `used`, `created_at`, `updated_at`) VALUES
(1, 'proposed', 1, '#999966', 0, 0, NOW(), NOW()),
(2, 'refused', 2, '#e60000', 0, 0, NOW(), NOW()),
(3, 'accepted', 3, '#00cc00', 1, 0, NOW(), NOW()),
(4, 'used', 4, '#3399ff', 1, 1, NOW(), NOW());
INSERT INTO `credit_note_status_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
(1, 'en_US', 'Proposed', '', '', ''),
(1, 'fr_FR', 'Proposé', '', '', ''),
(2, 'en_US', 'Refused', '', '', ''),
(2, 'fr_FR', 'Refusé', '', '', ''),
(3, 'en_US', 'Accepted', '', '', ''),
(3, 'fr_FR', 'Accepté', '', '', ''),
(4, 'en_US', 'Used', '', '', ''),
(4, 'fr_FR', 'Utilisé', '', '', '');
INSERT INTO `credit_note_status_flow` (`id`, `from_status_id`, `to_status_id`, `priority`, `root`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 1, 1, NOW(), NOW()),
(2, 1, 3, 1, 0, NOW(), NOW()),
(3, 2, 1, 1, 1, NOW(), NOW()),
(4, 3, 4, 1, 0, NOW(), NOW());
INSERT INTO `credit_note_type` (`id`, `code`, `position`, `color`, `required_order`, `created_at`, `updated_at`) VALUES
(1, 'order_full_refund', 1, '#1abc9c', 1, NOW(), NOW()),
(2, 'back_product', 2, '#40d47e', 1, NOW(), NOW()),
(3, 'billing_error', 3, '#3498db', 1, NOW(), NOW()),
(4, 'rebate', 4, '#9b59b6', 0, NOW(), NOW()),
(5, 'discount', 5, '#34495e', 0, NOW(), NOW()),
(6, 'difference_refund', 5, '#CF7973', 0, NOW(), NOW());
INSERT INTO `credit_note_type_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
(1, 'en_US', 'Order Full refund', '', '', ''),
(1, 'fr_FR', 'Remboursement complet', '', '', ''),
(2, 'en_US', 'Back Product', '', '', ''),
(2, 'fr_FR', 'Retour produit', '', '', ''),
(3, 'en_US', 'Billing error', '', '', ''),
(3, 'fr_FR', 'Erreur de facturation', '', '', ''),
(4, 'en_US', 'A rebate', '', '', ''),
(4, 'fr_FR', 'Un rabais', '', '', ''),
(5, 'en_US', 'A discount', '', '', ''),
(5, 'fr_FR', 'Une remise', '', '', ''),
(6, 'en_US', 'Difference refund', '', '', ''),
(6, 'fr_FR', 'Remboursement de la différence', '', '', '');
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
<fullnamespace>CreditNote\CreditNote</fullnamespace>
<descriptive locale="en_US">
<title>Credit notes</title>
<subtitle>Allows granting credit notes to customers</subtitle>
</descriptive>
<descriptive locale="fr_FR">
<title>Avoirs</title>
<subtitle>Permet d'accorder des avoirs aux clients</subtitle>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>2.3.6</version>
<author>
<name>Gilles Bourgeat</name>
<email>gbourgeat@openstudio.fr</email>
</author>
<type>classic</type>
<thelia>2.3.0</thelia>
<stability>beta</stability>
</module>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://symfony.com/schema/routing" 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">
<route id="admin.order.pdf.invoice" path="/admin/credit-note/pdf/invoice/{creditNoteId}/{browser}">
<default key="_controller">CreditNote:CreditNote:generateInvoicePdf</default>
<default key="browser">0</default>
<requirement key="browser">[0|1|2]</requirement>
<requirement key="creditNoteId">\d+</requirement>
</route>
<route id="creditnote.list" path="/admin/credit-note">
<default key="_controller">CreditNote:CreditNote:list</default>
</route>
<route id="creditnote.ajax.modal.create" path="/admin/credit-note/ajax/modal/create">
<default key="_controller">CreditNote:CreditNote:ajaxModalCreate</default>
</route>
<route id="creditnote.create" path="/admin/credit-note/create">
<default key="_controller">CreditNote:CreditNote:create</default>
</route>
<route id="creditnote.view" path="/admin/credit-note/{id}">
<default key="_controller">CreditNote:CreditNote:view</default>
<requirement key="id">\d+</requirement>
</route>
<route id="creditnote.update" path="/admin/credit-note/{id}/_update" methods="post">
<default key="_controller">CreditNote:CreditNote:update</default>
<requirement key="id">\d+</requirement>
</route>
<route id="creditnote.delete" path="/admin/credit-note/{id}/_delete" methods="post">
<default key="_controller">CreditNote:CreditNote:delete</default>
<requirement key="id">\d+</requirement>
</route>
<route id="creditnote.ajax.search.customer" path="/admin/credit-note/ajax/search/customer" methods="get">
<default key="_controller">CreditNote:CreditNote:searchCustomer</default>
</route>
<route id="creditnote.ajax.search.order" path="/admin/credit-note/ajax/search/order" methods="get">
<default key="_controller">CreditNote:CreditNote:searchOrder</default>
</route>
<route id="creditnote.ajax.load.order" path="/admin/credit-note/ajax/load/order/{id}" methods="get">
<default key="_controller">CreditNote:CreditNote:loadOrder</default>
</route>
</routes>

View File

@@ -0,0 +1,281 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../core/vendor/propel/propel/resources/xsd/database.xsd" >
<table name="credit_note" namespace="CreditNote\Model">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="ref" type="VARCHAR" size="45" />
<column name="invoice_ref" type="VARCHAR" size="45" />
<column name="invoice_address_id" type="INTEGER" required="true" />
<column name="invoice_date" type="TIMESTAMP" />
<column name="order_id" type="INTEGER" required="false" />
<column name="customer_id" type="INTEGER" required="true" />
<column name="parent_id" type="INTEGER" required="false" />
<column name="type_id" type="INTEGER" required="true" />
<column name="status_id" type="INTEGER" required="true" />
<column name="currency_id" type="INTEGER" required="true" />
<column name="currency_rate" type="FLOAT" />
<column name="total_price" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
<column name="total_price_with_tax" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
<column name="discount_without_tax" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
<column name="discount_with_tax" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
<column name="allow_partial_use" type="BOOLEAN" defaultValue="1" />
<foreign-key foreignTable="order" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="order_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="customer" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="customer_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="credit_note" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="parent_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="credit_note_type" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="type_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="credit_note_status" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="status_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="currency" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="currency_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="credit_note_address" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="invoice_address_id" foreign="id" />
</foreign-key>
<unique name="ref_UNIQUE">
<unique-column name="ref" />
</unique>
<unique name="invoice_ref_UNIQUE">
<unique-column name="invoice_ref" />
</unique>
<index name="idx_order_id_fk">
<index-column name="order_id" />
</index>
<index name="idx_customer_id_fk">
<index-column name="customer_id" />
</index>
<index name="idx_parent_id_fk">
<index-column name="parent_id" />
</index>
<index name="idx_type_id_fk">
<index-column name="type_id" />
</index>
<index name="idx_status_id_fk">
<index-column name="status_id" />
</index>
<behavior name="timestampable" />
</table>
<table name="credit_note_address" namespace="CreditNote\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="customer_title_id" type="INTEGER" />
<column name="company" size="255" type="VARCHAR" />
<column name="firstname" required="true" size="255" type="VARCHAR" />
<column name="lastname" required="true" size="255" type="VARCHAR" />
<column name="address1" required="true" size="255" type="VARCHAR" />
<column name="address2" size="255" type="VARCHAR" />
<column name="address3" size="255" type="VARCHAR" />
<column name="zipcode" required="true" size="10" type="VARCHAR" />
<column name="city" required="true" size="255" type="VARCHAR" />
<column name="phone" size="20" type="VARCHAR" />
<column name="cellphone" size="20" type="VARCHAR" />
<column name="country_id" required="true" type="INTEGER" />
<column name="state_id" type="INTEGER" />
<foreign-key foreignTable="customer_title" name="fk_credit_note_address_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="customer_title_id" />
</foreign-key>
<foreign-key foreignTable="country" name="fk_credit_note_address_country_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="country_id" />
</foreign-key>
<foreign-key foreignTable="state" name="fk_credit_note_address_state_id" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference foreign="id" local="state_id" />
</foreign-key>
<behavior name="timestampable" />
</table>
<table name="order_credit_note" namespace="CreditNote\Model">
<column name="order_id" type="INTEGER" required="true" primaryKey="true" />
<column name="credit_note_id" type="INTEGER" required="true" primaryKey="true" />
<column name="amount_price" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
<foreign-key foreignTable="order" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="order_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="credit_note" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="credit_note_id" foreign="id" />
</foreign-key>
<behavior name="timestampable" />
</table>
<table name="cart_credit_note" namespace="CreditNote\Model">
<column name="cart_id" type="INTEGER" required="true" primaryKey="true" />
<column name="credit_note_id" type="INTEGER" required="true" primaryKey="true" />
<column name="amount_price" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
<foreign-key foreignTable="cart" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="cart_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="credit_note" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="credit_note_id" foreign="id" />
</foreign-key>
<behavior name="timestampable" />
</table>
<table name="credit_note_status" namespace="CreditNote\Model">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="code" type="VARCHAR" size="45" />
<column name="color" type="CHAR" size="7" />
<column name="invoiced" type="BOOLEAN" required="true" defaultValue="0" />
<column name="used" type="BOOLEAN" required="true" defaultValue="0" />
<column name="position" type="INTEGER" size="11" />
<column name="title" type="VARCHAR" size="255" />
<column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
<behavior name="timestampable" />
</table>
<table name="credit_note_status_flow" namespace="CreditNote\Model">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="from_status_id" type="INTEGER" required="true" />
<column name="to_status_id" type="INTEGER" required="true" />
<column name="priority" type="INTEGER" size="11" />
<column name="root" type="BOOLEAN" required="true" defaultValue="0" />
<foreign-key name="credit_note_status_flow_credit_note_status_from" foreignTable="credit_note_status" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="from_status_id" foreign="id" />
</foreign-key>
<foreign-key name="credit_note_status_flow_credit_note_status_to" foreignTable="credit_note_status" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="to_status_id" foreign="id" />
</foreign-key>
<behavior name="timestampable" />
</table>
<table name="credit_note_type" namespace="CreditNote\Model">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="code" type="VARCHAR" size="45" />
<column name="color" type="CHAR" size="7" />
<column name="position" type="INTEGER" size="11" />
<column name="required_order" type="BOOLEAN" required="true" defaultValue="0" />
<column name="title" type="VARCHAR" size="255" />
<column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
<behavior name="timestampable" />
</table>
<table name="credit_note_detail" namespace="CreditNote\Model">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="credit_note_id" type="INTEGER" required="true" />
<column name="price" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
<column name="price_with_tax" type="DECIMAL" scale="6" size="16" defaultValue="0.000000" />
<column name="tax_rule_id" type="INTEGER" required="false" />
<column name="order_product_id" type="INTEGER" required="false" />
<column name="type" type="VARCHAR" size="55" />
<column name="quantity" defaultValue="0" required="true" type="INTEGER" />
<column name="title" type="VARCHAR" size="255" />
<foreign-key foreignTable="credit_note" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="credit_note_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="order_product" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="order_product_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="tax_rule" onDelete="RESTRICT" onUpdate="RESTRICT">
<reference local="tax_rule_id" foreign="id" />
</foreign-key>
<index name="idx_credit_note_id_fk">
<index-column name="credit_note_id" />
</index>
<index name="idx_order_product_id_fk">
<index-column name="order_product_id" />
</index>
<behavior name="timestampable" />
</table>
<table name="credit_note_comment" namespace="CreditNote\Model">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="credit_note_id" type="INTEGER" required="true" />
<column name="admin_id" type="INTEGER" required="false" />
<column name="comment" type="CLOB" />
<foreign-key foreignTable="credit_note" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="credit_note_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="admin" onDelete="SET NULL" onUpdate="RESTRICT">
<reference local="admin_id" foreign="id" />
</foreign-key>
<index name="idx_credit_note_id_fk">
<index-column name="credit_note_id" />
</index>
<index name="idx_admin_id_fk">
<index-column name="admin_id" />
</index>
<behavior name="timestampable" />
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,2 @@
# Sqlfile -> Database map
thelia.sql=thelia

View File

@@ -0,0 +1,358 @@
# 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;
-- ---------------------------------------------------------------------
-- credit_note
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note`;
CREATE TABLE `credit_note`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`ref` VARCHAR(45),
`invoice_ref` VARCHAR(45),
`invoice_address_id` INTEGER NOT NULL,
`invoice_date` DATETIME,
`order_id` INTEGER,
`customer_id` INTEGER NOT NULL,
`parent_id` INTEGER,
`type_id` INTEGER NOT NULL,
`status_id` INTEGER NOT NULL,
`currency_id` INTEGER NOT NULL,
`currency_rate` FLOAT,
`total_price` DECIMAL(16,6) DEFAULT 0.000000,
`total_price_with_tax` DECIMAL(16,6) DEFAULT 0.000000,
`discount_without_tax` DECIMAL(16,6) DEFAULT 0.000000,
`discount_with_tax` DECIMAL(16,6) DEFAULT 0.000000,
`allow_partial_use` TINYINT(1) DEFAULT 1,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
UNIQUE INDEX `ref_UNIQUE` (`ref`),
UNIQUE INDEX `invoice_ref_UNIQUE` (`invoice_ref`),
INDEX `idx_order_id_fk` (`order_id`),
INDEX `idx_customer_id_fk` (`customer_id`),
INDEX `idx_parent_id_fk` (`parent_id`),
INDEX `idx_type_id_fk` (`type_id`),
INDEX `idx_status_id_fk` (`status_id`),
INDEX `credit_note_FI_6` (`currency_id`),
INDEX `credit_note_FI_7` (`invoice_address_id`),
CONSTRAINT `credit_note_FK_1`
FOREIGN KEY (`order_id`)
REFERENCES `order` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `credit_note_FK_2`
FOREIGN KEY (`customer_id`)
REFERENCES `customer` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `credit_note_FK_3`
FOREIGN KEY (`parent_id`)
REFERENCES `credit_note` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `credit_note_FK_4`
FOREIGN KEY (`type_id`)
REFERENCES `credit_note_type` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `credit_note_FK_5`
FOREIGN KEY (`status_id`)
REFERENCES `credit_note_status` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `credit_note_FK_6`
FOREIGN KEY (`currency_id`)
REFERENCES `currency` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `credit_note_FK_7`
FOREIGN KEY (`invoice_address_id`)
REFERENCES `credit_note_address` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- credit_note_address
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note_address`;
CREATE TABLE `credit_note_address`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`customer_title_id` INTEGER,
`company` VARCHAR(255),
`firstname` VARCHAR(255) NOT NULL,
`lastname` VARCHAR(255) NOT NULL,
`address1` VARCHAR(255) NOT NULL,
`address2` VARCHAR(255),
`address3` VARCHAR(255),
`zipcode` VARCHAR(10) NOT NULL,
`city` VARCHAR(255) NOT NULL,
`phone` VARCHAR(20),
`cellphone` VARCHAR(20),
`country_id` INTEGER NOT NULL,
`state_id` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `FI_credit_note_address_customer_title_id` (`customer_title_id`),
INDEX `FI_credit_note_address_country_id` (`country_id`),
INDEX `FI_credit_note_address_state_id` (`state_id`),
CONSTRAINT `fk_credit_note_address_customer_title_id`
FOREIGN KEY (`customer_title_id`)
REFERENCES `customer_title` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `fk_credit_note_address_country_id`
FOREIGN KEY (`country_id`)
REFERENCES `country` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `fk_credit_note_address_state_id`
FOREIGN KEY (`state_id`)
REFERENCES `state` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- order_credit_note
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `order_credit_note`;
CREATE TABLE `order_credit_note`
(
`order_id` INTEGER NOT NULL,
`credit_note_id` INTEGER NOT NULL,
`amount_price` DECIMAL(16,6) DEFAULT 0.000000,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`order_id`,`credit_note_id`),
INDEX `order_credit_note_FI_2` (`credit_note_id`),
CONSTRAINT `order_credit_note_FK_1`
FOREIGN KEY (`order_id`)
REFERENCES `order` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `order_credit_note_FK_2`
FOREIGN KEY (`credit_note_id`)
REFERENCES `credit_note` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- cart_credit_note
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `cart_credit_note`;
CREATE TABLE `cart_credit_note`
(
`cart_id` INTEGER NOT NULL,
`credit_note_id` INTEGER NOT NULL,
`amount_price` DECIMAL(16,6) DEFAULT 0.000000,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`cart_id`,`credit_note_id`),
INDEX `cart_credit_note_FI_2` (`credit_note_id`),
CONSTRAINT `cart_credit_note_FK_1`
FOREIGN KEY (`cart_id`)
REFERENCES `cart` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `cart_credit_note_FK_2`
FOREIGN KEY (`credit_note_id`)
REFERENCES `credit_note` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- credit_note_status
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note_status`;
CREATE TABLE `credit_note_status`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`code` VARCHAR(45),
`color` CHAR(7),
`invoiced` TINYINT(1) DEFAULT 0 NOT NULL,
`used` TINYINT(1) DEFAULT 0 NOT NULL,
`position` INTEGER(11),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- credit_note_status_flow
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note_status_flow`;
CREATE TABLE `credit_note_status_flow`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`from_status_id` INTEGER NOT NULL,
`to_status_id` INTEGER NOT NULL,
`priority` INTEGER(11),
`root` TINYINT(1) DEFAULT 0 NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `FI_dit_note_status_flow_credit_note_status_from` (`from_status_id`),
INDEX `FI_dit_note_status_flow_credit_note_status_to` (`to_status_id`),
CONSTRAINT `credit_note_status_flow_credit_note_status_from`
FOREIGN KEY (`from_status_id`)
REFERENCES `credit_note_status` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `credit_note_status_flow_credit_note_status_to`
FOREIGN KEY (`to_status_id`)
REFERENCES `credit_note_status` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- credit_note_type
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note_type`;
CREATE TABLE `credit_note_type`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`code` VARCHAR(45),
`color` CHAR(7),
`position` INTEGER(11),
`required_order` TINYINT(1) DEFAULT 0 NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- credit_note_detail
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note_detail`;
CREATE TABLE `credit_note_detail`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`credit_note_id` INTEGER NOT NULL,
`price` DECIMAL(16,6) DEFAULT 0.000000,
`price_with_tax` DECIMAL(16,6) DEFAULT 0.000000,
`tax_rule_id` INTEGER,
`order_product_id` INTEGER,
`type` VARCHAR(55),
`quantity` INTEGER DEFAULT 0 NOT NULL,
`title` VARCHAR(255),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_credit_note_id_fk` (`credit_note_id`),
INDEX `idx_order_product_id_fk` (`order_product_id`),
INDEX `credit_note_detail_FI_3` (`tax_rule_id`),
CONSTRAINT `credit_note_detail_FK_1`
FOREIGN KEY (`credit_note_id`)
REFERENCES `credit_note` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `credit_note_detail_FK_2`
FOREIGN KEY (`order_product_id`)
REFERENCES `order_product` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT,
CONSTRAINT `credit_note_detail_FK_3`
FOREIGN KEY (`tax_rule_id`)
REFERENCES `tax_rule` (`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- credit_note_comment
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note_comment`;
CREATE TABLE `credit_note_comment`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`credit_note_id` INTEGER NOT NULL,
`admin_id` INTEGER,
`comment` LONGTEXT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_credit_note_id_fk` (`credit_note_id`),
INDEX `idx_admin_id_fk` (`admin_id`),
CONSTRAINT `credit_note_comment_FK_1`
FOREIGN KEY (`credit_note_id`)
REFERENCES `credit_note` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `credit_note_comment_FK_2`
FOREIGN KEY (`admin_id`)
REFERENCES `admin` (`id`)
ON UPDATE RESTRICT
ON DELETE SET NULL
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- credit_note_status_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note_status_i18n`;
CREATE TABLE `credit_note_status_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `credit_note_status_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `credit_note_status` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- credit_note_type_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `credit_note_type_i18n`;
CREATE TABLE `credit_note_type_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `credit_note_type_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `credit_note_type` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,904 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Controller;
use CreditNote\Helper\CreditNoteHelper;
use CreditNote\Helper\CriteriaSearchHelper;
use CreditNote\Model\Base\CreditNoteStatusQuery;
use CreditNote\Model\CreditNote;
use CreditNote\Model\CreditNoteAddress;
use CreditNote\Model\CreditNoteComment;
use CreditNote\Model\CreditNoteDetail;
use CreditNote\Model\CreditNoteDetailQuery;
use CreditNote\Model\CreditNoteQuery;
use CreditNote\Model\CreditNoteTypeQuery;
use CreditNote\Model\Map\CreditNoteTableMap;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
use Propel\Runtime\Propel;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Event\PdfEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\HttpFoundation\JsonResponse;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Thelia;
use Thelia\Exception\TheliaProcessException;
use Thelia\Log\Tlog;
use Thelia\Model\AddressQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery;
use Thelia\Model\Customer;
use Thelia\Model\CustomerQuery;
use Thelia\Model\Map\AddressTableMap;
use Thelia\Model\Map\OrderAddressTableMap;
use Thelia\Model\Order;
use Thelia\Model\OrderProductTax;
use Thelia\Model\OrderQuery;
use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Model\TaxRuleQuery;
use Thelia\Tools\URL;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*/
class CreditNoteController extends BaseAdminController
{
use CriteriaSearchHelper;
/**
* @param Request $request
* @return \Thelia\Core\HttpFoundation\Response
*/
public function listAction(Request $request)
{
return $this->render(
"credit-note-list",
[
]
);
}
/**
* @param Request $request
* @param int $id
* @return \Thelia\Core\HttpFoundation\Response
*/
public function viewAction(Request $request, $id)
{
$creditNote = CreditNoteQuery::create()
->filterById($id, Criteria::EQUAL)
->findOne();
$creditNote = $this->performCreditNote($creditNote);
return $this->render("ajax/credit-note-modal", [
'creditNote' => $creditNote
]);
}
public function createAction(Request $request)
{
$creditNote = $this->performCreditNote();
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteTableMap::DATABASE_NAME);
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
try {
$creditNote->save();
$con->commit();
} catch (\Exception $e) {
$con->rollBack();
throw $e;
}
if (null !== $request->get('success-url')) {
return new RedirectResponse($request->get('success-url'));
}
if (null !== $creditNote->getOrder()) {
return $this->generateRedirectFromRoute(
'admin.order.update.view',
[
'tab' => 'credit-note'
],
[
'order_id' => $creditNote->getOrder()->getId()
]
);
}
if (null !== $creditNote->getCustomer()) {
return $this->generateRedirectFromRoute('admin.customer.update.view', [], [
'customer_id' => $creditNote->getCustomer()->getId()
]);
}
}
public function updateAction(Request $request, $id)
{
$creditNote = CreditNoteQuery::create()
->filterById($id, Criteria::EQUAL)
->findOne();
$creditNote = $this->performCreditNote($creditNote);
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteTableMap::DATABASE_NAME);
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
try {
$creditNote->save();
$con->commit();
} catch (\Exception $e) {
$con->rollBack();
throw $e;
}
if (null !== $request->get('success-url')) {
return new RedirectResponse($request->get('success-url'));
}
if (null !== $creditNote->getOrder()) {
return $this->generateRedirectFromRoute(
'admin.order.update.view',
[
'tab' => 'credit-note'
],
[
'order_id' => $creditNote->getOrder()->getId()
]
);
}
if (null !== $creditNote->getCustomer()) {
return $this->generateRedirectFromRoute('admin.customer.update.view', [], [
'customer_id' => $creditNote->getCustomer()->getId()
]);
}
}
public function deleteAction(Request $request, $id)
{
$creditNote = CreditNoteQuery::create()->findOneById($id);
if (!empty($creditNote->getInvoiceRef())) {
$request->getSession()->getFlashBag()->set(
'error',
$this->getTranslator()->trans(
"You can not delete this credit note"
)
);
} else {
CreditNoteQuery::create()->filterById($id)->delete();
}
if (null !== $request->get('success-url')) {
return new RedirectResponse($request->get('success-url'));
}
if (null !== $creditNote->getOrder()) {
return $this->generateRedirectFromRoute(
'admin.order.update.view',
[
'tab' => 'credit-note'
],
[
'order_id' => $creditNote->getOrder()->getId()
]
);
}
if (null !== $creditNote->getCustomer()) {
return $this->generateRedirectFromRoute('admin.customer.update.view', [], [
'customer_id' => $creditNote->getCustomer()->getId()
]);
}
}
/**
* @param Request $request
* @return \Thelia\Core\HttpFoundation\Response
*/
public function ajaxModalCreateAction(Request $request)
{
$creditNote = $this->performCreditNote();
return $this->render("ajax/credit-note-modal", [
'creditNote' => $creditNote
]);
}
public function generateInvoicePdfAction($creditNoteId, $browser)
{
return $this->generateCreditNotePdf($creditNoteId, 'credit-note', true, true, $browser);
}
/**
* @param int $creditNoteId
* @param string $fileName
* @param bool $checkCreditNoteStatus
* @param bool $checkAdminUser
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function generateCreditNotePdf($creditNoteId, $fileName, $checkCreditNoteStatus = true, $checkAdminUser = true, $browser = false)
{
$creditNote = CreditNoteQuery::create()->findPk($creditNoteId);
// check if the order has the paid status
if ($checkAdminUser && !$this->getSecurityContext()->hasAdminUser()) {
throw new NotFoundHttpException();
}
if ($checkCreditNoteStatus && !$creditNote->getCreditNoteStatus()->getInvoiced()) {
throw new NotFoundHttpException();
}
$html = $this->renderRaw(
$fileName,
[
'credit_note_id' => $creditNote->getId()
],
$this->getTemplateHelper()->getActivePdfTemplate()
);
if ((int) $browser === 2) {
return new Response($html);
}
try {
$pdfEvent = new PdfEvent($html);
$this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent);
if ($pdfEvent->hasPdf()) {
if ((int) $browser === 1) {
$browser = true;
} else {
$browser = false;
}
return $this->pdfResponse($pdfEvent->getPdf(), $creditNote->getInvoiceRef(), 200, $browser);
}
} catch (\Exception $e) {
Tlog::getInstance()->error(
sprintf(
'error during generating invoice pdf for credit note id : %d with message "%s"',
$creditNote->getId(),
$e->getMessage()
)
);
}
throw new TheliaProcessException(
$this->getTranslator()->trans(
"We're sorry, this PDF invoice is not available at the moment."
)
);
}
/**
* @return CreditNote
*/
protected function performCreditNote(CreditNote $creditNote = null)
{
if (null === $creditNote) {
$creditNote = new CreditNote();
}
$creditNote->setDispatcher($this->getDispatcher());
$form = $this->createForm('credit-note.create', 'form', [], ['csrf_protection' => false]);
$formValidate = $this->validateForm($form, 'post');
if (null === $creditNote->getInvoiceRef()) {
$this
->performType($formValidate, $creditNote)
->performOrder($formValidate, $creditNote)
->performCurrency($formValidate, $creditNote)
->performCustomer($formValidate, $creditNote)
->performInvoiceAddress($formValidate, $creditNote)
->performStatus($formValidate, $creditNote)
->performFreeAmounts($formValidate, $creditNote)
->performOrderProducts($formValidate, $creditNote)
->performDiscount($formValidate, $creditNote)
->performAmount($formValidate, $creditNote)
;
}
$this->performComment($formValidate, $creditNote);
$this->getParserContext()->addForm($form);
$creditNote->setDispatcher($this->getDispatcher());
return $creditNote;
}
protected function performDiscount(Form $formValidate, CreditNote $creditNote)
{
$discountWithoutTax = $formValidate->get('discount_without_tax')->getData();
$discountWithTax = $formValidate->get('discount_with_tax')->getData();
if (null !== $creditNote->getOrder() && $creditNote->getCreditNoteType()->getCode() === CreditNoteHelper::TYPE_ORDER_FULL_REFUND) {
$creditNote->setDiscountWithoutTax($creditNote->getOrder()->getDiscount());
$creditNote->setDiscountWithTax($creditNote->getOrder()->getDiscount());
} elseif (null !== $discountWithoutTax && null !== $discountWithTax) {
$creditNote->setDiscountWithoutTax($discountWithoutTax);
$creditNote->setDiscountWithTax($discountWithTax);
} elseif (null === $creditNote->getOrder()) {
$creditNote->setDiscountWithoutTax(0);
$creditNote->setDiscountWithTax(0);
}
return $this;
}
protected function performInvoiceAddress(Form $formValidate, CreditNote $creditNote)
{
if (!empty($creditNote->getInvoiceRef())) {
return $this;
}
$action = $formValidate->get('action')->getData();
$invoiceAddressId = $formValidate->get('invoice_address_id')->getData();
if ($action !== 'view') {
$creditNoteAddress = $creditNote->getCreditNoteAddress();
if (null === $creditNoteAddress) {
$creditNoteAddress = new CreditNoteAddress();
}
if (null === $creditNote->getCustomer()) {
$creditNoteAddress = new CreditNoteAddress();
} elseif ($invoiceAddressId) {
$address = AddressQuery::create()->findOneById((int)$invoiceAddressId);
$customerTitle = $address->getCustomerTitle();
$creditNoteAddress
->setCustomerTitleId($customerTitle ? $customerTitle->getId() : null)
->setAddress1($address->getAddress1())
->setAddress2($address->getAddress2())
->setAddress3($address->getAddress3())
->setFirstname($address->getFirstname())
->setLastname($address->getLastname())
->setCity($address->getCity())
->setZipcode($address->getZipcode())
->setCompany($address->getCompany())
->setCountryId($address->getCountry()->getId());
} else {
$invoiceAddressTitle = $formValidate->get('invoice_address_title')->getData();
$invoiceAddressFirstname = $formValidate->get('invoice_address_firstname')->getData();
$invoiceAddressLastname = $formValidate->get('invoice_address_lastname')->getData();
$invoiceAddressCompany = $formValidate->get('invoice_address_company')->getData();
$invoiceAddressAddress1 = $formValidate->get('invoice_address_address1')->getData();
$invoiceAddressAddress2 = $formValidate->get('invoice_address_address2')->getData();
$invoiceAddressZipcode = $formValidate->get('invoice_address_zipcode')->getData();
$invoiceAddressCity = $formValidate->get('invoice_address_city')->getData();
$invoiceAddressCountryId = $formValidate->get('invoice_address_country_id')->getData();
$country = CountryQuery::create()->findOneById($invoiceAddressCountryId);
$creditNoteAddress
->setCustomerTitleId($invoiceAddressTitle)
->setAddress1($invoiceAddressAddress1)
->setAddress2($invoiceAddressAddress2)
->setFirstname($invoiceAddressFirstname)
->setLastname($invoiceAddressLastname)
->setCity($invoiceAddressCity)
->setZipcode($invoiceAddressZipcode)
->setCompany($invoiceAddressCompany)
->setCountryId(
$country ? $country->getId() : null
);
}
if (empty($creditNoteAddress->getLastname()) && ('create' === $action || 'update' === $action)) {
$formValidate->addError(
new FormError('Please select a invoice address')
);
$creditNoteAddress->save();
}
$creditNote->setCreditNoteAddress($creditNoteAddress);
} elseif (null === $creditNote->getId()) {
if (null !== $creditNote->getOrder() && null === $creditNote->getCreditNoteAddress()) {
$address = $creditNote->getOrder()->getOrderAddressRelatedByInvoiceOrderAddressId();
$customerTitle = $address->getCustomerTitle();
$creditNoteAddress = new CreditNoteAddress();
$creditNoteAddress
->setCustomerTitleId($customerTitle ? $customerTitle->getId() : null)
->setAddress1($address->getAddress1())
->setAddress2($address->getAddress2())
->setAddress3($address->getAddress3())
->setFirstname($address->getFirstname())
->setLastname($address->getLastname())
->setCity($address->getCity())
->setZipcode($address->getZipcode())
->setCompany($address->getCompany())
->setCountryId($address->getCountry()->getId());
$creditNote->setCreditNoteAddress($creditNoteAddress);
} else {
$creditNote->setCreditNoteAddress(new CreditNoteAddress());
}
}
return $this;
}
protected function performAmount(Form $formValidate, CreditNote $creditNote)
{
$totalPrice = 0;
$totalPriceWithTax = 0;
foreach ($creditNote->getCreditNoteDetails() as $creditNoteDetail) {
$totalPrice += $creditNoteDetail->getPrice() * $creditNoteDetail->getQuantity();
$totalPriceWithTax += $creditNoteDetail->getPriceWithTax() * $creditNoteDetail->getQuantity();
}
$totalPrice -= $creditNote->getDiscountWithoutTax();
$totalPriceWithTax -= $creditNote->getDiscountWithTax();
$creditNote->setTotalPrice($totalPrice);
$creditNote->setTotalPriceWithTax($totalPriceWithTax);
return $this;
}
protected function performComment(Form $formValidate, CreditNote $creditNote)
{
/** @var string $orderId */
$comment = trim($formValidate->get('comment')->getData());
if (null !== $comment && !empty($comment)) {
$creditNote->addCreditNoteComment(
(new CreditNoteComment())
->setComment($comment)
->setAdminId($this->getSecurityContext()->getAdminUser()->getId())
);
}
return $this;
}
protected function performOrder(Form $formValidate, CreditNote $creditNote)
{
/** @var int $orderId */
$orderId = $formValidate->get('order_id')->getData();
if (null !== $orderId && !empty($orderId)) {
$order = OrderQuery::create()->findPk($orderId);
$creditNote
->setOrder($order)
->setCustomer($order->getCustomer())
->setCurrency($order->getCurrency());
if ($order->getStatusId() == 1 || $order->getStatusId() == 5) {
throw new \Exception('This order is not invoiced');
}
}
return $this;
}
protected function performCurrency(Form $formValidate, CreditNote $creditNote)
{
/** @var int $currencyId */
$currencyId = $formValidate->get('currency_id')->getData();
if (null !== $creditNote->getOrder()) {
$creditNote->setCurrency($creditNote->getOrder()->getCurrency());
} elseif ($creditNote->getCurrency() === null) {
if (!empty($currencyId) && $currency = CurrencyQuery::create()->findPk($currencyId)) {
$creditNote->setCurrency($currency);
} else {
$creditNote->setCurrency(CurrencyQuery::create()->findOneByByDefault(true));
}
}
return $this;
}
protected function performCustomer(Form $formValidate, CreditNote $creditNote)
{
/** @var int $customerId */
$customerId = $formValidate->get('customer_id')->getData();
// check if order
if (!empty($orderId) && null !== $order = OrderQuery::create()->findPk($orderId)) {
$creditNote
->setOrder($order)
->setCurrency($order->getCurrency())
->setCustomer($order->getCustomer());
} elseif (!empty($customerId) && null !== $customer = CustomerQuery::create()->findPk($customerId)) {
$creditNote->setCustomer($customer);
}
return $this;
}
protected function performType(Form $formValidate, CreditNote $creditNote)
{
/** @var int $typeId */
$typeId = $formValidate->get('type_id')->getData();
if (!empty($typeId) && null !== $type = CreditNoteTypeQuery::create()->findPk($typeId)) {
$creditNote->setCreditNoteType($type);
} elseif (null === $creditNote->getTypeId()) {
$creditNote->setCreditNoteType(CreditNoteTypeQuery::create()->findOne());
}
return $this;
}
protected function performStatus(Form $formValidate, CreditNote $creditNote)
{
/** @var int $statusId */
$statusId = $formValidate->get('status_id')->getData();
if (!empty($statusId) && null !== $status = CreditNoteStatusQuery::create()->findPk($statusId)) {
$creditNote->setCreditNoteStatus($status);
} elseif (null === $creditNote->getStatusId()) {
$creditNote->setCreditNoteStatus(CreditNoteStatusQuery::create()->findOne());
}
return $this;
}
protected function performFreeAmounts(Form $formValidate, CreditNote $creditNote)
{
/** @var string[] $freeAmountTitles */
$freeAmountTitles = $formValidate->get('free_amount_title')->getData();
/** @var float[] $freeAmountPrices */
$freeAmountPrices = $formValidate->get('free_amount_price')->getData();
/** @var float[] $freeAmountPricesWithTax */
$freeAmountPricesWithTax = $formValidate->get('free_amount_price_with_tax')->getData();
/** @var int[] $freeAmountTaxRuleIds */
$freeAmountTaxRuleIds = $formValidate->get('free_amount_tax_rule_id')->getData();
/** @var string[] $freeAmountTaxRuleIds */
$freeAmountIds = $formValidate->get('free_amount_id')->getData();
/** @var string[] $freeAmountTypes */
$freeAmountTypes = $formValidate->get('free_amount_type')->getData();
/** @var string $freeAmountTypes */
$action = $formValidate->get('action')->getData();
foreach ($creditNote->getCreditNoteDetails() as $creditNoteDetail) {
if (empty($creditNoteDetail->getOrderProductId())) {
foreach ($freeAmountTitles as $key => $freeAmountTitle) {
if ($freeAmountIds[$key] == $creditNoteDetail->getId()) {
$creditNoteDetail
->setTitle($freeAmountTitle)
->setPrice($freeAmountPrices[$key])
->setTaxRuleId($freeAmountTaxRuleIds[$key])
->setType($freeAmountTypes[$key])
->setPriceWithTax($freeAmountPricesWithTax[$key]);
}
}
}
}
/**
* @var int $key
* @var int $freeAmountTitle
*/
foreach ($freeAmountTitles as $key => $freeAmountTitle) {
if (empty($freeAmountIds[$key])) {
$creditNote->addCreditNoteDetail(
(new CreditNoteDetail())
->setTitle($freeAmountTitle)
->setPrice($freeAmountPrices[$key])
->setTaxRuleId($freeAmountTaxRuleIds[$key])
->setType($freeAmountTypes[$key])
->setQuantity(1)
->setPriceWithTax($freeAmountPricesWithTax[$key])
);
}
}
if (null !== $creditNote->getOrder() && $creditNote->getCreditNoteType()->getCode() === CreditNoteHelper::TYPE_ORDER_FULL_REFUND) {
if (!(float) $creditNote->getOrder()->getPostage()) {
foreach ($creditNote->getCreditNoteDetails() as $creditNoteDetail) {
if ($creditNoteDetail->getType() == 'shipping') {
$creditNote->removeCreditNoteDetail($creditNoteDetail);
}
}
} else {
$findShipping = false;
foreach ($creditNote->getCreditNoteDetails() as $creditNoteDetail) {
if ($creditNoteDetail->getType() == 'shipping') {
$findShipping = true;
$creditNoteDetail
->setPrice(
$creditNote->getOrder()->getPostage() - $creditNote->getOrder()->getPostageTax()
)
->setPriceWithTax(
$creditNote->getOrder()->getPostage()
);
}
}
if (!$findShipping) {
$creditNote->addCreditNoteDetail(
(new CreditNoteDetail())
->setQuantity(1)
->setTitle('Frais de port')
->setPrice($creditNote->getOrder()->getPostage() - $creditNote->getOrder()->getPostageTax())
->setType('shipping')
->setPriceWithTax($creditNote->getOrder()->getPostage())
);
}
}
}
if ('refresh' === $action || $action === 'update') {
foreach ($creditNote->getCreditNoteDetails() as $creditNoteDetail) {
$find = false;
if (empty($creditNoteDetail->getOrderProductId())) {
foreach ($freeAmountTitles as $key => $freeAmountTitle) {
if ($freeAmountIds[$key] == $creditNoteDetail->getId()) {
$find = true;
}
}
if (!$find) {
$creditNote->removeCreditNoteDetail($creditNoteDetail);
}
}
}
}
return $this;
}
/**
* @param Form $formValidate
* @param CreditNote $creditNote
* @return $this
*/
protected function performOrderProducts(Form $formValidate, CreditNote $creditNote)
{
if (null === $creditNote->getOrder()) {
return $this;
}
/** @var string $freeAmountTypes */
$action = $formValidate->get('action')->getData();
/** @var int[] $orderProductQuantities */
$orderProductQuantities = $formValidate->get('order_product_quantity')->getData();
foreach ($creditNote->getOrder()->getOrderProducts() as $orderProduct) {
$creditNoteDetail = null;
if (null !== $creditNote->getId()) {
$creditNoteDetail = CreditNoteDetailQuery::create()
->filterByCreditNoteId($creditNote->getId())
->filterByOrderProductId($orderProduct->getId())
->findOne();
}
if (null === $creditNoteDetail) {
$creditNoteDetail = new CreditNoteDetail;
}
if ($creditNote->getCreditNoteType()->getCode() === CreditNoteHelper::TYPE_ORDER_FULL_REFUND) {
$creditNoteDetail->setQuantity($orderProduct->getQuantity());
} else {
if (isset($orderProductQuantities[$orderProduct->getId()])) {
$creditNoteDetail->setQuantity($orderProductQuantities[$orderProduct->getId()]);
}
}
if ((float) $creditNoteDetail->getQuantity() <= 0) {
$creditNote->removeCreditNoteDetail($creditNoteDetail);
continue;
}
if ((int) $orderProduct->getWasInPromo()) {
$orderProductWithoutTax = ((float) $orderProduct->getPromoPrice());
$orderProductWithTax = (float) $orderProduct->getPromoPrice();
} else {
$orderProductWithoutTax = ((float) $orderProduct->getPrice());
$orderProductWithTax = (float) $orderProduct->getPrice();
}
$orderProductTaxes = $orderProduct->getOrderProductTaxes();
/** @var OrderProductTax $orderProductTax */
foreach ($orderProductTaxes as $orderProductTax) {
if ((int) $orderProduct->getWasInPromo()) {
$orderProductWithTax += (float) $orderProductTax->getPromoAmount();
} else {
$orderProductWithTax += (float) $orderProductTax->getAmount();
}
}
$creditNoteDetail
->setOrderProduct($orderProduct)
->setTitle($orderProduct->getTitle())
->setPrice($orderProductWithoutTax)
->setType('product')
->setPriceWithTax($orderProductWithTax);
if (null !== $pse = ProductSaleElementsQuery::create()->findOneById($orderProduct->getProductSaleElementsId())) {
if ($pse->getProduct() === null) {
$creditNoteDetail->setTaxRuleId(TaxRuleQuery::create()->findOneByIsDefault(true)->getId());
} else {
$creditNoteDetail
->setTaxRuleId(
$pse
->getProduct()
->getTaxRuleId()
)
;
}
}
$creditNote->addCreditNoteDetail(
$creditNoteDetail
);
}
if ($action === 'update') {
foreach ($creditNote->getCreditNoteDetails() as $creditNoteDetail) {
if ((float) $creditNoteDetail->getQuantity() === 0.0 && $creditNoteDetail->getType() === 'product') {
$creditNote->removeCreditNoteDetail($creditNoteDetail);
}
}
}
return $this;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \Propel\Runtime\Exception\PropelException
*/
public function searchCustomerAction(Request $request)
{
$customerQuery = CustomerQuery::create()
->innerJoinAddress()
->groupById()
->limit(20);
$this->whereConcatRegex($customerQuery, [
'customer.FIRSTNAME',
'customer.LASTNAME',
'customer.EMAIL',
'address.COMPANY',
'address.PHONE'
], $request->get('q'));
$customerQuery
->withColumn(AddressTableMap::COMPANY, 'COMPANY')
->withColumn(AddressTableMap::ADDRESS1, 'ADDRESS')
->withColumn(AddressTableMap::CITY, 'CITY')
->withColumn(AddressTableMap::ZIPCODE, 'ZIPCODE')
->withColumn(AddressTableMap::PHONE, 'PHONE');
$customers = $customerQuery->find();
$json = [
'incomplete_results' => count($customers) ? false : true,
'items' => []
];
/** @var Customer $customer */
foreach ($customers as $customer) {
$json['items'][] = [
'id' => $customer->getId(),
'company' => $customer->getVirtualColumn('COMPANY'),
'firstname' => $customer->getFirstname(),
'lastname' => $customer->getLastname(),
'ref' => $customer->getRef(),
'address' => $this->formatAddress($customer)
];
}
return new JsonResponse($json);
}
/**
* @param Request $request
* @return JsonResponse
* @throws \Propel\Runtime\Exception\PropelException
*/
public function searchOrderAction(Request $request)
{
$orderQuery = OrderQuery::create();
//$orderQuery->filterByInvoiceRef(null, Criteria::ISNOTNULL);
$orderQuery->useOrderStatusQuery()
->filterById([1,5], Criteria::NOT_IN)
->endUse();
if (null !== $customerId = $request->get('customerId')) {
if ((int) $customerId > 0) {
$orderQuery->filterByCustomerId((int) $customerId);
}
}
$orderQuery->innerJoinOrderAddressRelatedByInvoiceOrderAddressId()
->groupById()
->limit(20);
$this->whereConcatRegex($orderQuery, [
'order.REF',
'order_address.LASTNAME',
'order_address.FIRSTNAME',
'order_address.COMPANY',
'order_address.PHONE'
], $request->get('q'));
$orderQuery
->withColumn(OrderAddressTableMap::FIRSTNAME, 'FIRSTNAME')
->withColumn(OrderAddressTableMap::LASTNAME, 'LASTNAME')
->withColumn(OrderAddressTableMap::COMPANY, 'COMPANY')
->withColumn(OrderAddressTableMap::ADDRESS1, 'ADDRESS')
->withColumn(OrderAddressTableMap::CITY, 'CITY')
->withColumn(OrderAddressTableMap::ZIPCODE, 'ZIPCODE')
->withColumn(OrderAddressTableMap::PHONE, 'PHONE');
$orders = $orderQuery->find();
$json = [
'incomplete_results' => count($orders) ? false : true,
'items' => []
];
/** @var Order $order */
foreach ($orders as $order) {
$json['items'][] = [
'id' => $order->getId(),
'ref' => $order->getRef(),
'company' => $order->getVirtualColumn('COMPANY'),
'firstname' => $order->getVirtualColumn('FIRSTNAME'),
'lastname' => $order->getVirtualColumn('LASTNAME'),
'address' => $this->formatAddress($order),
];
}
return new JsonResponse($json);
}
/**
* @param ActiveRecordInterface $model
* @return mixed
*/
protected function formatAddress(ActiveRecordInterface $model)
{
/** @var Order|Customer $model */
return implode(' ', [$model->getVirtualColumn('ADDRESS'), $model->getVirtualColumn('ZIPCODE'), $model->getVirtualColumn('CITY')]);
}
}

View File

@@ -0,0 +1,84 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote;
use Propel\Runtime\Connection\ConnectionInterface;
use Symfony\Component\Finder\Finder;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
use Thelia\Install\Database;
/**
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
*/
class CreditNote extends BaseModule
{
const DOMAIN_MESSAGE = "creditnote";
const CONFIG_KEY_REF_PREFIX = 'ref_prefix';
const CONFIG_KEY_REF_MIN_LENGTH = 'ref_min_length';
const CONFIG_KEY_REF_INCREMENT = 'ref_increment';
const CONFIG_KEY_INVOICE_REF_PREFIX = 'invoice_ref_prefix';
const CONFIG_KEY_INVOICE_REF_MIN_LENGTH = 'invoice_ref_min_length';
const CONFIG_KEY_INVOICE_REF_INCREMENT = 'invoice_ref_increment';
const CONFIG_KEY_INVOICE_REF_WITH_THELIA_ORDER = 'invoice_ref_with_thelia_order';
/**
* @param ConnectionInterface $con
*/
public function postActivation(ConnectionInterface $con = null)
{
if (!$this->getConfigValue('is_initialized', false)) {
$database = new Database($con);
$database->insertSql(null, [__DIR__ . "/Config/thelia.sql", __DIR__ . "/Config/insert.sql"]);
$this->setConfigValue(self::CONFIG_KEY_REF_INCREMENT, 1);
$this->setConfigValue(self::CONFIG_KEY_REF_PREFIX, 'CN');
$this->setConfigValue(self::CONFIG_KEY_REF_MIN_LENGTH, 8);
$this->setConfigValue(self::CONFIG_KEY_INVOICE_REF_INCREMENT, 1);
$this->setConfigValue(self::CONFIG_KEY_INVOICE_REF_PREFIX, 'FA');
$this->setConfigValue(self::CONFIG_KEY_INVOICE_REF_MIN_LENGTH, 8);
$this->setConfigValue(self::CONFIG_KEY_INVOICE_REF_WITH_THELIA_ORDER, 0);
$this->setConfigValue('is_initialized', true);
}
}
public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
{
if (null === self::getConfigValue(self::CONFIG_KEY_INVOICE_REF_WITH_THELIA_ORDER)) {
self::setConfigValue(
self::CONFIG_KEY_INVOICE_REF_WITH_THELIA_ORDER,
0
);
}
$sqlToExecute = [];
$finder = new Finder();
$sort = function (\SplFileInfo $a, \SplFileInfo $b) {
$a = strtolower(substr($a->getRelativePathname(), 0, -4));
$b = strtolower(substr($b->getRelativePathname(), 0, -4));
return version_compare($a, $b);
};
$files = $finder->name('*.sql')
->in(__DIR__ ."/Config/Update/")
->sort($sort);
foreach ($files as $file) {
if (version_compare($file->getFilename(), $currentVersion, ">")) {
$sqlToExecute[$file->getFilename()] = $file->getRealPath();
}
}
$database = new Database($con);
foreach ($sqlToExecute as $version => $sql) {
$database->insertSql(null, [$sql]);
}
}
}

View File

@@ -0,0 +1,57 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Event;
/**
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
*/
class CreditNoteEvents
{
const PROPEL_PRE_INSERT = "credit-note.pre.insert.";
const PROPEL_POST_INSERT = "credit-note.post.insert.";
const PROPEL_PRE_UPDATE = "credit-note.pre.update.";
const PROPEL_POST_UPDATE = "credit-note.post.update.";
const PROPEL_PRE_DELETE = "credit-note.pre.delete.";
const PROPEL_POST_DELETE = "credit-note.post.delete.";
public static function preInsert($tableName)
{
return self::PROPEL_PRE_INSERT . $tableName;
}
public static function postInsert($tableName)
{
return self::PROPEL_POST_INSERT . $tableName;
}
public static function preUpdate($tableName)
{
return self::PROPEL_PRE_UPDATE . $tableName;
}
public static function postUpdate($tableName)
{
return self::PROPEL_POST_UPDATE . $tableName;
}
public static function preDelete($tableName)
{
return self::PROPEL_PRE_DELETE . $tableName;
}
public static function postDelete($tableName)
{
return self::PROPEL_POST_DELETE . $tableName;
}
}

View File

@@ -0,0 +1,51 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Event;
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
use Thelia\Core\Event\ActionEvent;
/**
* @author Gilles Bourgeat <gilles@thelia.fr>
*/
class PropelEvent extends ActionEvent
{
/** @var ActiveRecordInterface */
protected $instance;
/** @var mixed */
protected $return;
/**
* PropelEvent constructor.
* @param ActiveRecordInterface $instance
*/
public function __construct(ActiveRecordInterface $instance)
{
$this->instance = $instance;
}
/**
* @return ActiveRecordInterface
*/
public function getInstance()
{
return $this->instance;
}
/**
* @param ActiveRecordInterface $instance
* @return PropelEvent
*/
public function setInstance($instance)
{
$this->instance = $instance;
return $this;
}
}

View File

@@ -0,0 +1,123 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\EventListener;
use CreditNote\CreditNote;
use CreditNote\Event\CreditNoteEvents;
use CreditNote\Event\PropelEvent;
use CreditNote\Model\CreditNote as CreditNoteModel;
use CreditNote\Model\Map\CreditNoteTableMap;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\ConfigQuery;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*/
class CreditNoteListener implements EventSubscriberInterface
{
/**
* Add credit note ref before save
* @param PropelEvent $event
*/
public function generateCreditNoteInvoiceRef(PropelEvent $event)
{
/** @var CreditNoteModel $instance */
$instance = $event->getInstance();
if ($instance->isColumnModified(CreditNoteTableMap::STATUS_ID)) {
if ($instance->getInvoiceRef() !== null && !$instance->getCreditNoteStatus()->getInvoiced()) {
throw new \Exception('This credit note is already invoiced, you can not cancel it');
}
if ($instance->getCreditNoteStatus()->getInvoiced() && $instance->getInvoiceRef() === null) {
if ((int) CreditNote::getConfigValue(CreditNote::CONFIG_KEY_INVOICE_REF_WITH_THELIA_ORDER)) {
if (!class_exists('\InvoiceRef\EventListeners\OrderListener')) {
throw new \Exception('Missing module InvoiceRef');
}
// dans le cas ou la facturation suit celle des commandes
$invoiceRef = ConfigQuery::create()
->findOneByName('invoiceRef');
$value = $invoiceRef->getValue();
$instance->setInvoiceRef($value)
->setInvoiceDate(new \DateTime())
;
$invoiceRef->setValue(++$value)
->save();
} else {
// cas ou la facturation suit sa propre règle
$ref = CreditNote::getConfigValue(CreditNote::CONFIG_KEY_INVOICE_REF_PREFIX) . str_pad(
(int) CreditNote::getConfigValue(CreditNote::CONFIG_KEY_INVOICE_REF_INCREMENT, 1) + 1,
CreditNote::getConfigValue(CreditNote::CONFIG_KEY_INVOICE_REF_MIN_LENGTH, 8),
"0",
STR_PAD_LEFT
);
$instance->setInvoiceRef($ref);
$instance->setInvoiceDate(new \DateTime());
CreditNote::setConfigValue(
CreditNote::CONFIG_KEY_INVOICE_REF_INCREMENT,
(int) CreditNote::getConfigValue(CreditNote::CONFIG_KEY_INVOICE_REF_INCREMENT, 1) + 1
);
}
}
}
}
/**
* Add credit note ref before save
* @param PropelEvent $event
*/
public function generateCreditNoteRef(PropelEvent $event)
{
/** @var CreditNoteModel $instance */
$instance = $event->getInstance();
if ($instance->getRef() === null) {
$ref = CreditNote::getConfigValue(CreditNote::CONFIG_KEY_REF_PREFIX) . str_pad(
(int) CreditNote::getConfigValue(CreditNote::CONFIG_KEY_REF_INCREMENT, 1) + 1,
CreditNote::getConfigValue(CreditNote::CONFIG_KEY_REF_MIN_LENGTH, 8),
"0",
STR_PAD_LEFT
);
$instance->setRef($ref);
$instance->setInvoiceDate(new \DateTime());
}
$this->generateCreditNoteInvoiceRef($event);
}
public function incrementCreditNoteRef(PropelEvent $event)
{
CreditNote::setConfigValue(
CreditNote::CONFIG_KEY_REF_INCREMENT,
(int) CreditNote::getConfigValue(CreditNote::CONFIG_KEY_REF_INCREMENT, 1) + 1
);
}
public static function getSubscribedEvents()
{
return array(
CreditNoteEvents::preInsert(CreditNoteTableMap::TABLE_NAME) => [
'generateCreditNoteRef', 128
],
CreditNoteEvents::postInsert(CreditNoteTableMap::TABLE_NAME) => [
'incrementCreditNoteRef', 128
],
CreditNoteEvents::preUpdate(CreditNoteTableMap::TABLE_NAME) => [
'generateCreditNoteInvoiceRef', 128
]
);
}
}

View File

@@ -0,0 +1,156 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Form;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Thelia\Form\BaseForm;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*/
class CreditNoteCreateForm extends BaseForm
{
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return 'credit-note-create';
}
/**
*
* 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 :
*
*/
protected function buildForm()
{
$this->formBuilder
->add('action', 'text', array(
'required' => false
))
->add('customer_id', 'integer', array(
'required' => false
))
->add('order_id', 'integer', array(
'required' => false
))
->add('status_id', 'integer', array(
'required' => false
))
->add('currency_id', 'integer', array(
'required' => false
))
->add('type_id', 'integer', array(
'required' => false
))
->add('currency_id', 'integer', array(
'required' => false
))
->add('total_price', 'number', array(
'required' => false
))
->add('comment', 'text', array(
'required' => false
));
$this->formBuilder
->add('order_product_quantity', 'collection', array(
'required' => false,
'allow_add' => true,
'allow_delete' => true
));
$this->formBuilder
->add('free_amount_price', 'collection', array(
'required' => false,
'allow_add' => true,
'allow_delete' => true
))
->add('free_amount_price_with_tax', 'collection', array(
'required' => false,
'allow_add' => true,
'allow_delete' => true
))
->add('free_amount_tax_rule_id', 'collection', array(
'required' => false,
'allow_add' => true,
'allow_delete' => true
))
->add('free_amount_type', 'collection', array(
'required' => false,
'allow_add' => true,
'allow_delete' => true
))
->add('free_amount_title', 'collection', array(
'required' => false,
'allow_add' => true,
'allow_delete' => true
))
->add('free_amount_id', 'collection', array(
'required' => false,
'allow_add' => true,
'allow_delete' => true
));
$this->formBuilder
->add('discount_without_tax', 'number', array(
'required' => false
))
->add('discount_with_tax', 'number', array(
'required' => false
))
;
$this->formBuilder->add('ui_target', ChoiceType::class, [
'choices' => [
'order' => 'order',
'customer' => 'customer'
]
]);
$this->formBuilder->add('ui_target_id', IntegerType::class);
$this->formBuilder
->add('invoice_address_id', IntegerType::class, array(
'required' => false
))
->add('invoice_address_title', TextType::class, array(
'required' => false
))
->add('invoice_address_firstname', TextType::class, array(
'required' => false
))
->add('invoice_address_lastname', TextType::class, array(
'required' => false
))
->add('invoice_address_company', TextType::class, array(
'required' => false
))
->add('invoice_address_address1', TextType::class, array(
'required' => false
))
->add('invoice_address_address2', TextType::class, array(
'required' => false
))
->add('invoice_address_zipcode', TextType::class, array(
'required' => false
))
->add('invoice_address_city', TextType::class, array(
'required' => false
))
->add('invoice_address_country_id', IntegerType::class, array(
'required' => false
))
;
}
}

View File

@@ -0,0 +1,35 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Form;
use Thelia\Form\BaseForm;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*/
class CreditNoteEmptyForm extends BaseForm
{
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return 'credit-note-delete';
}
/**
*
* 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 :
*
*/
protected function buildForm()
{
}
}

View File

@@ -0,0 +1,26 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Helper;
/**
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
*/
class CreditNoteHelper
{
const STATUS_PROPOSED = 'proposed';
const STATUS_REFUSED = 'refused';
const STATUS_ACCEPTED = 'accepted';
const STATUS_USED = 'used';
const TYPE_ORDER_FULL_REFUND = 'order_full_refund';
const TYPE_BACK_PRODUCT = 'back_product';
const TYPE_BILLING_ERROR = 'billing_error';
const TYPE_REBATE = 'rebate';
const TYPE_DISCOUNT = 'discount';
}

View File

@@ -0,0 +1,57 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Helper;
use Propel\Runtime\ActiveQuery\ModelCriteria;
/**
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
*/
trait CriteriaSearchHelper
{
/**
* @param string $q
* @return string
*/
public function getRegex($q)
{
$q = explode(' ', $q);
$words = array();
foreach ($q as $v) {
$v = trim($v);
if (strlen($v) > 2 && preg_match('/^[a-z0-9]+$/i', $v)) {
$words[] = $v;
}
}
if (!count($words)) {
return null;
}
$regex = array();
$regex[] = '.*' . implode('.+', $words) . '.*';
if (count($words) > 1) {
$regex[] = '.*' . implode('.+', array_reverse($words)) . '.*';
}
return implode('|', $regex);
}
/**
* @param ModelCriteria $query
* @param array $columns
* @param string $q
*/
public function whereConcatRegex(ModelCriteria $query, array $columns, $q)
{
$query->where("CONCAT_WS(' ', " . implode(',', $columns). ") REGEXP ?", self::getRegex($q), \PDO::PARAM_STR);
}
}

View File

@@ -0,0 +1,46 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Hook\Back;
use CreditNote\CreditNote;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Core\Thelia;
/**
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
*/
class CustomerEditHook extends BaseHook
{
public function onCustomerEdit(HookRenderEvent $event)
{
$event->add($this->render(
'hook/customer.edit.html',
array_merge($event->getArguments(), [
])
));
}
public function onCustomerEditBottom(HookRenderEvent $event)
{
$event->add($this->render(
'includes/credit-note-modal.html',
array_merge($event->getArguments(), [])
));
}
public function onCustomerEditJs(HookRenderEvent $event)
{
$event->add($this->render(
'includes/credit-note-js.html',
array_merge($event->getArguments(), [])
));
}
}

View File

@@ -0,0 +1,29 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Hook\Back;
use CreditNote\CreditNote;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
/**
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
*/
class MainHook extends BaseHook
{
public function onMainFooterJs(HookRenderEvent $event)
{
$event->add($this->render(
'hook/main.footer-js.html',
$event->getArguments() + [
'admin_current_location' => ($this->getRequest()->get('_route') == 'creditnote.list' ? 'credit-note' : '')
]
));
}
}

View File

@@ -0,0 +1,73 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Hook\Back;
use CreditNote\CreditNote;
use CreditNote\Model\CreditNoteDetailQuery;
use CreditNote\Model\CreditNoteQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Core\Thelia;
use Thelia\Core\Translation\Translator;
/**
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
*/
class OrderEditHook extends BaseHook
{
public function onOrderEditProductList(HookRenderEvent $event)
{
$creditNoteDetails = CreditNoteDetailQuery::create()
->filterByQuantity(0, Criteria::GREATER_THAN)
->filterByOrderProductId($event->getArgument('order_product_id'))
->find();
$event->add($this->render(
'hook/order-edit.product-list.html',
$event->getArguments() + ['creditNoteDetails' => $creditNoteDetails]
));
}
public function onOrderTab(HookRenderBlockEvent $event)
{
$count = CreditNoteQuery::create()
->filterByOrderId($event->getArgument('id'))
->count();
$event->add(
[
"id" => "credit-note",
"title" => Translator::getInstance()->trans("Credit Note", [], CreditNote::DOMAIN_MESSAGE) . ($count ? ' (' . $count . ')' : ''),
"content" => $this->render('hook/order.tab.html', array_merge($event->getArguments(), [
]))
]
);
}
public function onOrderEditBottom(HookRenderEvent $event)
{
$event->add($this->render(
'includes/credit-note-modal.html',
array_merge($event->getArguments(), [
])
));
}
public function onOrderEditJs(HookRenderEvent $event)
{
$event->add($this->render(
'hook/order.edit-js.html',
array_merge($event->getArguments(), [])
));
}
}

View File

@@ -0,0 +1,15 @@
<?php
return [
"Credit notes" => "Credit notes",
"There are no credit notes for this order." => "There are no credit notes for this order.",
"Credit note for order %order_ref" => "Credit note for order %order_ref",
"Create a credit note" => "Create a credit note",
"Credit note created." => "Credit note created.",
"Credit note for this order" => "Credit note for this order",
"Total credit notes amount" => "Total credit notes amount",
"This order has not been paid." => "This order has not been paid.",
// emails
"Message sent to the customer when a credit note is created from an order."
=> "Message sent to the customer when a credit note is created from an order.",
];

View File

@@ -0,0 +1,107 @@
<?php
return array(
'#' => '#',
'Action' => 'Action',
'Add a free amount' => 'Ajouter un montant libre',
'Add a new credit note' => 'Ajouter un nouvel avoir',
'Address : ' => 'Adresse :',
'Address complement : ' => 'Complément d\'adresse :',
'All Credit Notes' => 'Tous les avoirs',
'Amount with tax' => 'Montant TTC',
'Amount with tax %currency' => 'Montant TTC %currency',
'Amount without tax' => 'Montant HT',
'Amount without tax %currency' => 'Montant HT %currency',
'An error has occurred !!!' => 'Une erreur est survenue',
'Cancel' => 'Annuler',
'City : ' => 'Ville :',
'Close' => 'Fermer',
'Combination reference' => 'Référence déclinaison',
'Company : ' => 'Société :',
'Country : ' => 'Pays :',
'Coupon code' => 'Code coupon',
'Create credit note' => 'Créer l\'avoir',
'Create date' => 'Date de création',
'Credit Note Informations : ' => 'Informations avoir',
'Credit Note ref' => 'Avoir ref',
'Credit Note used :' => 'Avoir utilisé',
'Credit Notes' => 'Avoirs',
'Credit note' => 'Avoir',
'Credit note ref : <strong>%ref</strong>' => 'Référence avoir : <strong>%ref</strong>',
'Credit note used : ' => 'Avoir utilisé :',
'Credit note versions : ' => 'Versions de l\'avoir',
'Credit notes' => 'Avoirs',
'Customer' => 'Client',
'Customer : ' => 'Client :',
'Delete' => 'Supprimer',
'Delete credit note' => 'Supprimer cet avoir',
'Discount' => 'Réduction',
'Discount with tax : ' => 'Réduction TTC',
'Discount without tax : ' => 'Réduction HT',
'Do you really want to delete this credit note ?' => 'Voulez-vous vraiment supprimer cet avoir',
'Edit' => 'Editer',
'Fees' => 'Honoraires',
'Firstname' => 'Prénom :',
'Free amount : ' => 'Montant libre',
'Home' => 'Accueil',
'Internal comment : ' => 'Commentaire interne',
'Invoice address' => 'Adresse de facturation',
'Invoice date' => 'Date facture',
'Invoice ref' => 'Référence facture',
'Invoice ref : <strong>%ref</strong>' => 'Référence facture : <strong>%ref</strong>',
'Lastname : ' => 'Nom :',
'Message content : ' => 'Message :',
'Message status : ' => 'Statut :',
'No' => 'Non',
'No comments found for this credit note' => 'Aucun commentaire trouvé pour cet avoir',
'No free amount.' => 'Aucun montant libre',
'No version found for this credit note' => 'Aucune version trouvée pour cet avoir',
'Order' => 'Commande',
'Order : ' => 'Commande :',
'Order Informations : ' => 'Informations sur la commande :',
'Order discount informations : ' => 'Information sur la réduction appliquée à la commande',
'Other' => 'Autre',
'PDF' => 'PDF',
'Please wait, loading' => 'Veillez patienter, chargement ...',
'Postage' => 'Frais de livraison',
'Product' => 'Produit',
'Quantity' => 'Quantité',
'Ref' => 'Ref',
'Ref :' => 'Ref :',
'Remaining to pay : ' => 'Reste à payer',
'Save' => 'Sauvgarder',
'Search...' => 'Rechercher ...',
'Shipping' => 'Livraison',
'Status' => 'Statut',
'Status : ' => 'Statut :',
'Status : %title' => 'Statut : %title',
'Tax' => 'Taxe',
'Tax rule' => 'Règle de taxe',
'Taxes' => 'Taxes',
'Taxes : ' => 'Taxes : ',
'This credit note use the currency : %currency' => 'Cet avoir utilise la devise : %currency',
'This credit note use the currency : <strong>%currency</strong>' => 'Cet avoir utilise la devise : <strong>%currency</strong>',
'Titile' => 'Titre',
'Title' => 'Titre',
'Total' => 'Total',
'Total including discount' => 'Total avec réduction',
'Total with tax' => 'Total TTC',
'Total with tax : ' => 'Total TTC : ',
'Total without discount' => 'Total sans réduction',
'Total without tax' => 'Total HT',
'Total without tax : ' => 'Total HT : ',
'Type' => 'Type',
'Type : ' => 'Type :',
'Unit taxed price' => 'Prix unitaire taxé',
'Unit. price' => 'Prix unitaire',
'Update credit note' => 'Mettre à jour l\'avoir',
'Update date' => 'Date de mise à jour',
'Used by order :' => 'Utilisé par commande :',
'User' => 'Utilisateur',
'View' => 'Voir',
'Virtual product' => 'Produit virtuel',
'Yes' => 'Oui',
'You can not create a credit note for this order because it is not invoiced.' => 'Vous ne pouvez pas créer d\'avoir pour cette commande, elle n\'est pas facturée',
'You have no credit notes for the moment.' => 'Vous n\'avez pas d\'avoir',
'Zipcode : ' => 'Code postal',
);

View File

@@ -0,0 +1,9 @@
<?php
return [
"Credit note on your order %order_ref"
=> "Credit note on your order %order_ref",
"You have been granted a credit note of %credit_note_amount on your order %order_ref."
=> "You have been granted a credit note of %credit_note_amount on your order %order_ref.",
"Use the coupon code %coupon_code to use this credit note."
=> "Use the coupon code %coupon_code to use this credit note.",
];

View File

@@ -0,0 +1,9 @@
<?php
return [
"Credit note on your order %order_ref"
=> "Avoir sur votre commande %order_ref",
"You have been granted a credit note of %credit_note_amount on your order %order_ref."
=> "Un avoir de %credit_note_amount vous a été accordé suite à votre commande %order_ref.",
"Use the coupon code %coupon_code to use this credit note."
=> "Utilisez-le en entrant le code promo %coupon_code.",
];

View File

@@ -0,0 +1,10 @@
<?php
return [
// configuration
"CreditNote module configuration" => "CreditNote module configuration",
"Configuration correctly saved" => "Configuration correctly saved",
"Coupon code validity period (days)" => "Coupon code validity period (days)",
"Coupon code prefix" => "Coupon code prefix",
"Restrict coupon codes from order credit notes to the original customer"
=> "Restrict coupon codes from order credit notes to the original customer",
];

View File

@@ -0,0 +1,7 @@
<?php
return array(
'Credit Note' => 'Avoir',
'We\'re sorry, this PDF invoice is not available at the moment.' => 'Erreur, impossible de créer le pdf',
'You can not delete this credit note' => 'Vous ne pouvez pas supprimer cet avoir',
);

View File

@@ -0,0 +1,25 @@
<?php
return array(
'CREDIT NOTE INVOICE' => 'Facture d\'avoir',
'Combination ref : ' => 'Référence déclinaison :',
'Credit note REF' => 'Référence avoir',
'Customer Number' => 'Référence client',
'Discount' => 'Réduction',
'Email: ' => 'E-mail :',
'Invoice REF' => 'Référence facture',
'Invoice address' => 'Adresse de facturation',
'Invoice date' => 'Date de facturation',
'Phone: ' => 'Téléphone :',
'Product' => 'Produit',
'Product ref : ' => 'Référence produit :',
'Quantity' => 'Quantité',
'Referance invoice REF' => 'Fait référence à la facture',
'Referance order REF' => 'Fait référence à la commande',
'Tax' => 'Taxe',
'Total with tax' => 'Total TTC',
'Total without tax' => 'Total HT',
'Unit taxed price' => 'Prix unitaire taxé',
'Unit. price' => 'Prix unitaire',
'page' => 'page',
);

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 thelia-modules
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,270 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Loop;
use CreditNote\Model\CreditNoteQuery;
use CreditNote\Model\CreditNote as CreditNoteModel;
use CreditNote\Model\Map\CreditNoteStatusI18nTableMap;
use CreditNote\Model\Map\CreditNoteStatusTableMap;
use CreditNote\Model\Map\CreditNoteTypeI18nTableMap;
use CreditNote\Model\Map\CreditNoteTypeTableMap;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\Map\CustomerTableMap;
use Thelia\Model\Map\OrderTableMap;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*
* @method string[] getRef()
* @method string[] getInvoiceRef()
* @method int[] getId()
* @method int[] getStatusId()
* @method int[] getOrderProductId()
* @method int[] getTypeId()
* @method int[] getOrderId()
* @method int[] getCustomerId()
* @method int[] getParentId()
* @method string[] getOrder()
* @method boolean|string getUsed()
* @method boolean|string getInvoiced()
*/
class CreditNote extends BaseLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createAnyListTypeArgument('ref'),
Argument::createAnyListTypeArgument('invoice_ref'),
Argument::createIntListTypeArgument("id"),
Argument::createAnyListTypeArgument("status_id"),
Argument::createAnyListTypeArgument("order_product_id"),
Argument::createAnyListTypeArgument("type_id"),
Argument::createIntListTypeArgument("order_id"),
Argument::createIntListTypeArgument("customer_id"),
Argument::createIntListTypeArgument("parent_id"),
Argument::createBooleanOrBothTypeArgument("used"),
Argument::createBooleanOrBothTypeArgument("invoiced"),
Argument::createEnumListTypeArgument(
"order",
[
"id", "id-reverse",
"create-date", "create-date-reverse",
"status", "status-reverse",
'update-date', 'update-date-reverse',
],
"id"
)
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$query = new CreditNoteQuery();
if (null !== $id = $this->getId()) {
$query->filterById($id);
}
if (null !== $invoiceRef = $this->getInvoiceRef()) {
$query->filterByInvoiceRef($invoiceRef);
}
if (null !== $ref = $this->getRef()) {
$query->filterByRef($ref);
}
if (null !== $type = $this->getTypeId()) {
$query->FilterByTypeId($type);
}
if (null !== $status = $this->getStatusId()) {
$query->filterByStatusId($status);
}
if (null !== $orderProduct = $this->getOrderProductId()) {
$query->useCreditNoteDetailQuery()
->filterByOrderProductId($orderProduct)
->endUse();
}
if (null !== $order = $this->getOrderId()) {
$query->filterByOrderId($order);
}
if (null !== $parent = $this->getParentId()) {
$query->filterByParentId($parent);
}
if (null !== $customer = $this->getCustomerId()) {
$query->filterByCustomerId($customer);
}
if (is_bool($this->getUsed())) {
$query->useCreditNoteStatusQuery()
->filterByUsed($this->getUsed())
->endUse();
}
if (is_bool($this->getInvoiced())) {
$query->useCreditNoteStatusQuery()
->filterByInvoiced($this->getInvoiced())
->endUse();
}
$this->addJoin($query);
$this->addVirtualColumn($query);
$this->buildModelCriteriaOrder($query);
$query->groupById();
return $query;
}
/**
* @param CreditNoteQuery $query
*/
protected function buildModelCriteriaOrder($query)
{
foreach ($this->getOrder() as $order) {
switch ($order) {
case "id":
$query->orderById();
break;
case "id-reverse":
$query->orderById(Criteria::DESC);
break;
case 'create-date':
$query->orderByCreatedAt(Criteria::ASC);
break;
case 'create-date-reverse':
$query->orderByCreatedAt(Criteria::DESC);
break;
case 'status':
$query->orderByStatusId(Criteria::ASC);
break;
case 'status-reverse':
$query->orderByStatusId(Criteria::DESC);
break;
case 'update-date':
$query->orderByUpdatedAt(Criteria::ASC);
break;
case 'update-date-reverse':
$query->orderByUpdatedAt(Criteria::DESC);
break;
}
}
}
/**
* @param CreditNoteQuery $query
*/
protected function addJoin($query)
{
$query->useCustomerQuery()
->endUse();
$query->useOrderQuery()
->endUse();
$query->useCreditNoteTypeQuery()
->leftJoinCreditNoteTypeI18n(CreditNoteTypeI18nTableMap::TABLE_NAME)
->endUse();
$query->addJoinCondition(CreditNoteTypeI18nTableMap::TABLE_NAME, CreditNoteTypeI18nTableMap::LOCALE . '=?', $this->getLocale());
$query->useCreditNoteStatusQuery()
->leftJoinCreditNoteStatusI18n(CreditNoteStatusI18nTableMap::TABLE_NAME)
->endUse();
$query->addJoinCondition(CreditNoteStatusI18nTableMap::TABLE_NAME, CreditNoteStatusI18nTableMap::LOCALE . '=?', $this->getLocale());
}
/**
* @param CreditNoteQuery $query
*/
protected function addVirtualColumn($query)
{
$query
->withColumn('CONCAT_WS(" ",' . CustomerTableMap::FIRSTNAME . ',' . CustomerTableMap::LASTNAME .')', 'CUSTOMER_NAME')
->withColumn(OrderTableMap::REF, 'ORDER_REF')
->withColumn(CreditNoteStatusI18nTableMap::TITLE, 'STATUS_TITLE')
->withColumn(CreditNoteStatusTableMap::COLOR, 'STATUS_COLOR')
->withColumn(CreditNoteTypeI18nTableMap::TITLE, 'TYPE_TITLE')
->withColumn(CreditNoteTypeTableMap::COLOR, 'TYPE_COLOR');
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var CreditNoteModel $entry */
foreach ($loopResult->getResultDataCollection() as $entry) {
$row = new LoopResultRow($entry);
$row
->set("ID", $entry->getId())
->set("REF", $entry->getRef())
->set("INVOICE_REF", $entry->getInvoiceRef())
->set("INVOICE_DATE", $entry->getInvoiceDate())
->set("TYPE_ID", $entry->getTypeId())
->set("STATUS_ID", $entry->getStatusId())
->set("ORDER_ID", $entry->getOrderId())
->set("PARENT_ID", $entry->getParentId())
->set("CUSTOMER_ID", $entry->getCustomerId())
->set('CURRENCY_ID', $entry->getCurrencyId())
->set("TOTAL_PRICE", $entry->getTotalPrice())
->set("TOTAL_PRICE_WITH_TAX", $entry->getTotalPriceWithTax())
->set("DISCOUNT_WITHOUT_TAX", $entry->getDiscountWithoutTax())
->set("DISCOUNT_WITH_TAX", $entry->getDiscountWithTax())
->set('CUSTOMER_NAME', $entry->getVirtualColumn('CUSTOMER_NAME'))
->set('ORDER_REF', $entry->getVirtualColumn('ORDER_REF'))
->set('STATUS_TITLE', $entry->getVirtualColumn('STATUS_TITLE'))
->set('STATUS_COLOR', $entry->getVirtualColumn('STATUS_COLOR'))
->set('TYPE_TITLE', $entry->getVirtualColumn('TYPE_TITLE'))
->set('TYPE_COLOR', $entry->getVirtualColumn('TYPE_COLOR'))
;
$this->addOutputFields($row, $entry);
$loopResult->addRow($row);
}
return $loopResult;
}
/**
* @return string
*/
protected function getLocale()
{
if ($this->request->fromAdmin()) {
return $this->request->getSession()->getAdminUser()->getLocale();
} else {
return $this->request->getSession()->getLang()->getLocale();
}
}
}

View File

@@ -0,0 +1,76 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Loop;
use CreditNote\Model\CreditNoteAddressQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
/**
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
*/
class CreditNoteAddress extends BaseLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('id', null, true)
);
}
public function buildModelCriteria()
{
$search = CreditNoteAddressQuery::create();
$id = $this->getId();
$search->filterById($id, Criteria::IN);
return $search;
}
public function parseResults(LoopResult $loopResult)
{
/** @var \CreditNote\Model\CreditNoteAddress $creditNoteAddress */
foreach ($loopResult->getResultDataCollection() as $creditNoteAddress) {
$loopResultRow = new LoopResultRow($creditNoteAddress);
$loopResultRow
->set("ID", $creditNoteAddress->getId())
->set("TITLE", $creditNoteAddress->getCustomerTitleId())
->set("COMPANY", $creditNoteAddress->getCompany())
->set("FIRSTNAME", $creditNoteAddress->getFirstname())
->set("LASTNAME", $creditNoteAddress->getLastname())
->set("ADDRESS1", $creditNoteAddress->getAddress1())
->set("ADDRESS2", $creditNoteAddress->getAddress2())
->set("ADDRESS3", $creditNoteAddress->getAddress3())
->set("ZIPCODE", $creditNoteAddress->getZipcode())
->set("CITY", $creditNoteAddress->getCity())
->set("COUNTRY", $creditNoteAddress->getCountryId())
->set("STATE", $creditNoteAddress->getStateId())
->set("PHONE", $creditNoteAddress->getPhone())
->set("CELLPHONE", $creditNoteAddress->getCellphone())
;
$this->addOutputFields($loopResultRow, $creditNoteAddress);
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,126 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Loop;
use CreditNote\Model\CreditNoteCommentQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\Map\AdminTableMap;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*
* @method string[] getCode()
* @method int[] getId()
* @method int[] getCreditNoteId()
* @method string[] getOrder()
*/
class CreditNoteComment extends BaseI18nLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument("id"),
Argument::createIntListTypeArgument("credit_note_id"),
Argument::createEnumListTypeArgument(
"order",
[
"id", "id-reverse",
"create-date", "create-date-reverse"
],
"create-date"
)
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$query = new CreditNoteCommentQuery();
if (null !== $id = $this->getId()) {
$query->filterById($id);
}
if (null !== $creditNoteId = $this->getCreditNoteId()) {
$query->filterByCreditNoteId($creditNoteId);
}
$query->useAdminQuery()
->endUse();
$query->withColumn(AdminTableMap::LOGIN, 'ADMIN_LOGIN');
$query->withColumn(AdminTableMap::FIRSTNAME, 'ADMIN_FIRST_NAME');
$query->withColumn(AdminTableMap::LASTNAME, 'ADMIN_LAST_NAME');
$this->buildModelCriteriaOrder($query);
return $query;
}
/**
* @param CreditNoteCommentQuery $query
*/
protected function buildModelCriteriaOrder($query)
{
foreach ($this->getOrder() as $order) {
switch ($order) {
case "id":
$query->orderById();
break;
case "id-reverse":
$query->orderById(Criteria::DESC);
break;
case 'create-date':
$query->orderByCreatedAt(Criteria::ASC);
break;
case 'create-date-reverse':
$query->orderByCreatedAt(Criteria::DESC);
break;
}
}
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \CreditNote\Model\CreditNoteComment $entry */
foreach ($loopResult->getResultDataCollection() as $entry) {
$row = new LoopResultRow($entry);
$row
->set("ID", $entry->getId())
->set("CREDIT_NOTE_ID", $entry->getCreditNoteId())
->set("ADMIN_ID", $entry->getAdminId())
->set("ADMIN_LOGIN", $entry->getVirtualColumn('ADMIN_LOGIN'))
->set("ADMIN_FIRST_NAME", $entry->getVirtualColumn('ADMIN_FIRST_NAME'))
->set("ADMIN_LAST_NAME", $entry->getVirtualColumn('ADMIN_LAST_NAME'))
->set("COMMENT", $entry->getComment())
;
$this->addOutputFields($row, $entry);
$loopResult->addRow($row);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,112 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Loop;
use CreditNote\Model\CreditNoteDetailQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*
* @method int[] getId()
* @method int[] getCreditNoteId()
* @method string[] getOrder()
*/
class CreditNoteDetail extends BaseI18nLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument("id"),
Argument::createIntListTypeArgument("credit_note_id"),
Argument::createEnumListTypeArgument(
"order",
[
"id", "id-reverse"
],
"id"
)
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$query = new CreditNoteDetailQuery();
if (null !== $id = $this->getId()) {
$query->filterById($id);
}
if (null !== $creditNoteId = $this->getCreditNoteId()) {
$query->filterByCreditNoteId($creditNoteId);
}
$this->buildModelCriteriaOrder($query);
return $query;
}
/**
* @param CreditNoteDetailQuery $query
*/
protected function buildModelCriteriaOrder($query)
{
foreach ($this->getOrder() as $order) {
switch ($order) {
case "id":
$query->orderById();
break;
case "id-reverse":
$query->orderById(Criteria::DESC);
break;
}
}
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \CreditNote\Model\CreditNoteDetail $entry */
foreach ($loopResult->getResultDataCollection() as $entry) {
$row = new LoopResultRow($entry);
$row
->set("ID", $entry->getId())
->set("CREDIT_NOTE_ID", $entry->getCreditNoteId())
->set("PRICE", $entry->getPrice())
->set("PRICE_WITH_TAX", $entry->getPriceWithTax())
->set("TAX_RULE_ID", $entry->getTaxRuleId())
->set("ORDER_PRODUCT_ID", $entry->getOrderProductId())
->set("TYPE", $entry->getType())
->set("QUANTITY", $entry->getQuantity())
->set("TITLE", $entry->getTitle())
;
$this->addOutputFields($row, $entry);
$loopResult->addRow($row);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,168 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Loop;
use CreditNote\Model\CreditNoteStatusFlowQuery;
use CreditNote\Model\CreditNoteStatusQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Type\BooleanOrBothType;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*
* @method string[] getCode()
* @method int[] getId()
* @method int[] getPosition()
* @method int[] getCurrentStatusId()
* @method string[] getOrder()
* @method string|bool getInvoiced()
* @method string|bool getUsed()
*/
class CreditNoteStatus extends BaseI18nLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createAnyListTypeArgument('code'),
Argument::createIntListTypeArgument("id"),
Argument::createIntListTypeArgument("position"),
Argument::createBooleanOrBothTypeArgument("invoiced", BooleanOrBothType::ANY),
Argument::createBooleanOrBothTypeArgument("used", BooleanOrBothType::ANY),
Argument::createIntListTypeArgument("current_status_id"),
Argument::createEnumListTypeArgument(
"order",
[
"id", "id-reverse",
"create-date", "create-date-reverse",
"code", "code-reverse",
"position", "position-reverse"
],
"position"
)
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$query = new CreditNoteStatusQuery();
if (null !== $id = $this->getId()) {
$query->filterById($id);
}
if (null !== $code = $this->getCode()) {
$query->filterByCode($code);
}
if (null !== $position = $this->getPosition()) {
$query->filterByPosition($position);
}
if (BooleanOrBothType::ANY !== $used = $this->getUsed()) {
$query->filterByUsed($used);
}
if (BooleanOrBothType::ANY !== $invoiced = $this->getInvoiced()) {
$query->filterByInvoiced($invoiced);
}
if (null !== $currentStatusId = $this->getCurrentStatusId()) {
$flowIds = CreditNoteStatusFlowQuery::create()
->filterByFromStatusId($currentStatusId)
->find()->toArray('toStatusId');
$flowIds = array_keys($flowIds);
$query->filterById(array_merge($flowIds, $currentStatusId));
}
$this->configureI18nProcessing($query, ['TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM']);
$this->buildModelCriteriaOrder($query);
$query->groupById();
return $query;
}
/**
* @param CreditNoteStatusQuery $query
*/
protected function buildModelCriteriaOrder($query)
{
foreach ($this->getOrder() as $order) {
switch ($order) {
case "id":
$query->orderById();
break;
case "id-reverse":
$query->orderById(Criteria::DESC);
break;
case 'create-date':
$query->orderByCreatedAt(Criteria::ASC);
break;
case 'create-date-reverse':
$query->orderByCreatedAt(Criteria::DESC);
break;
case 'code':
$query->orderByCode(Criteria::ASC);
break;
case 'code-reverse':
$query->orderByCode(Criteria::DESC);
break;
case 'position':
$query->orderByPosition(Criteria::ASC);
break;
case 'position-reverse':
$query->orderByPosition(Criteria::DESC);
break;
}
}
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \CreditNote\Model\CreditNoteStatus $entry */
foreach ($loopResult->getResultDataCollection() as $entry) {
$row = new LoopResultRow($entry);
$row
->set("ID", $entry->getId())
->set("CODE", $entry->getCode())
->set("COLOR", $entry->getColor())
->set("POSITION", $entry->getPosition())
->set("TITLE", $entry->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $entry->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $entry->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $entry->getVirtualColumn('i18n_POSTSCRIPTUM'))
;
$this->addOutputFields($row, $entry);
$loopResult->addRow($row);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,140 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Loop;
use CreditNote\Model\CreditNoteTypeQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*
* @method string[] getCode()
* @method int[] getId()
* @method int[] getPosition()
* @method string[] getOrder()
*/
class CreditNoteType extends BaseI18nLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createAnyListTypeArgument('code'),
Argument::createIntListTypeArgument("id"),
Argument::createIntListTypeArgument("position"),
Argument::createEnumListTypeArgument(
"order",
[
"id", "id-reverse",
"create-date", "create-date-reverse",
"code", "code-reverse",
"position", "position-reverse"
],
"position"
)
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$query = new CreditNoteTypeQuery();
if (null !== $id = $this->getId()) {
$query->filterById($id);
}
if (null !== $code = $this->getCode()) {
$query->filterByCode($code);
}
if (null !== $position = $this->getPosition()) {
$query->filterByPosition($position);
}
$this->configureI18nProcessing($query, ['TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM']);
$this->buildModelCriteriaOrder($query);
return $query;
}
/**
* @param CreditNoteTypeQuery $query
*/
protected function buildModelCriteriaOrder($query)
{
foreach ($this->getOrder() as $order) {
switch ($order) {
case "id":
$query->orderById();
break;
case "id-reverse":
$query->orderById(Criteria::DESC);
break;
case 'create-date':
$query->orderByCreatedAt(Criteria::ASC);
break;
case 'create-date-reverse':
$query->orderByCreatedAt(Criteria::DESC);
break;
case 'code':
$query->orderByCode(Criteria::ASC);
break;
case 'code-reverse':
$query->orderByCode(Criteria::DESC);
break;
case 'position':
$query->orderByPosition(Criteria::ASC);
break;
case 'position-reverse':
$query->orderByPosition(Criteria::DESC);
break;
}
}
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \CreditNote\Model\CreditNoteType $entry */
foreach ($loopResult->getResultDataCollection() as $entry) {
$row = new LoopResultRow($entry);
$row
->set("ID", $entry->getId())
->set("CODE", $entry->getCode())
->set("COLOR", $entry->getColor())
->set("POSITION", $entry->getPosition())
->set("TITLE", $entry->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $entry->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $entry->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $entry->getVirtualColumn('i18n_POSTSCRIPTUM'))
;
$this->addOutputFields($row, $entry);
$loopResult->addRow($row);
}
return $loopResult;
}
}

View File

@@ -0,0 +1,148 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Loop;
use CreditNote\Model\CreditNoteVersionQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*
* @method string[] getRef()
* @method int[] getId()
* @method string[] getOrder()
*/
class CreditNoteVersion extends BaseLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createAnyListTypeArgument('ref'),
Argument::createIntListTypeArgument("id"),
Argument::createEnumListTypeArgument(
"order",
[
"id", "id-reverse",
"create-date", "create-date-reverse"
],
"id"
)
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$query = new CreditNoteVersionQuery();
if (null !== $id = $this->getId()) {
$query->filterById($id);
}
if (null !== $ref = $this->getRef()) {
$query->filterByRef($ref);
}
$this->addJoin($query);
$this->addVirtualColumn($query);
$this->buildModelCriteriaOrder($query);
$query->groupById();
return $query;
}
/**
* @param CreditNoteVersionQuery $query
*/
protected function buildModelCriteriaOrder($query)
{
foreach ($this->getOrder() as $order) {
switch ($order) {
case "id":
$query->orderById();
break;
case "id-reverse":
$query->orderById(Criteria::DESC);
break;
case 'create-date':
$query->orderByCreatedAt(Criteria::ASC);
break;
case 'create-date-reverse':
$query->orderByCreatedAt(Criteria::DESC);
break;
}
}
}
/**
* @param CreditNoteVersionQuery $query
*/
protected function addJoin($query)
{
}
/**
* @param CreditNoteVersionQuery $query
*/
protected function addVirtualColumn($query)
{
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \CreditNote\Model\CreditNoteVersion $entry */
foreach ($loopResult->getResultDataCollection() as $entry) {
$row = new LoopResultRow($entry);
$row
->set("ID", $entry->getId())
->set("REF", $entry->getRef())
->set("TYPE_ID", $entry->getTypeId())
->set("STATUS_ID", $entry->getStatusId())
->set("ORDER_ID", $entry->getOrderId())
->set("PARENT_ID", $entry->getParentId())
->set("CUSTOMER_ID", $entry->getCustomerId())
->set("TOTAL_AMOUNT_PRICE", $entry->getTotalPriceWithTax())
;
$this->addOutputFields($row, $entry);
$loopResult->addRow($row);
}
return $loopResult;
}
/**
* @return string
*/
protected function getLocale()
{
return $this->request->getSession()->getAdminEditionLang()->getLocale();
}
}

View File

@@ -0,0 +1,78 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Loop;
use CreditNote\Model\OrderCreditNoteQuery;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
/**
* @author Gilles Bourgeat <gilles.bourgeat@gmail.com>
*
* @method int[] getCreditNoteId()
* @method int[] getOrderId()
*/
class OrderCreditNote extends BaseI18nLoop implements PropelSearchLoopInterface
{
protected $timestampable = true;
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument("credit_note_id"),
Argument::createIntListTypeArgument("order_id")
);
}
/**
* this method returns a Propel ModelCriteria
*
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
*/
public function buildModelCriteria()
{
$query = new OrderCreditNoteQuery();
if (null !== $creditNoteId = $this->getCreditNoteId()) {
$query->filterByCreditNoteId($creditNoteId);
}
if (null !== $orderId = $this->getOrderId()) {
$query->filterByOrderId($orderId);
}
return $query;
}
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var \CreditNote\Model\OrderCreditNote $entry */
foreach ($loopResult->getResultDataCollection() as $entry) {
$row = new LoopResultRow($entry);
$row
->set("ORDER_ID", $entry->getOrderId())
->set("CREDIT_NOTE_ID", $entry->getCreditNoteId())
->set("AMOUNT", $entry->getAmountPrice())
;
$this->addOutputFields($row, $entry);
$loopResult->addRow($row);
}
return $loopResult;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,774 @@
<?php
namespace CreditNote\Model\Base;
use \Exception;
use \PDO;
use CreditNote\Model\CartCreditNote as ChildCartCreditNote;
use CreditNote\Model\CartCreditNoteQuery as ChildCartCreditNoteQuery;
use CreditNote\Model\Map\CartCreditNoteTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Cart;
/**
* Base class that represents a query for the 'cart_credit_note' table.
*
*
*
* @method ChildCartCreditNoteQuery orderByCartId($order = Criteria::ASC) Order by the cart_id column
* @method ChildCartCreditNoteQuery orderByCreditNoteId($order = Criteria::ASC) Order by the credit_note_id column
* @method ChildCartCreditNoteQuery orderByAmountPrice($order = Criteria::ASC) Order by the amount_price column
* @method ChildCartCreditNoteQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCartCreditNoteQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildCartCreditNoteQuery groupByCartId() Group by the cart_id column
* @method ChildCartCreditNoteQuery groupByCreditNoteId() Group by the credit_note_id column
* @method ChildCartCreditNoteQuery groupByAmountPrice() Group by the amount_price column
* @method ChildCartCreditNoteQuery groupByCreatedAt() Group by the created_at column
* @method ChildCartCreditNoteQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildCartCreditNoteQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCartCreditNoteQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCartCreditNoteQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCartCreditNoteQuery leftJoinCart($relationAlias = null) Adds a LEFT JOIN clause to the query using the Cart relation
* @method ChildCartCreditNoteQuery rightJoinCart($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Cart relation
* @method ChildCartCreditNoteQuery innerJoinCart($relationAlias = null) Adds a INNER JOIN clause to the query using the Cart relation
*
* @method ChildCartCreditNoteQuery leftJoinCreditNote($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNote relation
* @method ChildCartCreditNoteQuery rightJoinCreditNote($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNote relation
* @method ChildCartCreditNoteQuery innerJoinCreditNote($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNote relation
*
* @method ChildCartCreditNote findOne(ConnectionInterface $con = null) Return the first ChildCartCreditNote matching the query
* @method ChildCartCreditNote findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCartCreditNote matching the query, or a new ChildCartCreditNote object populated from the query conditions when no match is found
*
* @method ChildCartCreditNote findOneByCartId(int $cart_id) Return the first ChildCartCreditNote filtered by the cart_id column
* @method ChildCartCreditNote findOneByCreditNoteId(int $credit_note_id) Return the first ChildCartCreditNote filtered by the credit_note_id column
* @method ChildCartCreditNote findOneByAmountPrice(string $amount_price) Return the first ChildCartCreditNote filtered by the amount_price column
* @method ChildCartCreditNote findOneByCreatedAt(string $created_at) Return the first ChildCartCreditNote filtered by the created_at column
* @method ChildCartCreditNote findOneByUpdatedAt(string $updated_at) Return the first ChildCartCreditNote filtered by the updated_at column
*
* @method array findByCartId(int $cart_id) Return ChildCartCreditNote objects filtered by the cart_id column
* @method array findByCreditNoteId(int $credit_note_id) Return ChildCartCreditNote objects filtered by the credit_note_id column
* @method array findByAmountPrice(string $amount_price) Return ChildCartCreditNote objects filtered by the amount_price column
* @method array findByCreatedAt(string $created_at) Return ChildCartCreditNote objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCartCreditNote objects filtered by the updated_at column
*
*/
abstract class CartCreditNoteQuery extends ModelCriteria
{
/**
* Initializes internal state of \CreditNote\Model\Base\CartCreditNoteQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\CreditNote\\Model\\CartCreditNote', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCartCreditNoteQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCartCreditNoteQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \CreditNote\Model\CartCreditNoteQuery) {
return $criteria;
}
$query = new \CreditNote\Model\CartCreditNoteQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$cart_id, $credit_note_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCartCreditNote|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CartCreditNoteTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CartCreditNoteTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCartCreditNote A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT CART_ID, CREDIT_NOTE_ID, AMOUNT_PRICE, CREATED_AT, UPDATED_AT FROM cart_credit_note WHERE CART_ID = :p0 AND CREDIT_NOTE_ID = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCartCreditNote();
$obj->hydrate($row);
CartCreditNoteTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCartCreditNote|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(CartCreditNoteTableMap::CART_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(CartCreditNoteTableMap::CREDIT_NOTE_ID, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(CartCreditNoteTableMap::CART_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(CartCreditNoteTableMap::CREDIT_NOTE_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the cart_id column
*
* Example usage:
* <code>
* $query->filterByCartId(1234); // WHERE cart_id = 1234
* $query->filterByCartId(array(12, 34)); // WHERE cart_id IN (12, 34)
* $query->filterByCartId(array('min' => 12)); // WHERE cart_id > 12
* </code>
*
* @see filterByCart()
*
* @param mixed $cartId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByCartId($cartId = null, $comparison = null)
{
if (is_array($cartId)) {
$useMinMax = false;
if (isset($cartId['min'])) {
$this->addUsingAlias(CartCreditNoteTableMap::CART_ID, $cartId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($cartId['max'])) {
$this->addUsingAlias(CartCreditNoteTableMap::CART_ID, $cartId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CartCreditNoteTableMap::CART_ID, $cartId, $comparison);
}
/**
* Filter the query on the credit_note_id column
*
* Example usage:
* <code>
* $query->filterByCreditNoteId(1234); // WHERE credit_note_id = 1234
* $query->filterByCreditNoteId(array(12, 34)); // WHERE credit_note_id IN (12, 34)
* $query->filterByCreditNoteId(array('min' => 12)); // WHERE credit_note_id > 12
* </code>
*
* @see filterByCreditNote()
*
* @param mixed $creditNoteId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByCreditNoteId($creditNoteId = null, $comparison = null)
{
if (is_array($creditNoteId)) {
$useMinMax = false;
if (isset($creditNoteId['min'])) {
$this->addUsingAlias(CartCreditNoteTableMap::CREDIT_NOTE_ID, $creditNoteId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($creditNoteId['max'])) {
$this->addUsingAlias(CartCreditNoteTableMap::CREDIT_NOTE_ID, $creditNoteId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CartCreditNoteTableMap::CREDIT_NOTE_ID, $creditNoteId, $comparison);
}
/**
* Filter the query on the amount_price column
*
* Example usage:
* <code>
* $query->filterByAmountPrice(1234); // WHERE amount_price = 1234
* $query->filterByAmountPrice(array(12, 34)); // WHERE amount_price IN (12, 34)
* $query->filterByAmountPrice(array('min' => 12)); // WHERE amount_price > 12
* </code>
*
* @param mixed $amountPrice The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByAmountPrice($amountPrice = null, $comparison = null)
{
if (is_array($amountPrice)) {
$useMinMax = false;
if (isset($amountPrice['min'])) {
$this->addUsingAlias(CartCreditNoteTableMap::AMOUNT_PRICE, $amountPrice['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($amountPrice['max'])) {
$this->addUsingAlias(CartCreditNoteTableMap::AMOUNT_PRICE, $amountPrice['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CartCreditNoteTableMap::AMOUNT_PRICE, $amountPrice, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(CartCreditNoteTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CartCreditNoteTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CartCreditNoteTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(CartCreditNoteTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CartCreditNoteTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CartCreditNoteTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Cart object
*
* @param \Thelia\Model\Cart|ObjectCollection $cart The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByCart($cart, $comparison = null)
{
if ($cart instanceof \Thelia\Model\Cart) {
return $this
->addUsingAlias(CartCreditNoteTableMap::CART_ID, $cart->getId(), $comparison);
} elseif ($cart instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CartCreditNoteTableMap::CART_ID, $cart->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCart() only accepts arguments of type \Thelia\Model\Cart or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Cart relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function joinCart($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Cart');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Cart');
}
return $this;
}
/**
* Use the Cart relation Cart object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\CartQuery A secondary query class using the current class as primary query
*/
public function useCartQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCart($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Cart', '\Thelia\Model\CartQuery');
}
/**
* Filter the query by a related \CreditNote\Model\CreditNote object
*
* @param \CreditNote\Model\CreditNote|ObjectCollection $creditNote The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function filterByCreditNote($creditNote, $comparison = null)
{
if ($creditNote instanceof \CreditNote\Model\CreditNote) {
return $this
->addUsingAlias(CartCreditNoteTableMap::CREDIT_NOTE_ID, $creditNote->getId(), $comparison);
} elseif ($creditNote instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CartCreditNoteTableMap::CREDIT_NOTE_ID, $creditNote->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCreditNote() only accepts arguments of type \CreditNote\Model\CreditNote or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNote relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function joinCreditNote($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNote');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNote');
}
return $this;
}
/**
* Use the CreditNote relation CreditNote object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCreditNote($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNote', '\CreditNote\Model\CreditNoteQuery');
}
/**
* Exclude object from result
*
* @param ChildCartCreditNote $cartCreditNote Object to remove from the list of results
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function prune($cartCreditNote = null)
{
if ($cartCreditNote) {
$this->addCond('pruneCond0', $this->getAliasedColName(CartCreditNoteTableMap::CART_ID), $cartCreditNote->getCartId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(CartCreditNoteTableMap::CREDIT_NOTE_ID), $cartCreditNote->getCreditNoteId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the cart_credit_note table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CartCreditNoteTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CartCreditNoteTableMap::clearInstancePool();
CartCreditNoteTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCartCreditNote or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCartCreditNote object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CartCreditNoteTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CartCreditNoteTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
CartCreditNoteTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CartCreditNoteTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(CartCreditNoteTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(CartCreditNoteTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(CartCreditNoteTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(CartCreditNoteTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(CartCreditNoteTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildCartCreditNoteQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(CartCreditNoteTableMap::CREATED_AT);
}
} // CartCreditNoteQuery

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,793 @@
<?php
namespace CreditNote\Model\Base;
use \Exception;
use \PDO;
use CreditNote\Model\CreditNoteComment as ChildCreditNoteComment;
use CreditNote\Model\CreditNoteCommentQuery as ChildCreditNoteCommentQuery;
use CreditNote\Model\Map\CreditNoteCommentTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Admin;
/**
* Base class that represents a query for the 'credit_note_comment' table.
*
*
*
* @method ChildCreditNoteCommentQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCreditNoteCommentQuery orderByCreditNoteId($order = Criteria::ASC) Order by the credit_note_id column
* @method ChildCreditNoteCommentQuery orderByAdminId($order = Criteria::ASC) Order by the admin_id column
* @method ChildCreditNoteCommentQuery orderByComment($order = Criteria::ASC) Order by the comment column
* @method ChildCreditNoteCommentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCreditNoteCommentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildCreditNoteCommentQuery groupById() Group by the id column
* @method ChildCreditNoteCommentQuery groupByCreditNoteId() Group by the credit_note_id column
* @method ChildCreditNoteCommentQuery groupByAdminId() Group by the admin_id column
* @method ChildCreditNoteCommentQuery groupByComment() Group by the comment column
* @method ChildCreditNoteCommentQuery groupByCreatedAt() Group by the created_at column
* @method ChildCreditNoteCommentQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildCreditNoteCommentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCreditNoteCommentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCreditNoteCommentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCreditNoteCommentQuery leftJoinCreditNote($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNote relation
* @method ChildCreditNoteCommentQuery rightJoinCreditNote($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNote relation
* @method ChildCreditNoteCommentQuery innerJoinCreditNote($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNote relation
*
* @method ChildCreditNoteCommentQuery leftJoinAdmin($relationAlias = null) Adds a LEFT JOIN clause to the query using the Admin relation
* @method ChildCreditNoteCommentQuery rightJoinAdmin($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Admin relation
* @method ChildCreditNoteCommentQuery innerJoinAdmin($relationAlias = null) Adds a INNER JOIN clause to the query using the Admin relation
*
* @method ChildCreditNoteComment findOne(ConnectionInterface $con = null) Return the first ChildCreditNoteComment matching the query
* @method ChildCreditNoteComment findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCreditNoteComment matching the query, or a new ChildCreditNoteComment object populated from the query conditions when no match is found
*
* @method ChildCreditNoteComment findOneById(int $id) Return the first ChildCreditNoteComment filtered by the id column
* @method ChildCreditNoteComment findOneByCreditNoteId(int $credit_note_id) Return the first ChildCreditNoteComment filtered by the credit_note_id column
* @method ChildCreditNoteComment findOneByAdminId(int $admin_id) Return the first ChildCreditNoteComment filtered by the admin_id column
* @method ChildCreditNoteComment findOneByComment(string $comment) Return the first ChildCreditNoteComment filtered by the comment column
* @method ChildCreditNoteComment findOneByCreatedAt(string $created_at) Return the first ChildCreditNoteComment filtered by the created_at column
* @method ChildCreditNoteComment findOneByUpdatedAt(string $updated_at) Return the first ChildCreditNoteComment filtered by the updated_at column
*
* @method array findById(int $id) Return ChildCreditNoteComment objects filtered by the id column
* @method array findByCreditNoteId(int $credit_note_id) Return ChildCreditNoteComment objects filtered by the credit_note_id column
* @method array findByAdminId(int $admin_id) Return ChildCreditNoteComment objects filtered by the admin_id column
* @method array findByComment(string $comment) Return ChildCreditNoteComment objects filtered by the comment column
* @method array findByCreatedAt(string $created_at) Return ChildCreditNoteComment objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCreditNoteComment objects filtered by the updated_at column
*
*/
abstract class CreditNoteCommentQuery extends ModelCriteria
{
/**
* Initializes internal state of \CreditNote\Model\Base\CreditNoteCommentQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\CreditNote\\Model\\CreditNoteComment', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCreditNoteCommentQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCreditNoteCommentQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \CreditNote\Model\CreditNoteCommentQuery) {
return $criteria;
}
$query = new \CreditNote\Model\CreditNoteCommentQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCreditNoteComment|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CreditNoteCommentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CreditNoteCommentTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteComment A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CREDIT_NOTE_ID, ADMIN_ID, COMMENT, CREATED_AT, UPDATED_AT FROM credit_note_comment WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCreditNoteComment();
$obj->hydrate($row);
CreditNoteCommentTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteComment|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CreditNoteCommentTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CreditNoteCommentTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteCommentTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the credit_note_id column
*
* Example usage:
* <code>
* $query->filterByCreditNoteId(1234); // WHERE credit_note_id = 1234
* $query->filterByCreditNoteId(array(12, 34)); // WHERE credit_note_id IN (12, 34)
* $query->filterByCreditNoteId(array('min' => 12)); // WHERE credit_note_id > 12
* </code>
*
* @see filterByCreditNote()
*
* @param mixed $creditNoteId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByCreditNoteId($creditNoteId = null, $comparison = null)
{
if (is_array($creditNoteId)) {
$useMinMax = false;
if (isset($creditNoteId['min'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::CREDIT_NOTE_ID, $creditNoteId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($creditNoteId['max'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::CREDIT_NOTE_ID, $creditNoteId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteCommentTableMap::CREDIT_NOTE_ID, $creditNoteId, $comparison);
}
/**
* Filter the query on the admin_id column
*
* Example usage:
* <code>
* $query->filterByAdminId(1234); // WHERE admin_id = 1234
* $query->filterByAdminId(array(12, 34)); // WHERE admin_id IN (12, 34)
* $query->filterByAdminId(array('min' => 12)); // WHERE admin_id > 12
* </code>
*
* @see filterByAdmin()
*
* @param mixed $adminId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByAdminId($adminId = null, $comparison = null)
{
if (is_array($adminId)) {
$useMinMax = false;
if (isset($adminId['min'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::ADMIN_ID, $adminId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($adminId['max'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::ADMIN_ID, $adminId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteCommentTableMap::ADMIN_ID, $adminId, $comparison);
}
/**
* Filter the query on the comment column
*
* Example usage:
* <code>
* $query->filterByComment('fooValue'); // WHERE comment = 'fooValue'
* $query->filterByComment('%fooValue%'); // WHERE comment LIKE '%fooValue%'
* </code>
*
* @param string $comment The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByComment($comment = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($comment)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $comment)) {
$comment = str_replace('*', '%', $comment);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteCommentTableMap::COMMENT, $comment, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteCommentTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CreditNoteCommentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteCommentTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \CreditNote\Model\CreditNote object
*
* @param \CreditNote\Model\CreditNote|ObjectCollection $creditNote The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByCreditNote($creditNote, $comparison = null)
{
if ($creditNote instanceof \CreditNote\Model\CreditNote) {
return $this
->addUsingAlias(CreditNoteCommentTableMap::CREDIT_NOTE_ID, $creditNote->getId(), $comparison);
} elseif ($creditNote instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CreditNoteCommentTableMap::CREDIT_NOTE_ID, $creditNote->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCreditNote() only accepts arguments of type \CreditNote\Model\CreditNote or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNote relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function joinCreditNote($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNote');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNote');
}
return $this;
}
/**
* Use the CreditNote relation CreditNote object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCreditNote($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNote', '\CreditNote\Model\CreditNoteQuery');
}
/**
* Filter the query by a related \Thelia\Model\Admin object
*
* @param \Thelia\Model\Admin|ObjectCollection $admin The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function filterByAdmin($admin, $comparison = null)
{
if ($admin instanceof \Thelia\Model\Admin) {
return $this
->addUsingAlias(CreditNoteCommentTableMap::ADMIN_ID, $admin->getId(), $comparison);
} elseif ($admin instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CreditNoteCommentTableMap::ADMIN_ID, $admin->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByAdmin() only accepts arguments of type \Thelia\Model\Admin or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Admin relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function joinAdmin($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Admin');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Admin');
}
return $this;
}
/**
* Use the Admin relation Admin object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\AdminQuery A secondary query class using the current class as primary query
*/
public function useAdminQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinAdmin($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Admin', '\Thelia\Model\AdminQuery');
}
/**
* Exclude object from result
*
* @param ChildCreditNoteComment $creditNoteComment Object to remove from the list of results
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function prune($creditNoteComment = null)
{
if ($creditNoteComment) {
$this->addUsingAlias(CreditNoteCommentTableMap::ID, $creditNoteComment->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the credit_note_comment table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteCommentTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CreditNoteCommentTableMap::clearInstancePool();
CreditNoteCommentTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCreditNoteComment or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCreditNoteComment object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteCommentTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CreditNoteCommentTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
CreditNoteCommentTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CreditNoteCommentTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(CreditNoteCommentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(CreditNoteCommentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(CreditNoteCommentTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(CreditNoteCommentTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(CreditNoteCommentTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildCreditNoteCommentQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(CreditNoteCommentTableMap::CREATED_AT);
}
} // CreditNoteCommentQuery

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,835 @@
<?php
namespace CreditNote\Model\Base;
use \Exception;
use \PDO;
use CreditNote\Model\CreditNoteStatusFlow as ChildCreditNoteStatusFlow;
use CreditNote\Model\CreditNoteStatusFlowQuery as ChildCreditNoteStatusFlowQuery;
use CreditNote\Model\Map\CreditNoteStatusFlowTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
/**
* Base class that represents a query for the 'credit_note_status_flow' table.
*
*
*
* @method ChildCreditNoteStatusFlowQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCreditNoteStatusFlowQuery orderByFromStatusId($order = Criteria::ASC) Order by the from_status_id column
* @method ChildCreditNoteStatusFlowQuery orderByToStatusId($order = Criteria::ASC) Order by the to_status_id column
* @method ChildCreditNoteStatusFlowQuery orderByPriority($order = Criteria::ASC) Order by the priority column
* @method ChildCreditNoteStatusFlowQuery orderByRoot($order = Criteria::ASC) Order by the root column
* @method ChildCreditNoteStatusFlowQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCreditNoteStatusFlowQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildCreditNoteStatusFlowQuery groupById() Group by the id column
* @method ChildCreditNoteStatusFlowQuery groupByFromStatusId() Group by the from_status_id column
* @method ChildCreditNoteStatusFlowQuery groupByToStatusId() Group by the to_status_id column
* @method ChildCreditNoteStatusFlowQuery groupByPriority() Group by the priority column
* @method ChildCreditNoteStatusFlowQuery groupByRoot() Group by the root column
* @method ChildCreditNoteStatusFlowQuery groupByCreatedAt() Group by the created_at column
* @method ChildCreditNoteStatusFlowQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildCreditNoteStatusFlowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCreditNoteStatusFlowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCreditNoteStatusFlowQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCreditNoteStatusFlowQuery leftJoinCreditNoteStatusRelatedByFromStatusId($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNoteStatusRelatedByFromStatusId relation
* @method ChildCreditNoteStatusFlowQuery rightJoinCreditNoteStatusRelatedByFromStatusId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNoteStatusRelatedByFromStatusId relation
* @method ChildCreditNoteStatusFlowQuery innerJoinCreditNoteStatusRelatedByFromStatusId($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNoteStatusRelatedByFromStatusId relation
*
* @method ChildCreditNoteStatusFlowQuery leftJoinCreditNoteStatusRelatedByToStatusId($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNoteStatusRelatedByToStatusId relation
* @method ChildCreditNoteStatusFlowQuery rightJoinCreditNoteStatusRelatedByToStatusId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNoteStatusRelatedByToStatusId relation
* @method ChildCreditNoteStatusFlowQuery innerJoinCreditNoteStatusRelatedByToStatusId($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNoteStatusRelatedByToStatusId relation
*
* @method ChildCreditNoteStatusFlow findOne(ConnectionInterface $con = null) Return the first ChildCreditNoteStatusFlow matching the query
* @method ChildCreditNoteStatusFlow findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCreditNoteStatusFlow matching the query, or a new ChildCreditNoteStatusFlow object populated from the query conditions when no match is found
*
* @method ChildCreditNoteStatusFlow findOneById(int $id) Return the first ChildCreditNoteStatusFlow filtered by the id column
* @method ChildCreditNoteStatusFlow findOneByFromStatusId(int $from_status_id) Return the first ChildCreditNoteStatusFlow filtered by the from_status_id column
* @method ChildCreditNoteStatusFlow findOneByToStatusId(int $to_status_id) Return the first ChildCreditNoteStatusFlow filtered by the to_status_id column
* @method ChildCreditNoteStatusFlow findOneByPriority(int $priority) Return the first ChildCreditNoteStatusFlow filtered by the priority column
* @method ChildCreditNoteStatusFlow findOneByRoot(boolean $root) Return the first ChildCreditNoteStatusFlow filtered by the root column
* @method ChildCreditNoteStatusFlow findOneByCreatedAt(string $created_at) Return the first ChildCreditNoteStatusFlow filtered by the created_at column
* @method ChildCreditNoteStatusFlow findOneByUpdatedAt(string $updated_at) Return the first ChildCreditNoteStatusFlow filtered by the updated_at column
*
* @method array findById(int $id) Return ChildCreditNoteStatusFlow objects filtered by the id column
* @method array findByFromStatusId(int $from_status_id) Return ChildCreditNoteStatusFlow objects filtered by the from_status_id column
* @method array findByToStatusId(int $to_status_id) Return ChildCreditNoteStatusFlow objects filtered by the to_status_id column
* @method array findByPriority(int $priority) Return ChildCreditNoteStatusFlow objects filtered by the priority column
* @method array findByRoot(boolean $root) Return ChildCreditNoteStatusFlow objects filtered by the root column
* @method array findByCreatedAt(string $created_at) Return ChildCreditNoteStatusFlow objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCreditNoteStatusFlow objects filtered by the updated_at column
*
*/
abstract class CreditNoteStatusFlowQuery extends ModelCriteria
{
/**
* Initializes internal state of \CreditNote\Model\Base\CreditNoteStatusFlowQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\CreditNote\\Model\\CreditNoteStatusFlow', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCreditNoteStatusFlowQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCreditNoteStatusFlowQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \CreditNote\Model\CreditNoteStatusFlowQuery) {
return $criteria;
}
$query = new \CreditNote\Model\CreditNoteStatusFlowQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCreditNoteStatusFlow|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CreditNoteStatusFlowTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CreditNoteStatusFlowTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteStatusFlow A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, FROM_STATUS_ID, TO_STATUS_ID, PRIORITY, ROOT, CREATED_AT, UPDATED_AT FROM credit_note_status_flow WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCreditNoteStatusFlow();
$obj->hydrate($row);
CreditNoteStatusFlowTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteStatusFlow|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the from_status_id column
*
* Example usage:
* <code>
* $query->filterByFromStatusId(1234); // WHERE from_status_id = 1234
* $query->filterByFromStatusId(array(12, 34)); // WHERE from_status_id IN (12, 34)
* $query->filterByFromStatusId(array('min' => 12)); // WHERE from_status_id > 12
* </code>
*
* @see filterByCreditNoteStatusRelatedByFromStatusId()
*
* @param mixed $fromStatusId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByFromStatusId($fromStatusId = null, $comparison = null)
{
if (is_array($fromStatusId)) {
$useMinMax = false;
if (isset($fromStatusId['min'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::FROM_STATUS_ID, $fromStatusId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($fromStatusId['max'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::FROM_STATUS_ID, $fromStatusId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::FROM_STATUS_ID, $fromStatusId, $comparison);
}
/**
* Filter the query on the to_status_id column
*
* Example usage:
* <code>
* $query->filterByToStatusId(1234); // WHERE to_status_id = 1234
* $query->filterByToStatusId(array(12, 34)); // WHERE to_status_id IN (12, 34)
* $query->filterByToStatusId(array('min' => 12)); // WHERE to_status_id > 12
* </code>
*
* @see filterByCreditNoteStatusRelatedByToStatusId()
*
* @param mixed $toStatusId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByToStatusId($toStatusId = null, $comparison = null)
{
if (is_array($toStatusId)) {
$useMinMax = false;
if (isset($toStatusId['min'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::TO_STATUS_ID, $toStatusId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($toStatusId['max'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::TO_STATUS_ID, $toStatusId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::TO_STATUS_ID, $toStatusId, $comparison);
}
/**
* Filter the query on the priority column
*
* Example usage:
* <code>
* $query->filterByPriority(1234); // WHERE priority = 1234
* $query->filterByPriority(array(12, 34)); // WHERE priority IN (12, 34)
* $query->filterByPriority(array('min' => 12)); // WHERE priority > 12
* </code>
*
* @param mixed $priority The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByPriority($priority = null, $comparison = null)
{
if (is_array($priority)) {
$useMinMax = false;
if (isset($priority['min'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::PRIORITY, $priority['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($priority['max'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::PRIORITY, $priority['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::PRIORITY, $priority, $comparison);
}
/**
* Filter the query on the root column
*
* Example usage:
* <code>
* $query->filterByRoot(true); // WHERE root = true
* $query->filterByRoot('yes'); // WHERE root = true
* </code>
*
* @param boolean|string $root The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByRoot($root = null, $comparison = null)
{
if (is_string($root)) {
$root = in_array(strtolower($root), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::ROOT, $root, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \CreditNote\Model\CreditNoteStatus object
*
* @param \CreditNote\Model\CreditNoteStatus|ObjectCollection $creditNoteStatus The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByCreditNoteStatusRelatedByFromStatusId($creditNoteStatus, $comparison = null)
{
if ($creditNoteStatus instanceof \CreditNote\Model\CreditNoteStatus) {
return $this
->addUsingAlias(CreditNoteStatusFlowTableMap::FROM_STATUS_ID, $creditNoteStatus->getId(), $comparison);
} elseif ($creditNoteStatus instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CreditNoteStatusFlowTableMap::FROM_STATUS_ID, $creditNoteStatus->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCreditNoteStatusRelatedByFromStatusId() only accepts arguments of type \CreditNote\Model\CreditNoteStatus or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNoteStatusRelatedByFromStatusId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function joinCreditNoteStatusRelatedByFromStatusId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNoteStatusRelatedByFromStatusId');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNoteStatusRelatedByFromStatusId');
}
return $this;
}
/**
* Use the CreditNoteStatusRelatedByFromStatusId relation CreditNoteStatus object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteStatusQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteStatusRelatedByFromStatusIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCreditNoteStatusRelatedByFromStatusId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNoteStatusRelatedByFromStatusId', '\CreditNote\Model\CreditNoteStatusQuery');
}
/**
* Filter the query by a related \CreditNote\Model\CreditNoteStatus object
*
* @param \CreditNote\Model\CreditNoteStatus|ObjectCollection $creditNoteStatus The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function filterByCreditNoteStatusRelatedByToStatusId($creditNoteStatus, $comparison = null)
{
if ($creditNoteStatus instanceof \CreditNote\Model\CreditNoteStatus) {
return $this
->addUsingAlias(CreditNoteStatusFlowTableMap::TO_STATUS_ID, $creditNoteStatus->getId(), $comparison);
} elseif ($creditNoteStatus instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CreditNoteStatusFlowTableMap::TO_STATUS_ID, $creditNoteStatus->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCreditNoteStatusRelatedByToStatusId() only accepts arguments of type \CreditNote\Model\CreditNoteStatus or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNoteStatusRelatedByToStatusId relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function joinCreditNoteStatusRelatedByToStatusId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNoteStatusRelatedByToStatusId');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNoteStatusRelatedByToStatusId');
}
return $this;
}
/**
* Use the CreditNoteStatusRelatedByToStatusId relation CreditNoteStatus object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteStatusQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteStatusRelatedByToStatusIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCreditNoteStatusRelatedByToStatusId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNoteStatusRelatedByToStatusId', '\CreditNote\Model\CreditNoteStatusQuery');
}
/**
* Exclude object from result
*
* @param ChildCreditNoteStatusFlow $creditNoteStatusFlow Object to remove from the list of results
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function prune($creditNoteStatusFlow = null)
{
if ($creditNoteStatusFlow) {
$this->addUsingAlias(CreditNoteStatusFlowTableMap::ID, $creditNoteStatusFlow->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the credit_note_status_flow table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteStatusFlowTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CreditNoteStatusFlowTableMap::clearInstancePool();
CreditNoteStatusFlowTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCreditNoteStatusFlow or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCreditNoteStatusFlow object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteStatusFlowTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CreditNoteStatusFlowTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
CreditNoteStatusFlowTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CreditNoteStatusFlowTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(CreditNoteStatusFlowTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(CreditNoteStatusFlowTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(CreditNoteStatusFlowTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(CreditNoteStatusFlowTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildCreditNoteStatusFlowQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(CreditNoteStatusFlowTableMap::CREATED_AT);
}
} // CreditNoteStatusFlowQuery

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,607 @@
<?php
namespace CreditNote\Model\Base;
use \Exception;
use \PDO;
use CreditNote\Model\CreditNoteStatusI18n as ChildCreditNoteStatusI18n;
use CreditNote\Model\CreditNoteStatusI18nQuery as ChildCreditNoteStatusI18nQuery;
use CreditNote\Model\Map\CreditNoteStatusI18nTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
/**
* Base class that represents a query for the 'credit_note_status_i18n' table.
*
*
*
* @method ChildCreditNoteStatusI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCreditNoteStatusI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildCreditNoteStatusI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildCreditNoteStatusI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildCreditNoteStatusI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildCreditNoteStatusI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
*
* @method ChildCreditNoteStatusI18nQuery groupById() Group by the id column
* @method ChildCreditNoteStatusI18nQuery groupByLocale() Group by the locale column
* @method ChildCreditNoteStatusI18nQuery groupByTitle() Group by the title column
* @method ChildCreditNoteStatusI18nQuery groupByDescription() Group by the description column
* @method ChildCreditNoteStatusI18nQuery groupByChapo() Group by the chapo column
* @method ChildCreditNoteStatusI18nQuery groupByPostscriptum() Group by the postscriptum column
*
* @method ChildCreditNoteStatusI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCreditNoteStatusI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCreditNoteStatusI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCreditNoteStatusI18nQuery leftJoinCreditNoteStatus($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNoteStatus relation
* @method ChildCreditNoteStatusI18nQuery rightJoinCreditNoteStatus($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNoteStatus relation
* @method ChildCreditNoteStatusI18nQuery innerJoinCreditNoteStatus($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNoteStatus relation
*
* @method ChildCreditNoteStatusI18n findOne(ConnectionInterface $con = null) Return the first ChildCreditNoteStatusI18n matching the query
* @method ChildCreditNoteStatusI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCreditNoteStatusI18n matching the query, or a new ChildCreditNoteStatusI18n object populated from the query conditions when no match is found
*
* @method ChildCreditNoteStatusI18n findOneById(int $id) Return the first ChildCreditNoteStatusI18n filtered by the id column
* @method ChildCreditNoteStatusI18n findOneByLocale(string $locale) Return the first ChildCreditNoteStatusI18n filtered by the locale column
* @method ChildCreditNoteStatusI18n findOneByTitle(string $title) Return the first ChildCreditNoteStatusI18n filtered by the title column
* @method ChildCreditNoteStatusI18n findOneByDescription(string $description) Return the first ChildCreditNoteStatusI18n filtered by the description column
* @method ChildCreditNoteStatusI18n findOneByChapo(string $chapo) Return the first ChildCreditNoteStatusI18n filtered by the chapo column
* @method ChildCreditNoteStatusI18n findOneByPostscriptum(string $postscriptum) Return the first ChildCreditNoteStatusI18n filtered by the postscriptum column
*
* @method array findById(int $id) Return ChildCreditNoteStatusI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildCreditNoteStatusI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildCreditNoteStatusI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildCreditNoteStatusI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildCreditNoteStatusI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildCreditNoteStatusI18n objects filtered by the postscriptum column
*
*/
abstract class CreditNoteStatusI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \CreditNote\Model\Base\CreditNoteStatusI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\CreditNote\\Model\\CreditNoteStatusI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCreditNoteStatusI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCreditNoteStatusI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \CreditNote\Model\CreditNoteStatusI18nQuery) {
return $criteria;
}
$query = new \CreditNote\Model\CreditNoteStatusI18nQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$id, $locale] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCreditNoteStatusI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CreditNoteStatusI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CreditNoteStatusI18nTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteStatusI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM credit_note_status_i18n WHERE ID = :p0 AND LOCALE = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCreditNoteStatusI18n();
$obj->hydrate($row);
CreditNoteStatusI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteStatusI18n|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(CreditNoteStatusI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(CreditNoteStatusI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(CreditNoteStatusI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(CreditNoteStatusI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @see filterByCreditNoteStatus()
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(CreditNoteStatusI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CreditNoteStatusI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteStatusI18nTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the locale column
*
* Example usage:
* <code>
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
* </code>
*
* @param string $locale The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterByLocale($locale = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($locale)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $locale)) {
$locale = str_replace('*', '%', $locale);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteStatusI18nTableMap::LOCALE, $locale, $comparison);
}
/**
* Filter the query on the title column
*
* Example usage:
* <code>
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code>
*
* @param string $title The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterByTitle($title = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($title)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $title)) {
$title = str_replace('*', '%', $title);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteStatusI18nTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteStatusI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteStatusI18nTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteStatusI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query by a related \CreditNote\Model\CreditNoteStatus object
*
* @param \CreditNote\Model\CreditNoteStatus|ObjectCollection $creditNoteStatus The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function filterByCreditNoteStatus($creditNoteStatus, $comparison = null)
{
if ($creditNoteStatus instanceof \CreditNote\Model\CreditNoteStatus) {
return $this
->addUsingAlias(CreditNoteStatusI18nTableMap::ID, $creditNoteStatus->getId(), $comparison);
} elseif ($creditNoteStatus instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CreditNoteStatusI18nTableMap::ID, $creditNoteStatus->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCreditNoteStatus() only accepts arguments of type \CreditNote\Model\CreditNoteStatus or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNoteStatus relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function joinCreditNoteStatus($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNoteStatus');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNoteStatus');
}
return $this;
}
/**
* Use the CreditNoteStatus relation CreditNoteStatus object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteStatusQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteStatusQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinCreditNoteStatus($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNoteStatus', '\CreditNote\Model\CreditNoteStatusQuery');
}
/**
* Exclude object from result
*
* @param ChildCreditNoteStatusI18n $creditNoteStatusI18n Object to remove from the list of results
*
* @return ChildCreditNoteStatusI18nQuery The current query, for fluid interface
*/
public function prune($creditNoteStatusI18n = null)
{
if ($creditNoteStatusI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(CreditNoteStatusI18nTableMap::ID), $creditNoteStatusI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(CreditNoteStatusI18nTableMap::LOCALE), $creditNoteStatusI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the credit_note_status_i18n table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteStatusI18nTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CreditNoteStatusI18nTableMap::clearInstancePool();
CreditNoteStatusI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCreditNoteStatusI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCreditNoteStatusI18n object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteStatusI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CreditNoteStatusI18nTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
CreditNoteStatusI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CreditNoteStatusI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // CreditNoteStatusI18nQuery

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,607 @@
<?php
namespace CreditNote\Model\Base;
use \Exception;
use \PDO;
use CreditNote\Model\CreditNoteTypeI18n as ChildCreditNoteTypeI18n;
use CreditNote\Model\CreditNoteTypeI18nQuery as ChildCreditNoteTypeI18nQuery;
use CreditNote\Model\Map\CreditNoteTypeI18nTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
/**
* Base class that represents a query for the 'credit_note_type_i18n' table.
*
*
*
* @method ChildCreditNoteTypeI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCreditNoteTypeI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildCreditNoteTypeI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildCreditNoteTypeI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildCreditNoteTypeI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildCreditNoteTypeI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
*
* @method ChildCreditNoteTypeI18nQuery groupById() Group by the id column
* @method ChildCreditNoteTypeI18nQuery groupByLocale() Group by the locale column
* @method ChildCreditNoteTypeI18nQuery groupByTitle() Group by the title column
* @method ChildCreditNoteTypeI18nQuery groupByDescription() Group by the description column
* @method ChildCreditNoteTypeI18nQuery groupByChapo() Group by the chapo column
* @method ChildCreditNoteTypeI18nQuery groupByPostscriptum() Group by the postscriptum column
*
* @method ChildCreditNoteTypeI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCreditNoteTypeI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCreditNoteTypeI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCreditNoteTypeI18nQuery leftJoinCreditNoteType($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNoteType relation
* @method ChildCreditNoteTypeI18nQuery rightJoinCreditNoteType($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNoteType relation
* @method ChildCreditNoteTypeI18nQuery innerJoinCreditNoteType($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNoteType relation
*
* @method ChildCreditNoteTypeI18n findOne(ConnectionInterface $con = null) Return the first ChildCreditNoteTypeI18n matching the query
* @method ChildCreditNoteTypeI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCreditNoteTypeI18n matching the query, or a new ChildCreditNoteTypeI18n object populated from the query conditions when no match is found
*
* @method ChildCreditNoteTypeI18n findOneById(int $id) Return the first ChildCreditNoteTypeI18n filtered by the id column
* @method ChildCreditNoteTypeI18n findOneByLocale(string $locale) Return the first ChildCreditNoteTypeI18n filtered by the locale column
* @method ChildCreditNoteTypeI18n findOneByTitle(string $title) Return the first ChildCreditNoteTypeI18n filtered by the title column
* @method ChildCreditNoteTypeI18n findOneByDescription(string $description) Return the first ChildCreditNoteTypeI18n filtered by the description column
* @method ChildCreditNoteTypeI18n findOneByChapo(string $chapo) Return the first ChildCreditNoteTypeI18n filtered by the chapo column
* @method ChildCreditNoteTypeI18n findOneByPostscriptum(string $postscriptum) Return the first ChildCreditNoteTypeI18n filtered by the postscriptum column
*
* @method array findById(int $id) Return ChildCreditNoteTypeI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildCreditNoteTypeI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildCreditNoteTypeI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildCreditNoteTypeI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildCreditNoteTypeI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildCreditNoteTypeI18n objects filtered by the postscriptum column
*
*/
abstract class CreditNoteTypeI18nQuery extends ModelCriteria
{
/**
* Initializes internal state of \CreditNote\Model\Base\CreditNoteTypeI18nQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\CreditNote\\Model\\CreditNoteTypeI18n', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCreditNoteTypeI18nQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCreditNoteTypeI18nQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \CreditNote\Model\CreditNoteTypeI18nQuery) {
return $criteria;
}
$query = new \CreditNote\Model\CreditNoteTypeI18nQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$id, $locale] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCreditNoteTypeI18n|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CreditNoteTypeI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CreditNoteTypeI18nTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteTypeI18n A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM credit_note_type_i18n WHERE ID = :p0 AND LOCALE = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCreditNoteTypeI18n();
$obj->hydrate($row);
CreditNoteTypeI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteTypeI18n|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(CreditNoteTypeI18nTableMap::ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(CreditNoteTypeI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(CreditNoteTypeI18nTableMap::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(CreditNoteTypeI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @see filterByCreditNoteType()
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(CreditNoteTypeI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CreditNoteTypeI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteTypeI18nTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the locale column
*
* Example usage:
* <code>
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
* </code>
*
* @param string $locale The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterByLocale($locale = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($locale)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $locale)) {
$locale = str_replace('*', '%', $locale);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteTypeI18nTableMap::LOCALE, $locale, $comparison);
}
/**
* Filter the query on the title column
*
* Example usage:
* <code>
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code>
*
* @param string $title The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterByTitle($title = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($title)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $title)) {
$title = str_replace('*', '%', $title);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteTypeI18nTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteTypeI18nTableMap::DESCRIPTION, $description, $comparison);
}
/**
* Filter the query on the chapo column
*
* Example usage:
* <code>
* $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
* $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
* </code>
*
* @param string $chapo The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterByChapo($chapo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($chapo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $chapo)) {
$chapo = str_replace('*', '%', $chapo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteTypeI18nTableMap::CHAPO, $chapo, $comparison);
}
/**
* Filter the query on the postscriptum column
*
* Example usage:
* <code>
* $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
* $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
* </code>
*
* @param string $postscriptum The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterByPostscriptum($postscriptum = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($postscriptum)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $postscriptum)) {
$postscriptum = str_replace('*', '%', $postscriptum);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteTypeI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query by a related \CreditNote\Model\CreditNoteType object
*
* @param \CreditNote\Model\CreditNoteType|ObjectCollection $creditNoteType The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function filterByCreditNoteType($creditNoteType, $comparison = null)
{
if ($creditNoteType instanceof \CreditNote\Model\CreditNoteType) {
return $this
->addUsingAlias(CreditNoteTypeI18nTableMap::ID, $creditNoteType->getId(), $comparison);
} elseif ($creditNoteType instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CreditNoteTypeI18nTableMap::ID, $creditNoteType->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCreditNoteType() only accepts arguments of type \CreditNote\Model\CreditNoteType or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNoteType relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function joinCreditNoteType($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNoteType');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNoteType');
}
return $this;
}
/**
* Use the CreditNoteType relation CreditNoteType object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteTypeQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteTypeQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinCreditNoteType($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNoteType', '\CreditNote\Model\CreditNoteTypeQuery');
}
/**
* Exclude object from result
*
* @param ChildCreditNoteTypeI18n $creditNoteTypeI18n Object to remove from the list of results
*
* @return ChildCreditNoteTypeI18nQuery The current query, for fluid interface
*/
public function prune($creditNoteTypeI18n = null)
{
if ($creditNoteTypeI18n) {
$this->addCond('pruneCond0', $this->getAliasedColName(CreditNoteTypeI18nTableMap::ID), $creditNoteTypeI18n->getId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(CreditNoteTypeI18nTableMap::LOCALE), $creditNoteTypeI18n->getLocale(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the credit_note_type_i18n table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteTypeI18nTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CreditNoteTypeI18nTableMap::clearInstancePool();
CreditNoteTypeI18nTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCreditNoteTypeI18n or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCreditNoteTypeI18n object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteTypeI18nTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CreditNoteTypeI18nTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
CreditNoteTypeI18nTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CreditNoteTypeI18nTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
} // CreditNoteTypeI18nQuery

View File

@@ -0,0 +1,861 @@
<?php
namespace CreditNote\Model\Base;
use \Exception;
use \PDO;
use CreditNote\Model\CreditNoteType as ChildCreditNoteType;
use CreditNote\Model\CreditNoteTypeI18nQuery as ChildCreditNoteTypeI18nQuery;
use CreditNote\Model\CreditNoteTypeQuery as ChildCreditNoteTypeQuery;
use CreditNote\Model\Map\CreditNoteTypeTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
/**
* Base class that represents a query for the 'credit_note_type' table.
*
*
*
* @method ChildCreditNoteTypeQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCreditNoteTypeQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method ChildCreditNoteTypeQuery orderByColor($order = Criteria::ASC) Order by the color column
* @method ChildCreditNoteTypeQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildCreditNoteTypeQuery orderByRequiredOrder($order = Criteria::ASC) Order by the required_order column
* @method ChildCreditNoteTypeQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCreditNoteTypeQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildCreditNoteTypeQuery groupById() Group by the id column
* @method ChildCreditNoteTypeQuery groupByCode() Group by the code column
* @method ChildCreditNoteTypeQuery groupByColor() Group by the color column
* @method ChildCreditNoteTypeQuery groupByPosition() Group by the position column
* @method ChildCreditNoteTypeQuery groupByRequiredOrder() Group by the required_order column
* @method ChildCreditNoteTypeQuery groupByCreatedAt() Group by the created_at column
* @method ChildCreditNoteTypeQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildCreditNoteTypeQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCreditNoteTypeQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCreditNoteTypeQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCreditNoteTypeQuery leftJoinCreditNote($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNote relation
* @method ChildCreditNoteTypeQuery rightJoinCreditNote($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNote relation
* @method ChildCreditNoteTypeQuery innerJoinCreditNote($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNote relation
*
* @method ChildCreditNoteTypeQuery leftJoinCreditNoteTypeI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNoteTypeI18n relation
* @method ChildCreditNoteTypeQuery rightJoinCreditNoteTypeI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNoteTypeI18n relation
* @method ChildCreditNoteTypeQuery innerJoinCreditNoteTypeI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNoteTypeI18n relation
*
* @method ChildCreditNoteType findOne(ConnectionInterface $con = null) Return the first ChildCreditNoteType matching the query
* @method ChildCreditNoteType findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCreditNoteType matching the query, or a new ChildCreditNoteType object populated from the query conditions when no match is found
*
* @method ChildCreditNoteType findOneById(int $id) Return the first ChildCreditNoteType filtered by the id column
* @method ChildCreditNoteType findOneByCode(string $code) Return the first ChildCreditNoteType filtered by the code column
* @method ChildCreditNoteType findOneByColor(string $color) Return the first ChildCreditNoteType filtered by the color column
* @method ChildCreditNoteType findOneByPosition(int $position) Return the first ChildCreditNoteType filtered by the position column
* @method ChildCreditNoteType findOneByRequiredOrder(boolean $required_order) Return the first ChildCreditNoteType filtered by the required_order column
* @method ChildCreditNoteType findOneByCreatedAt(string $created_at) Return the first ChildCreditNoteType filtered by the created_at column
* @method ChildCreditNoteType findOneByUpdatedAt(string $updated_at) Return the first ChildCreditNoteType filtered by the updated_at column
*
* @method array findById(int $id) Return ChildCreditNoteType objects filtered by the id column
* @method array findByCode(string $code) Return ChildCreditNoteType objects filtered by the code column
* @method array findByColor(string $color) Return ChildCreditNoteType objects filtered by the color column
* @method array findByPosition(int $position) Return ChildCreditNoteType objects filtered by the position column
* @method array findByRequiredOrder(boolean $required_order) Return ChildCreditNoteType objects filtered by the required_order column
* @method array findByCreatedAt(string $created_at) Return ChildCreditNoteType objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCreditNoteType objects filtered by the updated_at column
*
*/
abstract class CreditNoteTypeQuery extends ModelCriteria
{
/**
* Initializes internal state of \CreditNote\Model\Base\CreditNoteTypeQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\CreditNote\\Model\\CreditNoteType', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCreditNoteTypeQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCreditNoteTypeQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \CreditNote\Model\CreditNoteTypeQuery) {
return $criteria;
}
$query = new \CreditNote\Model\CreditNoteTypeQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCreditNoteType|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CreditNoteTypeTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CreditNoteTypeTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteType A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CODE, COLOR, POSITION, REQUIRED_ORDER, CREATED_AT, UPDATED_AT FROM credit_note_type WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCreditNoteType();
$obj->hydrate($row);
CreditNoteTypeTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCreditNoteType|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CreditNoteTypeTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CreditNoteTypeTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(CreditNoteTypeTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CreditNoteTypeTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteTypeTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the code column
*
* Example usage:
* <code>
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
* </code>
*
* @param string $code The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByCode($code = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($code)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $code)) {
$code = str_replace('*', '%', $code);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteTypeTableMap::CODE, $code, $comparison);
}
/**
* Filter the query on the color column
*
* Example usage:
* <code>
* $query->filterByColor('fooValue'); // WHERE color = 'fooValue'
* $query->filterByColor('%fooValue%'); // WHERE color LIKE '%fooValue%'
* </code>
*
* @param string $color The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByColor($color = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($color)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $color)) {
$color = str_replace('*', '%', $color);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CreditNoteTypeTableMap::COLOR, $color, $comparison);
}
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByPosition($position = null, $comparison = null)
{
if (is_array($position)) {
$useMinMax = false;
if (isset($position['min'])) {
$this->addUsingAlias(CreditNoteTypeTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(CreditNoteTypeTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteTypeTableMap::POSITION, $position, $comparison);
}
/**
* Filter the query on the required_order column
*
* Example usage:
* <code>
* $query->filterByRequiredOrder(true); // WHERE required_order = true
* $query->filterByRequiredOrder('yes'); // WHERE required_order = true
* </code>
*
* @param boolean|string $requiredOrder The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByRequiredOrder($requiredOrder = null, $comparison = null)
{
if (is_string($requiredOrder)) {
$required_order = in_array(strtolower($requiredOrder), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CreditNoteTypeTableMap::REQUIRED_ORDER, $requiredOrder, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(CreditNoteTypeTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CreditNoteTypeTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteTypeTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(CreditNoteTypeTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CreditNoteTypeTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CreditNoteTypeTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \CreditNote\Model\CreditNote object
*
* @param \CreditNote\Model\CreditNote|ObjectCollection $creditNote the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByCreditNote($creditNote, $comparison = null)
{
if ($creditNote instanceof \CreditNote\Model\CreditNote) {
return $this
->addUsingAlias(CreditNoteTypeTableMap::ID, $creditNote->getTypeId(), $comparison);
} elseif ($creditNote instanceof ObjectCollection) {
return $this
->useCreditNoteQuery()
->filterByPrimaryKeys($creditNote->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCreditNote() only accepts arguments of type \CreditNote\Model\CreditNote or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNote relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function joinCreditNote($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNote');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNote');
}
return $this;
}
/**
* Use the CreditNote relation CreditNote object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCreditNote($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNote', '\CreditNote\Model\CreditNoteQuery');
}
/**
* Filter the query by a related \CreditNote\Model\CreditNoteTypeI18n object
*
* @param \CreditNote\Model\CreditNoteTypeI18n|ObjectCollection $creditNoteTypeI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function filterByCreditNoteTypeI18n($creditNoteTypeI18n, $comparison = null)
{
if ($creditNoteTypeI18n instanceof \CreditNote\Model\CreditNoteTypeI18n) {
return $this
->addUsingAlias(CreditNoteTypeTableMap::ID, $creditNoteTypeI18n->getId(), $comparison);
} elseif ($creditNoteTypeI18n instanceof ObjectCollection) {
return $this
->useCreditNoteTypeI18nQuery()
->filterByPrimaryKeys($creditNoteTypeI18n->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCreditNoteTypeI18n() only accepts arguments of type \CreditNote\Model\CreditNoteTypeI18n or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNoteTypeI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function joinCreditNoteTypeI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNoteTypeI18n');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNoteTypeI18n');
}
return $this;
}
/**
* Use the CreditNoteTypeI18n relation CreditNoteTypeI18n object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteTypeI18nQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteTypeI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinCreditNoteTypeI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNoteTypeI18n', '\CreditNote\Model\CreditNoteTypeI18nQuery');
}
/**
* Exclude object from result
*
* @param ChildCreditNoteType $creditNoteType Object to remove from the list of results
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function prune($creditNoteType = null)
{
if ($creditNoteType) {
$this->addUsingAlias(CreditNoteTypeTableMap::ID, $creditNoteType->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the credit_note_type table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteTypeTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CreditNoteTypeTableMap::clearInstancePool();
CreditNoteTypeTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCreditNoteType or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCreditNoteType object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CreditNoteTypeTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CreditNoteTypeTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
CreditNoteTypeTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CreditNoteTypeTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// i18n behavior
/**
* Adds a JOIN clause to the query using the i18n relation
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$relationName = $relationAlias ? $relationAlias : 'CreditNoteTypeI18n';
return $this
->joinCreditNoteTypeI18n($relationAlias, $joinType)
->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
}
/**
* Adds a JOIN clause to the query and hydrates the related I18n object.
* Shortcut for $c->joinI18n($locale)->with()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
{
$this
->joinI18n($locale, null, $joinType)
->with('CreditNoteTypeI18n');
$this->with['CreditNoteTypeI18n']->setIsWithOneToMany(false);
return $this;
}
/**
* Use the I18n relation query object
*
* @see useQuery()
*
* @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return ChildCreditNoteTypeI18nQuery A secondary query class using the current class as primary query
*/
public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinI18n($locale, $relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNoteTypeI18n', '\CreditNote\Model\CreditNoteTypeI18nQuery');
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(CreditNoteTypeTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(CreditNoteTypeTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(CreditNoteTypeTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(CreditNoteTypeTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(CreditNoteTypeTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildCreditNoteTypeQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(CreditNoteTypeTableMap::CREATED_AT);
}
} // CreditNoteTypeQuery

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,774 @@
<?php
namespace CreditNote\Model\Base;
use \Exception;
use \PDO;
use CreditNote\Model\OrderCreditNote as ChildOrderCreditNote;
use CreditNote\Model\OrderCreditNoteQuery as ChildOrderCreditNoteQuery;
use CreditNote\Model\Map\OrderCreditNoteTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Order;
/**
* Base class that represents a query for the 'order_credit_note' table.
*
*
*
* @method ChildOrderCreditNoteQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
* @method ChildOrderCreditNoteQuery orderByCreditNoteId($order = Criteria::ASC) Order by the credit_note_id column
* @method ChildOrderCreditNoteQuery orderByAmountPrice($order = Criteria::ASC) Order by the amount_price column
* @method ChildOrderCreditNoteQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildOrderCreditNoteQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildOrderCreditNoteQuery groupByOrderId() Group by the order_id column
* @method ChildOrderCreditNoteQuery groupByCreditNoteId() Group by the credit_note_id column
* @method ChildOrderCreditNoteQuery groupByAmountPrice() Group by the amount_price column
* @method ChildOrderCreditNoteQuery groupByCreatedAt() Group by the created_at column
* @method ChildOrderCreditNoteQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildOrderCreditNoteQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildOrderCreditNoteQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildOrderCreditNoteQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildOrderCreditNoteQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
* @method ChildOrderCreditNoteQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method ChildOrderCreditNoteQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
*
* @method ChildOrderCreditNoteQuery leftJoinCreditNote($relationAlias = null) Adds a LEFT JOIN clause to the query using the CreditNote relation
* @method ChildOrderCreditNoteQuery rightJoinCreditNote($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CreditNote relation
* @method ChildOrderCreditNoteQuery innerJoinCreditNote($relationAlias = null) Adds a INNER JOIN clause to the query using the CreditNote relation
*
* @method ChildOrderCreditNote findOne(ConnectionInterface $con = null) Return the first ChildOrderCreditNote matching the query
* @method ChildOrderCreditNote findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderCreditNote matching the query, or a new ChildOrderCreditNote object populated from the query conditions when no match is found
*
* @method ChildOrderCreditNote findOneByOrderId(int $order_id) Return the first ChildOrderCreditNote filtered by the order_id column
* @method ChildOrderCreditNote findOneByCreditNoteId(int $credit_note_id) Return the first ChildOrderCreditNote filtered by the credit_note_id column
* @method ChildOrderCreditNote findOneByAmountPrice(string $amount_price) Return the first ChildOrderCreditNote filtered by the amount_price column
* @method ChildOrderCreditNote findOneByCreatedAt(string $created_at) Return the first ChildOrderCreditNote filtered by the created_at column
* @method ChildOrderCreditNote findOneByUpdatedAt(string $updated_at) Return the first ChildOrderCreditNote filtered by the updated_at column
*
* @method array findByOrderId(int $order_id) Return ChildOrderCreditNote objects filtered by the order_id column
* @method array findByCreditNoteId(int $credit_note_id) Return ChildOrderCreditNote objects filtered by the credit_note_id column
* @method array findByAmountPrice(string $amount_price) Return ChildOrderCreditNote objects filtered by the amount_price column
* @method array findByCreatedAt(string $created_at) Return ChildOrderCreditNote objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderCreditNote objects filtered by the updated_at column
*
*/
abstract class OrderCreditNoteQuery extends ModelCriteria
{
/**
* Initializes internal state of \CreditNote\Model\Base\OrderCreditNoteQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\CreditNote\\Model\\OrderCreditNote', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildOrderCreditNoteQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildOrderCreditNoteQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \CreditNote\Model\OrderCreditNoteQuery) {
return $criteria;
}
$query = new \CreditNote\Model\OrderCreditNoteQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(array(12, 34), $con);
* </code>
*
* @param array[$order_id, $credit_note_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildOrderCreditNote|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = OrderCreditNoteTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(OrderCreditNoteTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildOrderCreditNote A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ORDER_ID, CREDIT_NOTE_ID, AMOUNT_PRICE, CREATED_AT, UPDATED_AT FROM order_credit_note WHERE ORDER_ID = :p0 AND CREDIT_NOTE_ID = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildOrderCreditNote();
$obj->hydrate($row);
OrderCreditNoteTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildOrderCreditNote|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
$this->addUsingAlias(OrderCreditNoteTableMap::ORDER_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(OrderCreditNoteTableMap::CREDIT_NOTE_ID, $key[1], Criteria::EQUAL);
return $this;
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
if (empty($keys)) {
return $this->add(null, '1<>1', Criteria::CUSTOM);
}
foreach ($keys as $key) {
$cton0 = $this->getNewCriterion(OrderCreditNoteTableMap::ORDER_ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(OrderCreditNoteTableMap::CREDIT_NOTE_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$this->addOr($cton0);
}
return $this;
}
/**
* Filter the query on the order_id column
*
* Example usage:
* <code>
* $query->filterByOrderId(1234); // WHERE order_id = 1234
* $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
* $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12
* </code>
*
* @see filterByOrder()
*
* @param mixed $orderId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByOrderId($orderId = null, $comparison = null)
{
if (is_array($orderId)) {
$useMinMax = false;
if (isset($orderId['min'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($orderId['max'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderCreditNoteTableMap::ORDER_ID, $orderId, $comparison);
}
/**
* Filter the query on the credit_note_id column
*
* Example usage:
* <code>
* $query->filterByCreditNoteId(1234); // WHERE credit_note_id = 1234
* $query->filterByCreditNoteId(array(12, 34)); // WHERE credit_note_id IN (12, 34)
* $query->filterByCreditNoteId(array('min' => 12)); // WHERE credit_note_id > 12
* </code>
*
* @see filterByCreditNote()
*
* @param mixed $creditNoteId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByCreditNoteId($creditNoteId = null, $comparison = null)
{
if (is_array($creditNoteId)) {
$useMinMax = false;
if (isset($creditNoteId['min'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::CREDIT_NOTE_ID, $creditNoteId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($creditNoteId['max'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::CREDIT_NOTE_ID, $creditNoteId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderCreditNoteTableMap::CREDIT_NOTE_ID, $creditNoteId, $comparison);
}
/**
* Filter the query on the amount_price column
*
* Example usage:
* <code>
* $query->filterByAmountPrice(1234); // WHERE amount_price = 1234
* $query->filterByAmountPrice(array(12, 34)); // WHERE amount_price IN (12, 34)
* $query->filterByAmountPrice(array('min' => 12)); // WHERE amount_price > 12
* </code>
*
* @param mixed $amountPrice The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByAmountPrice($amountPrice = null, $comparison = null)
{
if (is_array($amountPrice)) {
$useMinMax = false;
if (isset($amountPrice['min'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::AMOUNT_PRICE, $amountPrice['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($amountPrice['max'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::AMOUNT_PRICE, $amountPrice['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderCreditNoteTableMap::AMOUNT_PRICE, $amountPrice, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderCreditNoteTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(OrderCreditNoteTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderCreditNoteTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Order object
*
* @param \Thelia\Model\Order|ObjectCollection $order The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByOrder($order, $comparison = null)
{
if ($order instanceof \Thelia\Model\Order) {
return $this
->addUsingAlias(OrderCreditNoteTableMap::ORDER_ID, $order->getId(), $comparison);
} elseif ($order instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderCreditNoteTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByOrder() only accepts arguments of type \Thelia\Model\Order or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Order relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Order');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Order');
}
return $this;
}
/**
* Use the Order relation Order object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/
public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
}
/**
* Filter the query by a related \CreditNote\Model\CreditNote object
*
* @param \CreditNote\Model\CreditNote|ObjectCollection $creditNote The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function filterByCreditNote($creditNote, $comparison = null)
{
if ($creditNote instanceof \CreditNote\Model\CreditNote) {
return $this
->addUsingAlias(OrderCreditNoteTableMap::CREDIT_NOTE_ID, $creditNote->getId(), $comparison);
} elseif ($creditNote instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(OrderCreditNoteTableMap::CREDIT_NOTE_ID, $creditNote->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCreditNote() only accepts arguments of type \CreditNote\Model\CreditNote or Collection');
}
}
/**
* Adds a JOIN clause to the query using the CreditNote relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function joinCreditNote($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CreditNote');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CreditNote');
}
return $this;
}
/**
* Use the CreditNote relation CreditNote object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \CreditNote\Model\CreditNoteQuery A secondary query class using the current class as primary query
*/
public function useCreditNoteQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCreditNote($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CreditNote', '\CreditNote\Model\CreditNoteQuery');
}
/**
* Exclude object from result
*
* @param ChildOrderCreditNote $orderCreditNote Object to remove from the list of results
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function prune($orderCreditNote = null)
{
if ($orderCreditNote) {
$this->addCond('pruneCond0', $this->getAliasedColName(OrderCreditNoteTableMap::ORDER_ID), $orderCreditNote->getOrderId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(OrderCreditNoteTableMap::CREDIT_NOTE_ID), $orderCreditNote->getCreditNoteId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
}
return $this;
}
/**
* Deletes all rows from the order_credit_note table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderCreditNoteTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
OrderCreditNoteTableMap::clearInstancePool();
OrderCreditNoteTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildOrderCreditNote or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildOrderCreditNote object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderCreditNoteTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(OrderCreditNoteTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
OrderCreditNoteTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
OrderCreditNoteTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(OrderCreditNoteTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(OrderCreditNoteTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(OrderCreditNoteTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(OrderCreditNoteTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(OrderCreditNoteTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildOrderCreditNoteQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(OrderCreditNoteTableMap::CREATED_AT);
}
} // OrderCreditNoteQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace CreditNote\Model;
use CreditNote\Model\Base\CartCreditNote as BaseCartCreditNote;
class CartCreditNote extends BaseCartCreditNote
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace CreditNote\Model;
use CreditNote\Model\Base\CartCreditNoteQuery as BaseCartCreditNoteQuery;
/**
* Skeleton subclass for performing query and update operations on the 'cart_credit_note' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class CartCreditNoteQuery extends BaseCartCreditNoteQuery
{
} // CartCreditNoteQuery

View File

@@ -0,0 +1,129 @@
<?php
/*************************************************************************************/
/* This file is part of the module CreditNote */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace CreditNote\Model;
use CreditNote\Model\Base\CreditNote as BaseCreditNote;
use CreditNote\Model\CreditNoteStatus as ChildCreditNoteStatus;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Currency;
use Thelia\Model\Customer;
use Thelia\Model\Order;
class CreditNote extends BaseCreditNote
{
use \CreditNote\Model\Tools\ModelEventDispatcherTrait;
/**
* Declares an association between this object and a ChildOrder object.
*
* @param Order $v
* @return \CreditNote\Model\CreditNote The current object (for fluent API support)
* @throws PropelException
*/
public function setOrder(Order $v = null)
{
if ($v === null) {
$this->setOrderId(null);
} else {
$this->setOrderId($v->getId());
}
$this->aOrder = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildCustomer object, it will not be re-added.
if (method_exists($v, 'addCreditNote') && $v !== null) {
$v->addCreditNote($this);
}
return $this;
}
/**
* Declares an association between this object and a ChildCurrency object.
*
* @param Currency $v
* @return \CreditNote\Model\CreditNote The current object (for fluent API support)
* @throws PropelException
*/
public function setCurrency(Currency $v = null)
{
if ($v === null) {
$this->setCurrencyId(null);
} else {
$this->setCurrencyId($v->getId());
}
$this->aCurrency = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildCustomer object, it will not be re-added.
if (method_exists($v, 'addCreditNote') && $v !== null) {
$v->addCreditNote($this);
}
return $this;
}
/**
* Declares an association between this object and a ChildCustomer object.
*
* @param Customer $v
* @return \CreditNote\Model\CreditNote The current object (for fluent API support)
* @throws PropelException
*/
public function setCustomer(Customer $v = null)
{
if ($v === null) {
$this->setCustomerId(null);
} else {
$this->setCustomerId($v->getId());
}
$this->aCustomer = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildCustomer object, it will not be re-added.
if (method_exists($v, 'addCreditNote') && $v !== null) {
$v->addCreditNote($this);
}
return $this;
}
public function setStatusId($v)
{
// check status flow
if (null !== $this->getStatusId() && (int) $v !== (int) $this->getStatusId()) {
if (!CreditNoteStatusFlowQuery::create()
->filterByFromStatusId($this->getStatusId())
->filterByToStatusId($v)
->findOne()) {
throw new \Exception('You do not respect the status flow');
}
}
return parent::setStatusId($v);
}
public function setCreditNoteStatus(ChildCreditNoteStatus $v = null)
{
// check status flow
if (null !== $v && null !== $this->getCreditNoteStatus() && (int) $v->getId() !== (int) $this->getCreditNoteStatus()->getId()) {
if (!CreditNoteStatusFlowQuery::create()
->filterByFromStatusId($this->getCreditNoteStatus()->getId())
->filterByToStatusId($v->getId())
->findOne()) {
throw new \Exception('You do not respect the status flow');
}
}
return parent::setCreditNoteStatus($v);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace CreditNote\Model;
use CreditNote\Model\Base\CreditNoteAddress as BaseCreditNoteAddress;
class CreditNoteAddress extends BaseCreditNoteAddress
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace CreditNote\Model;
use CreditNote\Model\Base\CreditNoteAddressQuery as BaseCreditNoteAddressQuery;
/**
* Skeleton subclass for performing query and update operations on the 'credit_note_address' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class CreditNoteAddressQuery extends BaseCreditNoteAddressQuery
{
} // CreditNoteAddressQuery

View File

@@ -0,0 +1,10 @@
<?php
namespace CreditNote\Model;
use CreditNote\Model\Base\CreditNoteComment as BaseCreditNoteComment;
class CreditNoteComment extends BaseCreditNoteComment
{
use \CreditNote\Model\Tools\ModelEventDispatcherTrait;
}

View File

@@ -0,0 +1,21 @@
<?php
namespace CreditNote\Model;
use CreditNote\Model\Base\CreditNoteCommentQuery as BaseCreditNoteCommentQuery;
/**
* Skeleton subclass for performing query and update operations on the 'credit_note_comment' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class CreditNoteCommentQuery extends BaseCreditNoteCommentQuery
{
} // CreditNoteCommentQuery

View File

@@ -0,0 +1,38 @@
<?php
namespace CreditNote\Model;
use CreditNote\Model\Base\CreditNoteDetail as BaseCreditNoteDetail;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\OrderProduct;
class CreditNoteDetail extends BaseCreditNoteDetail
{
use \CreditNote\Model\Tools\ModelEventDispatcherTrait;
/**
* Declares an association between this object and a ChildOrderProduct object.
*
* @param OrderProduct $v
* @return \CreditNote\Model\CreditNoteDetail The current object (for fluent API support)
* @throws PropelException
*/
public function setOrderProduct(OrderProduct $v = null)
{
if ($v === null) {
$this->setOrderProductId(null);
} else {
$this->setOrderProductId($v->getId());
}
$this->aOrderProduct = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildCustomer object, it will not be re-added.
if (method_exists($v, 'addCreditNote') && $v !== null) {
$v->addCreditNote($this);
}
return $this;
}
}

Some files were not shown because too many files have changed in this diff Show More