From 5826bd794254d46a46782cb124488bf7c6648255 Mon Sep 17 00:00:00 2001 From: TheCoreDev Date: Mon, 12 May 2025 17:02:55 +0200 Subject: [PATCH] =?UTF-8?q?[12/05/2025]=20Un=20peu=20de=20param=C3=A9trage?= =?UTF-8?q?,=20notamment=20les=20frais=20de=20port=20gratuits=20en=20fonct?= =?UTF-8?q?ion=20de=20certains=20seuils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + local/colissimo-label/ORD000000008739.pdf | Bin 0 -> 49485 bytes .../AdminIncludes/order-edit.html | 31 + .../ColissimoPickupPoint.php | 342 +++ .../ColissimoPickupPoint/Config/config.xml | 69 + .../ColissimoPickupPoint/Config/insert.sql | 30 + .../ColissimoPickupPoint/Config/module.xml | 18 + .../ColissimoPickupPoint/Config/routing.xml | 46 + .../ColissimoPickupPoint/Config/schema.xml | 64 + .../ColissimoPickupPoint/Config/sqldb.map | 2 + .../ColissimoPickupPoint/Config/thelia.sql | 120 + .../Config/update/1.0.1.sql | 0 .../Controller/Export.php | 249 +++ .../Controller/FreeShipping.php | 150 ++ .../Controller/GetSpecificLocation.php | 106 + .../Controller/ImportController.php | 129 ++ .../Controller/SaveConfig.php | 51 + .../Controller/SliceController.php | 180 ++ .../Form/AddPriceForm.php | 85 + .../Form/ConfigureColissimoPickupPoint.php | 121 + .../ColissimoPickupPoint/Form/ExportOrder.php | 121 + .../Form/FreeShippingForm.php | 88 + .../ColissimoPickupPoint/Form/ImportForm.php | 37 + .../Form/UpdatePriceForm.php | 68 + .../ColissimoPickupPoint/Format/CSV.php | 99 + .../ColissimoPickupPoint/Format/CSVLine.php | 67 + .../ColissimoPickupPoint/Hook/BackHook.php | 23 + .../ColissimoPickupPoint/Hook/FrontHook.php | 41 + .../ColissimoPickupPoint/Hook/PdfHook.php | 38 + .../I18n/AdminIncludes/en_US.php | 6 + .../I18n/AdminIncludes/fr_FR.php | 6 + .../I18n/backOffice/default/en_US.php | 51 + .../I18n/backOffice/default/fr_FR.php | 51 + .../ColissimoPickupPoint/I18n/en_US.php | 34 + .../ColissimoPickupPoint/I18n/fr_FR.php | 34 + .../I18n/frontOffice/default/en_US.php | 33 + .../I18n/frontOffice/default/fr_FR.php | 33 + .../I18n/pdf/default/en_US.php | 8 + .../I18n/pdf/default/fr_FR.php | 8 + .../modules/ColissimoPickupPoint/LICENSE.txt | 165 ++ .../Listener/APIListener.php | 162 ++ .../Listener/SendMail.php | 123 ++ .../Listener/SetDeliveryModule.php | 249 +++ .../Loop/AreaFreeshipping.php | 54 + .../Loop/CheckRightsLoop.php | 78 + .../Loop/ColissimoPickupPointAddress.php | 83 + .../ColissimoPickupPointFreeshippingLoop.php | 52 + .../Loop/ColissimoPickupPointId.php | 71 + .../ColissimoPickupPointOrderAddressLoop.php | 92 + .../Loop/ColissimoPickupPointPriceSlices.php | 52 + .../ColissimoPickupPoint/Loop/GetRelais.php | 179 ++ .../Loop/NotSentOrders.php | 75 + .../Model/AddressColissimoPickupPoint.php | 10 + .../AddressColissimoPickupPointQuery.php | 21 + .../Base/AddressColissimoPickupPoint.php | 1957 +++++++++++++++++ .../Base/AddressColissimoPickupPointQuery.php | 964 ++++++++ .../ColissimoPickupPointAreaFreeshipping.php | 1272 +++++++++++ ...issimoPickupPointAreaFreeshippingQuery.php | 519 +++++ .../Base/ColissimoPickupPointFreeshipping.php | 1184 ++++++++++ .../ColissimoPickupPointFreeshippingQuery.php | 420 ++++ .../Base/ColissimoPickupPointPriceSlices.php | 1427 ++++++++++++ .../ColissimoPickupPointPriceSlicesQuery.php | 654 ++++++ .../Base/OrderAddressColissimoPickupPoint.php | 1236 +++++++++++ .../OrderAddressColissimoPickupPointQuery.php | 495 +++++ .../ColissimoPickupPointAreaFreeshipping.php | 10 + ...issimoPickupPointAreaFreeshippingQuery.php | 21 + .../ColissimoPickupPointFreeshipping.php | 10 + .../ColissimoPickupPointFreeshippingQuery.php | 21 + .../Model/ColissimoPickupPointPriceSlices.php | 10 + .../ColissimoPickupPointPriceSlicesQuery.php | 21 + .../AddressColissimoPickupPointTableMap.php | 504 +++++ ...imoPickupPointAreaFreeshippingTableMap.php | 419 ++++ ...lissimoPickupPointFreeshippingTableMap.php | 414 ++++ ...olissimoPickupPointPriceSlicesTableMap.php | 443 ++++ ...derAddressColissimoPickupPointTableMap.php | 415 ++++ .../OrderAddressColissimoPickupPoint.php | 10 + .../OrderAddressColissimoPickupPointQuery.php | 21 + local/modules/ColissimoPickupPoint/README.md | 147 ++ .../ColissimoPickupPointDeliveryPrice.php | 56 + .../ColissimoPickupPointGoogleApiKey.php | 45 + .../ColissimoPickupPoint/THELIA_INET.FMT | 25 + .../Utils/ColissimoCodeReseau.php | 56 + .../BaseColissimoPickupPointWebService.php | 55 + .../WebService/BaseWebService.php | 229 ++ .../WebService/FindByAddress.php | 92 + .../WebService/FindById.php | 79 + .../ColissimoPickupPoint/composer.json | 11 + .../images/socolissimo.png | Bin 0 -> 16104 bytes .../backOffice/default/module-config-js.html | 201 ++ .../default/module_configuration.html | 474 ++++ .../frontOffice/default/assets/css/styles.css | 7 + .../frontOffice/default/assets/img/A2P.png | Bin 0 -> 2253 bytes .../frontOffice/default/assets/img/BPR.png | Bin 0 -> 2412 bytes .../frontOffice/default/assets/img/CIT.png | Bin 0 -> 2476 bytes .../default/assets/img/dom-small.png | Bin 0 -> 5740 bytes .../frontOffice/default/assets/img/maison.png | Bin 0 -> 2610 bytes .../default/assets/img/mobilite-reduite.gif | Bin 0 -> 2113 bytes .../default/assets/img/parking.gif | Bin 0 -> 2108 bytes .../default/assets/img/pret-manutention.gif | Bin 0 -> 2115 bytes .../default/colissimo-pickup-point.html | 487 ++++ .../frontOffice/default/delivery-address.html | 29 + ...tSpecificLocationColissimoPickupPoint.html | 36 + .../pdf/default/delivery_mode_infos.html | 14 + web/media/thumbs/LOGO-SAINT-JAMES-EPAULE.png | Bin 0 -> 18865 bytes web/media/upload/LOGO-SAINT-JAMES-EPAULE.png | Bin 0 -> 669120 bytes 105 files changed, 18596 insertions(+) create mode 100644 local/colissimo-label/ORD000000008739.pdf create mode 100755 local/modules/ColissimoPickupPoint/AdminIncludes/order-edit.html create mode 100755 local/modules/ColissimoPickupPoint/ColissimoPickupPoint.php create mode 100755 local/modules/ColissimoPickupPoint/Config/config.xml create mode 100644 local/modules/ColissimoPickupPoint/Config/insert.sql create mode 100755 local/modules/ColissimoPickupPoint/Config/module.xml create mode 100755 local/modules/ColissimoPickupPoint/Config/routing.xml create mode 100755 local/modules/ColissimoPickupPoint/Config/schema.xml create mode 100644 local/modules/ColissimoPickupPoint/Config/sqldb.map create mode 100644 local/modules/ColissimoPickupPoint/Config/thelia.sql create mode 100644 local/modules/ColissimoPickupPoint/Config/update/1.0.1.sql create mode 100755 local/modules/ColissimoPickupPoint/Controller/Export.php create mode 100755 local/modules/ColissimoPickupPoint/Controller/FreeShipping.php create mode 100755 local/modules/ColissimoPickupPoint/Controller/GetSpecificLocation.php create mode 100644 local/modules/ColissimoPickupPoint/Controller/ImportController.php create mode 100755 local/modules/ColissimoPickupPoint/Controller/SaveConfig.php create mode 100644 local/modules/ColissimoPickupPoint/Controller/SliceController.php create mode 100644 local/modules/ColissimoPickupPoint/Form/AddPriceForm.php create mode 100755 local/modules/ColissimoPickupPoint/Form/ConfigureColissimoPickupPoint.php create mode 100755 local/modules/ColissimoPickupPoint/Form/ExportOrder.php create mode 100755 local/modules/ColissimoPickupPoint/Form/FreeShippingForm.php create mode 100644 local/modules/ColissimoPickupPoint/Form/ImportForm.php create mode 100644 local/modules/ColissimoPickupPoint/Form/UpdatePriceForm.php create mode 100755 local/modules/ColissimoPickupPoint/Format/CSV.php create mode 100755 local/modules/ColissimoPickupPoint/Format/CSVLine.php create mode 100644 local/modules/ColissimoPickupPoint/Hook/BackHook.php create mode 100644 local/modules/ColissimoPickupPoint/Hook/FrontHook.php create mode 100644 local/modules/ColissimoPickupPoint/Hook/PdfHook.php create mode 100644 local/modules/ColissimoPickupPoint/I18n/AdminIncludes/en_US.php create mode 100755 local/modules/ColissimoPickupPoint/I18n/AdminIncludes/fr_FR.php create mode 100644 local/modules/ColissimoPickupPoint/I18n/backOffice/default/en_US.php create mode 100644 local/modules/ColissimoPickupPoint/I18n/backOffice/default/fr_FR.php create mode 100644 local/modules/ColissimoPickupPoint/I18n/en_US.php create mode 100755 local/modules/ColissimoPickupPoint/I18n/fr_FR.php create mode 100644 local/modules/ColissimoPickupPoint/I18n/frontOffice/default/en_US.php create mode 100755 local/modules/ColissimoPickupPoint/I18n/frontOffice/default/fr_FR.php create mode 100644 local/modules/ColissimoPickupPoint/I18n/pdf/default/en_US.php create mode 100644 local/modules/ColissimoPickupPoint/I18n/pdf/default/fr_FR.php create mode 100644 local/modules/ColissimoPickupPoint/LICENSE.txt create mode 100644 local/modules/ColissimoPickupPoint/Listener/APIListener.php create mode 100755 local/modules/ColissimoPickupPoint/Listener/SendMail.php create mode 100755 local/modules/ColissimoPickupPoint/Listener/SetDeliveryModule.php create mode 100644 local/modules/ColissimoPickupPoint/Loop/AreaFreeshipping.php create mode 100755 local/modules/ColissimoPickupPoint/Loop/CheckRightsLoop.php create mode 100755 local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointAddress.php create mode 100644 local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointFreeshippingLoop.php create mode 100755 local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointId.php create mode 100644 local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointOrderAddressLoop.php create mode 100644 local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointPriceSlices.php create mode 100755 local/modules/ColissimoPickupPoint/Loop/GetRelais.php create mode 100755 local/modules/ColissimoPickupPoint/Loop/NotSentOrders.php create mode 100644 local/modules/ColissimoPickupPoint/Model/AddressColissimoPickupPoint.php create mode 100644 local/modules/ColissimoPickupPoint/Model/AddressColissimoPickupPointQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/AddressColissimoPickupPoint.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/AddressColissimoPickupPointQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointAreaFreeshipping.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointAreaFreeshippingQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointFreeshipping.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointFreeshippingQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointPriceSlices.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointPriceSlicesQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/OrderAddressColissimoPickupPoint.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Base/OrderAddressColissimoPickupPointQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointAreaFreeshipping.php create mode 100644 local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointAreaFreeshippingQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointFreeshipping.php create mode 100644 local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointFreeshippingQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointPriceSlices.php create mode 100644 local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointPriceSlicesQuery.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Map/AddressColissimoPickupPointTableMap.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointAreaFreeshippingTableMap.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointFreeshippingTableMap.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointPriceSlicesTableMap.php create mode 100644 local/modules/ColissimoPickupPoint/Model/Map/OrderAddressColissimoPickupPointTableMap.php create mode 100644 local/modules/ColissimoPickupPoint/Model/OrderAddressColissimoPickupPoint.php create mode 100644 local/modules/ColissimoPickupPoint/Model/OrderAddressColissimoPickupPointQuery.php create mode 100755 local/modules/ColissimoPickupPoint/README.md create mode 100644 local/modules/ColissimoPickupPoint/Smarty/Plugins/ColissimoPickupPointDeliveryPrice.php create mode 100644 local/modules/ColissimoPickupPoint/Smarty/Plugins/ColissimoPickupPointGoogleApiKey.php create mode 100644 local/modules/ColissimoPickupPoint/THELIA_INET.FMT create mode 100644 local/modules/ColissimoPickupPoint/Utils/ColissimoCodeReseau.php create mode 100755 local/modules/ColissimoPickupPoint/WebService/BaseColissimoPickupPointWebService.php create mode 100755 local/modules/ColissimoPickupPoint/WebService/BaseWebService.php create mode 100755 local/modules/ColissimoPickupPoint/WebService/FindByAddress.php create mode 100755 local/modules/ColissimoPickupPoint/WebService/FindById.php create mode 100644 local/modules/ColissimoPickupPoint/composer.json create mode 100644 local/modules/ColissimoPickupPoint/images/socolissimo.png create mode 100755 local/modules/ColissimoPickupPoint/templates/backOffice/default/module-config-js.html create mode 100755 local/modules/ColissimoPickupPoint/templates/backOffice/default/module_configuration.html create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/css/styles.css create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/A2P.png create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/BPR.png create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/CIT.png create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/dom-small.png create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/maison.png create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/mobilite-reduite.gif create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/parking.gif create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/pret-manutention.gif create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/colissimo-pickup-point.html create mode 100644 local/modules/ColissimoPickupPoint/templates/frontOffice/default/delivery-address.html create mode 100755 local/modules/ColissimoPickupPoint/templates/frontOffice/default/getSpecificLocationColissimoPickupPoint.html create mode 100644 local/modules/ColissimoPickupPoint/templates/pdf/default/delivery_mode_infos.html create mode 100644 web/media/thumbs/LOGO-SAINT-JAMES-EPAULE.png create mode 100644 web/media/upload/LOGO-SAINT-JAMES-EPAULE.png diff --git a/.gitignore b/.gitignore index cb281fd6..aebec7d9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /.well-known/ /local/session/ /stats/ +/core/vendor/composer/ diff --git a/local/colissimo-label/ORD000000008739.pdf b/local/colissimo-label/ORD000000008739.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3af5d5bf79029065352240ac1b2fba70e9dd1ac5 GIT binary patch literal 49485 zcmb@t2_TeR`#*kLvc_bKgqflUVKDX#2}wc=m6*peb|%RdW<=Jqmr8{e*_#f7@u(qG z5I84K9z8wfqamlU2xTirH!KhM_YBteECLDM9_CR#jP=I_oN>nbBUFDpFv9ts1@HY4 z>g&Jt^?9(qF6&g*fBvL)5bNu9)*Yd)qM`!c`=337b@bs;K^y>=Cy$B}N)r(TZs0A# z^yl4;#}9#Af1(1YsQmf$=aU~dXCEHrqgDr<)KpL?S2Z*?v-C0}PMa31d4~MYk@#ES3eI!5_@Vq|2FY4gIzustSDQRgUwU7u64K2`0 zLt702hTD4-p={!ca#3}`f)O1xks8|Cj#zakRTnKaq^34jL)AqE{Ojthj#Sk^pg>2& zQCEcV(e;k1>gwx^sv|X()U^>uT@Z2yu?P#tvsiE3*Lu#w2siKg- zjrDUy)ihO<)PF3R5zgoI+4c6nwfYa3*8ZzB0bLa>#Bb!awAGPFtzWdQf9T>r))n=? zQb(yPscItB)BwNg-}yDN(nKOm&N%uyV}A|dhfq;c)k3JNsw;taNKKTICJNY$3eaCQ z#2GBY7UBCJP6D}ZU;nZQbtNrTU=JuIHI46cIB1M8vOIivUEz)$Ha_%M$^K)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KE}$m@hx6h@I$k!5sMmXQc`NQVM0qH&r|T)ZN( zf-EaKc5<4;v!bjEoW{W2rDB#7kQ6RJoSH}o!5WVR!m%QcHQA{vf>TsDm+ItI(IqMp zhY<-EkVO|moGz!}R76hHB&-pM;blq062r=j>Xdj@U}Oymp#q>H?cq}!LRFfpx-=Gx zL{b$+bg6>wBuje$J=;l2TD2vWo;6JMGkQU+eAiWWW@8L4X|-MQVXE{|7Fr)AdikRAR8w^Hjc11AOv%On?(gcL@3PjjE(2eV#vr!l8rEZ zIl^I%hZ1rqM+g-3CFQpQ#7d$~#wZ-_2O$g-aP;tGKO7+l9Fc4c?t>5xQwTljfRTh~ zgz~Hetr!Z^bS&CL0cZ~c2nTs$J&2`G zLR$ZAQ8qxiF@To(U&+4zRFv80irB>}GAk)6=n1ULAORUwA&QgXb=@U1ipIKl0ptNo z1s2Hjxmb2ef{T@$qAE+A!ibo-IMylZDlcn-F6x}isqm~5vGkn?N@Om$-N`cqGysn! zMV16clr;skhAKKWnJ2m`Xc#nx#<&nm`!(H4>(%d|98f$E1Ao94^za=RkG-exgnD0F zs_Gt;Xa=W4F^{fz^W25A6|W9M;0BK22t!yndxvlw3mN9SwSSh@4+HLpA(JXt`z#np zi`}_^5Oib_3Rmt9r2qm{Go}P~#dEg{^p~7$+mN0}aj-w$^P4v2u4}MFRmSr#pTJw^8n1{~2G!BFC zyfltnCZE7VPtfZEUckUyiWd_M3g+T`SY#wnf)|y=lKhi;V43L;&+Ad3c|BmjSnU~k srC|3EFl^jzFJftrQT{A+xlxEgLTpszRXpBMTVt7Jh;{1Jl(f`;03t`5TL1t6 literal 0 HcmV?d00001 diff --git a/local/modules/ColissimoPickupPoint/AdminIncludes/order-edit.html b/local/modules/ColissimoPickupPoint/AdminIncludes/order-edit.html new file mode 100755 index 00000000..0f706ca2 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/AdminIncludes/order-edit.html @@ -0,0 +1,31 @@ +{loop name="check.module.colissimo.pickup.point.order.edit" type="order" id=$ID status="2,3"} +{loop name="check.module.colissimo.pickup.point.id" type="colissimo.pickup.point.id"} + {if $MODULE_ID == $DELIVERY_MODULE} +
+
+
+ {intl l="Export Coliship file" d='colissimo.pickup.point.ai'} +
+
+ + {form name="colissimo.pickup.point.export"} +
+ {form_hidden_fields form=$form} + {form_field form=$form field="new_status_id"} + + {/form_field} + + {form_field form=$form field="order_"|cat:$ID} + + {/form_field} + +
+ {/form} +
+ + Suivi du colis: ici +
+
+ {/if} +{/loop} +{/loop} diff --git a/local/modules/ColissimoPickupPoint/ColissimoPickupPoint.php b/local/modules/ColissimoPickupPoint/ColissimoPickupPoint.php new file mode 100755 index 00000000..6cae6beb --- /dev/null +++ b/local/modules/ColissimoPickupPoint/ColissimoPickupPoint.php @@ -0,0 +1,342 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint; + +use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery; +use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery; +use PDO; +use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\Exception\PropelException; +use Propel\Runtime\Propel; +use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlicesQuery; +use Symfony\Component\Finder\Finder; +use Symfony\Component\Finder\SplFileInfo; +use Thelia\Model\Country; +use Thelia\Model\ModuleImageQuery; +use Thelia\Model\ModuleQuery; +use Propel\Runtime\Connection\ConnectionInterface; +use Thelia\Install\Database; +use Thelia\Module\AbstractDeliveryModule; +use Thelia\Module\Exception\DeliveryException; +use Thelia\Tools\Version\Version; + +class ColissimoPickupPoint extends AbstractDeliveryModule +{ + protected $request; + protected $dispatcher; + + private static $prices = null; + + const DOMAIN = 'colissimopickuppoint'; + + const COLISSIMO_USERNAME = 'colissimo_pickup_point_username'; + + const COLISSIMO_PASSWORD = 'colissimo_pickup_point_password'; + + const COLISSIMO_GOOGLE_KEY = 'colissimo_pickup_point_google_map_key'; + + const COLISSIMO_ENDPOINT = 'colissimo_pickup_point_endpoint_url'; + + /** + * These constants refer to the imported CSV file. + * IMPORT_NB_COLS: file's number of columns (begin at 1) + * IMPORT_DELIVERY_REF_COL: file's column where delivery reference is set (begin at 0) + * IMPORT_ORDER_REF_COL: file's column where order reference is set (begin at 0) + */ + const IMPORT_NB_COLS = 2; + const IMPORT_DELIVERY_REF_COL = 0; + const IMPORT_ORDER_REF_COL = 1; + + /** + * This method is called by the Delivery loop, to check if the current module has to be displayed to the customer. + * Override it to implements your delivery rules/ + * + * If you return true, the delivery method will de displayed to the customer + * If you return false, the delivery method will not be displayed + * + * @param Country $country the country to deliver to. + * + * @return boolean + * @throws PropelException + */ + public function isValidDelivery(Country $country) + { + $cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight(); + + $areaId = $country->getAreaId(); + + $prices = ColissimoPickupPointPriceSlicesQuery::create() + ->filterByAreaId($areaId) + ->findOne(); + + $freeShipping = ColissimoPickupPointFreeshippingQuery::create() + ->findOneByActive(1); + + /* check if Colissimo delivers the asked area*/ + if (null !== $prices || null !== $freeShipping) { + return true; + } + return false; + } + + /** + * @param $areaId + * @param $weight + * @param $cartAmount + * + * @return mixed + * @throws DeliveryException + */ + public static function getPostageAmount($areaId, $weight, $cartAmount = 0) + { + $freeshipping = ColissimoPickupPointFreeshippingQuery::create() + ->findOneById(1) + ->getActive() + ; + + $freeshippingFrom = ColissimoPickupPointFreeshippingQuery::create() + ->findOneById(1) + ->getFreeshippingFrom() + ; + + $postage = 0; + + if (!$freeshipping) { + $areaPrices = ColissimoPickupPointPriceSlicesQuery::create() + ->filterByAreaId($areaId) + ->filterByWeightMax($weight, Criteria::GREATER_EQUAL) + ->_or() + ->filterByWeightMax(null) + ->filterByPriceMax($cartAmount, Criteria::GREATER_EQUAL) + ->_or() + ->filterByPriceMax(null) + ->orderByWeightMax() + ->orderByPriceMax(); + + $firstPrice = $areaPrices->find() + ->getFirst(); + + if (null === $firstPrice) { + throw new DeliveryException('Colissimo delivery unavailable for your cart weight or delivery country'); + } + + /** If a min price for general freeshipping is defined and the cart reach this amount, return a postage of 0 */ + if (null !== $freeshippingFrom && $freeshippingFrom <= $cartAmount) { + $postage = 0; + return $postage; + } + + $areaFreeshipping = ColissimoPickupPointAreaFreeshippingQuery::create() + ->filterByAreaId($areaId) + ->findOne(); + + if ($areaFreeshipping) { + $areaFreeshipping = $areaFreeshipping->getCartAmount(); + } + + /** If a min price for area freeshipping is defined and the cart reach this amount, return a postage of 0 */ + if (null !== $areaFreeshipping && $areaFreeshipping <= $cartAmount) { + $postage = 0; + return $postage; + } + + $postage = $firstPrice->getPrice(); + } + return $postage; + } + + /** + * Calculate and return delivery price + * + * @param Country $country + * @return mixed + * @throws DeliveryException + * @throws PropelException + */ + public function getPostage(Country $country) + { + $request = $this->getRequest(); + + $cartWeight = $request->getSession()->getSessionCart($this->getDispatcher())->getWeight(); + $cartAmount = $request->getSession()->getSessionCart($this->getDispatcher())->getTaxedAmount($country); + + $areaIdArray = $this->getAllAreasForCountry($country); + if (empty($areaIdArray)) { + throw new DeliveryException('Your delivery country is not covered by Colissimo.'); + } + $postage = null; + + if (null === $postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount)) { + $postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount); + if (null === $postage) { + throw new DeliveryException('Colissimo delivery unavailable for your cart weight or delivery country'); + } + } + return $postage; + } + + + private function getMinPostage($areaIdArray, $cartWeight, $cartAmount) + { + $minPostage = null; + + foreach ($areaIdArray as $areaId) { + try { + $postage = self::getPostageAmount($areaId, $cartWeight, $cartAmount); + if ($minPostage === null || $postage < $minPostage) { + $minPostage = $postage; + if ($minPostage == 0) { + break; + } + } + } catch (\Exception $ex) { + } + } + + return $minPostage; + } + + /** + * Returns ids of area containing this country and covers by this module + * @param Country $country + * @return array Area ids + */ + private function getAllAreasForCountry(Country $country) + { + $areaArray = []; + + $sql = 'SELECT ca.area_id as area_id FROM country_area ca + INNER JOIN area_delivery_module adm ON (ca.area_id = adm.area_id AND adm.delivery_module_id = :p0) + WHERE ca.country_id = :p1'; + + $con = Propel::getConnection(); + + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $this->getModuleModel()->getId(), PDO::PARAM_INT); + $stmt->bindValue(':p1', $country->getId(), PDO::PARAM_INT); + $stmt->execute(); + + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + $areaArray[] = $row['area_id']; + } + + return $areaArray; + } + + /** Return the module code */ + public function getCode() + { + return 'ColissimoPickupPoint'; + } + + /** + * Check if the config values exist, and creates them otherwise + */ + protected function checkModuleConfig() { + /** Colissimo Username / Account number */ + if (null === self::getConfigValue(self::COLISSIMO_USERNAME)) { + self::setConfigValue(self::COLISSIMO_USERNAME, ''); + } + + /** Colissimo password */ + if (null === self::getConfigValue(self::COLISSIMO_PASSWORD)) { + self::setConfigValue(self::COLISSIMO_PASSWORD, ''); + } + + /** Colissimo Google Map key */ + if (null === self::getConfigValue(self::COLISSIMO_GOOGLE_KEY)) { + self::setConfigValue(self::COLISSIMO_GOOGLE_KEY, ''); + } + + /** Colissimo Endpoint url for pickup point */ + if (null === self::getConfigValue(self::COLISSIMO_ENDPOINT)) { + self::setConfigValue(self::COLISSIMO_ENDPOINT, 'https://ws.colissimo.fr/pointretrait-ws-cxf/PointRetraitServiceWS/2.0?wsdl'); + } + } + + + public function postActivation(ConnectionInterface $con = null) + { + try { + // Security to not erase user config on reactivation + ColissimoPickupPointPriceSlicesQuery::create()->findOne(); + ColissimoPickupPointAreaFreeshippingQuery::create()->findOne(); + ColissimoPickupPointFreeshippingQuery::create()->findOne(); + } catch (\Exception $e) { + $database = new Database($con->getWrappedConnection()); + $database->insertSql(null, [__DIR__ . '/Config/thelia.sql', __DIR__ . '/Config/insert.sql']); + } + + if (!ColissimoPickupPointFreeshippingQuery::create()->filterById(1)->findOne()) { + ColissimoPickupPointFreeshippingQuery::create()->filterById(1)->findOneOrCreate()->setActive(0)->save(); + } + + $this->checkModuleConfig(); + + /** Insert the images from image folder if first module activation */ + $module = $this->getModuleModel(); + if (ModuleImageQuery::create()->filterByModule($module)->count() === 0) { + $this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con); + } + } + + /** Return the module ID */ + public static function getModCode() + { + return ModuleQuery::create()->findOneByCode('ColissimoPickupPoint')->getId(); + } + + /** + * @inheritDoc + */ + public function update($currentVersion, $newVersion, ConnectionInterface $con = null) + { + $this->checkModuleConfig(); + + $finder = (new Finder) + ->files() + ->name('#.*?\.sql#') + ->sortByName() + ->in(__DIR__ . DS . 'Config' . DS . 'update'); + + $database = new Database($con); + + /** @var SplFileInfo $updateSQLFile */ + foreach ($finder as $updateSQLFile) { + if (version_compare($currentVersion, str_replace('.sql', '', $updateSQLFile->getFilename()), '<')) { + $database->insertSql( + null, + [ + $updateSQLFile->getPathname() + ] + ); + } + } + } + + public function getDeliveryMode() + { + return "pickup"; + } +} diff --git a/local/modules/ColissimoPickupPoint/Config/config.xml b/local/modules/ColissimoPickupPoint/Config/config.xml new file mode 100755 index 00000000..4b719487 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Config/config.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/local/modules/ColissimoPickupPoint/Config/insert.sql b/local/modules/ColissimoPickupPoint/Config/insert.sql new file mode 100644 index 00000000..da4a6891 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Config/insert.sql @@ -0,0 +1,30 @@ +# 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; + +-- --------------------------------------------------------------------- +-- Mail templates for colissimo pickup point +-- --------------------------------------------------------------------- +-- First, delete existing entries +SET @var := 0; +SELECT @var := `id` FROM `message` WHERE name="mail_colissimo_pickup_point"; +DELETE FROM `message` WHERE `id`=@var; +-- Try if ON DELETE constraint isn't set +DELETE FROM `message_i18n` WHERE `id`=@var; + +-- Then add new entries +SELECT @max := MAX(`id`) FROM `message`; +SET @max := @max+1; +-- insert message +INSERT INTO `message` (`id`, `name`, `secured`) VALUES + (@max, + 'mail_colissimo_pickup_point', + '0' + ); + +-- and template fr_FR +INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES + (@max, 'fr_FR', 'Mail livraison Colissimo Point Relais', 'Suivi Colissimo Point Relais commande : {$order_ref}', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de Colissimo Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de Colissimo Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement'); + +# This restores the fkey checks, after having unset them earlier +SET FOREIGN_KEY_CHECKS = 1; diff --git a/local/modules/ColissimoPickupPoint/Config/module.xml b/local/modules/ColissimoPickupPoint/Config/module.xml new file mode 100755 index 00000000..80ab1e6f --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Config/module.xml @@ -0,0 +1,18 @@ + + + ColissimoPickupPoint\ColissimoPickupPoint + + Colissimo Pickup Point Delivery + + + Livraison Colissimo en Point Retrait + + 1.0.2 + + Thelia + info@thelia.net + + delivery + 2.3.3 + other + diff --git a/local/modules/ColissimoPickupPoint/Config/routing.xml b/local/modules/ColissimoPickupPoint/Config/routing.xml new file mode 100755 index 00000000..fd379beb --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Config/routing.xml @@ -0,0 +1,46 @@ + + + + + ColissimoPickupPoint\Controller\SliceController::saveSliceAction + + + ColissimoPickupPoint\Controller\SliceController::deleteSliceAction + + + + ColissimoPickupPoint\Controller\FreeShipping::toggleFreeShippingActivation + + + + ColissimoPickupPoint\Controller\FreeShipping::setAreaFreeShipping + + + + ColissimoPickupPoint\Controller\SaveConfig::save + + + + ColissimoPickupPoint\Controller\GetSpecificLocation::get + + [a-zA-Z\- ]+ + + + + ColissimoPickupPoint\Controller\GetSpecificLocation::getPointInfo + + + + ColissimoPickupPoint\Controller\GetSpecificLocation::search + + + + ColissimoPickupPoint\Controller\Export::export + + + + ColissimoPickupPoint:Import:import + + diff --git a/local/modules/ColissimoPickupPoint/Config/schema.xml b/local/modules/ColissimoPickupPoint/Config/schema.xml new file mode 100755 index 00000000..39eeed70 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Config/schema.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + +
+ + + + + +
+ + + + + + + + +
+ + +
diff --git a/local/modules/ColissimoPickupPoint/Config/sqldb.map b/local/modules/ColissimoPickupPoint/Config/sqldb.map new file mode 100644 index 00000000..63a93baa --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Config/sqldb.map @@ -0,0 +1,2 @@ +# Sqlfile -> Database map +thelia.sql=thelia diff --git a/local/modules/ColissimoPickupPoint/Config/thelia.sql b/local/modules/ColissimoPickupPoint/Config/thelia.sql new file mode 100644 index 00000000..ad870c65 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Config/thelia.sql @@ -0,0 +1,120 @@ + +# 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; + +-- --------------------------------------------------------------------- +-- address_colissimo_pickup_point +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `address_colissimo_pickup_point`; + +CREATE TABLE `address_colissimo_pickup_point` +( + `id` INTEGER NOT NULL, + `title_id` INTEGER NOT NULL, + `company` VARCHAR(255), + `firstname` VARCHAR(255) NOT NULL, + `lastname` VARCHAR(255) NOT NULL, + `address1` VARCHAR(255) NOT NULL, + `address2` VARCHAR(255) NOT NULL, + `address3` VARCHAR(255) NOT NULL, + `zipcode` VARCHAR(10) NOT NULL, + `city` VARCHAR(255) NOT NULL, + `country_id` INTEGER NOT NULL, + `code` VARCHAR(10) NOT NULL, + `type` VARCHAR(10) NOT NULL, + `cellphone` VARCHAR(20), + PRIMARY KEY (`id`), + INDEX `FI_address_colissimo_pickup_point_customer_title_id` (`title_id`), + INDEX `FI_address_colissimo_pickup_point_country_id` (`country_id`), + CONSTRAINT `fk_address_colissimo_pickup_point_customer_title_id` + FOREIGN KEY (`title_id`) + REFERENCES `customer_title` (`id`) + ON UPDATE RESTRICT + ON DELETE RESTRICT, + CONSTRAINT `fk_address_colissimo_pickup_point_country_id` + FOREIGN KEY (`country_id`) + REFERENCES `country` (`id`) + ON UPDATE RESTRICT + ON DELETE RESTRICT +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- order_address_colissimo_pickup_point +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `order_address_colissimo_pickup_point`; + +CREATE TABLE `order_address_colissimo_pickup_point` +( + `id` INTEGER NOT NULL, + `code` VARCHAR(10) NOT NULL, + `type` VARCHAR(10) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_order_address_colissimo_pickup_point_order_address_id` + FOREIGN KEY (`id`) + REFERENCES `order_address` (`id`) + ON UPDATE CASCADE + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- colissimo_pickup_point_price_slices +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `colissimo_pickup_point_price_slices`; + +CREATE TABLE `colissimo_pickup_point_price_slices` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `area_id` INTEGER NOT NULL, + `weight_max` FLOAT, + `price_max` FLOAT, + `franco_min_price` FLOAT, + `price` FLOAT NOT NULL, + PRIMARY KEY (`id`), + INDEX `FI_colissimo_pickup_point_price_slices_area_id` (`area_id`), + CONSTRAINT `fk_colissimo_pickup_point_price_slices_area_id` + FOREIGN KEY (`area_id`) + REFERENCES `area` (`id`) + ON UPDATE RESTRICT + ON DELETE RESTRICT +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- colissimo_pickup_point_freeshipping +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `colissimo_pickup_point_freeshipping`; + +CREATE TABLE `colissimo_pickup_point_freeshipping` +( + `id` INTEGER NOT NULL, + `active` TINYINT(1) DEFAULT 0, + `freeshipping_from` DECIMAL(18,2), + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- colissimo_pickup_point_area_freeshipping +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `colissimo_pickup_point_area_freeshipping`; + +CREATE TABLE `colissimo_pickup_point_area_freeshipping` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `area_id` INTEGER NOT NULL, + `cart_amount` DECIMAL(18,2) DEFAULT 0.00, + PRIMARY KEY (`id`), + INDEX `FI_colissimo_pickup_point_area_freeshipping_pr_area_id` (`area_id`), + CONSTRAINT `fk_colissimo_pickup_point_area_freeshipping_pr_area_id` + FOREIGN KEY (`area_id`) + REFERENCES `area` (`id`) + ON UPDATE RESTRICT + ON DELETE RESTRICT +) ENGINE=InnoDB; + +# This restores the fkey checks, after having unset them earlier +SET FOREIGN_KEY_CHECKS = 1; diff --git a/local/modules/ColissimoPickupPoint/Config/update/1.0.1.sql b/local/modules/ColissimoPickupPoint/Config/update/1.0.1.sql new file mode 100644 index 00000000..e69de29b diff --git a/local/modules/ColissimoPickupPoint/Controller/Export.php b/local/modules/ColissimoPickupPoint/Controller/Export.php new file mode 100755 index 00000000..6324562f --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Controller/Export.php @@ -0,0 +1,249 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Controller; + +use Propel\Runtime\ActiveQuery\Criteria; +use ColissimoPickupPoint\Form\ExportOrder; +use ColissimoPickupPoint\Format\CSV; +use ColissimoPickupPoint\Format\CSVLine; +use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPointQuery; +use ColissimoPickupPoint\ColissimoPickupPoint; +use Symfony\Component\Config\Definition\Exception\Exception; +use Thelia\Controller\Admin\BaseAdminController; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\HttpFoundation\Response; +use Thelia\Model\Base\CountryQuery; +use Thelia\Model\ConfigQuery; +use Thelia\Model\CustomerTitleI18nQuery; +use Thelia\Model\OrderAddressQuery; +use Thelia\Model\OrderQuery; +use Thelia\Core\Event\Order\OrderEvent; +use Thelia\Model\OrderStatus; +use Thelia\Model\OrderStatusQuery; +use Thelia\Core\Security\Resource\AdminResources; +use Thelia\Core\Security\AccessManager; + +/** + * Class Export + * @package ColissimoPickupPoint\Controller + * @author Thelia + */ +class Export extends BaseAdminController +{ + const CSV_SEPARATOR = ';'; + + const DEFAULT_PHONE = '0100000000'; + const DEFAULT_CELLPHONE = '0600000000'; + + public function export() + { + if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('ColissimoPickupPoint'), AccessManager::UPDATE)) { + return $response; + } + + $csv = new CSV(self::CSV_SEPARATOR); + + try { + $form = new ExportOrder($this->getRequest()); + $vform = $this->validateForm($form); + + // Check status_id + $status_id = $vform->get('new_status_id')->getData(); + if (!preg_match('#^nochange|processing|sent$#',$status_id)) { + throw new Exception('Bad value for new_status_id field'); + } + + $status = OrderStatusQuery::create() + ->filterByCode( + array( + OrderStatus::CODE_PAID, + OrderStatus::CODE_PROCESSING, + OrderStatus::CODE_SENT + ), + Criteria::IN + ) + ->find() + ->toArray('code') + ; + + $query = OrderQuery::create() + ->filterByDeliveryModuleId(ColissimoPickupPoint::getModCode()) + ->filterByStatusId( + array( + $status[OrderStatus::CODE_PAID]['Id'], + $status[OrderStatus::CODE_PROCESSING]['Id']), + Criteria::IN + ) + ->find(); + + // check form && exec csv + /** @var \Thelia\Model\Order $order */ + foreach ($query as $order) { + $value = $vform->get('order_'.$order->getId())->getData(); + + // If checkbox is checked + if ($value) { + /** + * Retrieve user with the order + */ + $customer = $order->getCustomer(); + + /** + * Retrieve address with the order + */ + $address = OrderAddressQuery::create() + ->findPk($order->getDeliveryOrderAddressId()); + + if ($address === null) { + throw new Exception("Could not find the order's invoice address"); + } + + /** + * Retrieve country with the address + */ + $country = CountryQuery::create() + ->findPk($address->getCountryId()); + + if ($country === null) { + throw new Exception("Could not find the order's country"); + } + + /** + * Retrieve Title + */ + $title = CustomerTitleI18nQuery::create() + ->filterById($customer->getTitleId()) + ->findOneByLocale( + $this->getSession() + ->getAdminEditionLang() + ->getLocale() + ); + + /** + * Get user's phone & cellphone + * First get invoice address phone, + * If empty, try to get default address' phone. + * If still empty, set default value + */ + $phone = $address->getPhone(); + if (empty($phone)) { + $phone = $customer->getDefaultAddress()->getPhone(); + + if (empty($phone)) { + $phone = self::DEFAULT_PHONE; + } + } + + /** + * Cellphone + */ + $cellphone = $customer->getDefaultAddress()->getCellphone(); + + if (empty($cellphone)) { + $cellphone = self::DEFAULT_CELLPHONE; + } + + /** + * Compute package weight + */ + $weight = 0; + if ($vform->get('order_weight_'.$order->getId())->getData() == 0) { + /** @var \Thelia\Model\OrderProduct $product */ + foreach ($order->getOrderProducts() as $product) { + $weight+=(double) $product->getWeight() * $product->getQuantity(); + } + } else { + $weight = $vform->get('order_weight_'.$order->getId())->getData(); + } + + /** + * Get relay ID + */ + $relay_id = OrderAddressColissimoPickupPointQuery::create() + ->findPk($order->getDeliveryOrderAddressId()); + + /** + * Get store's name + */ + $store_name = ConfigQuery::read('store_name'); + /** + * Write CSV line + */ + $csv->addLine( + CSVLine::create( + array( + $address->getFirstname(), + $address->getLastname(), + $address->getCompany(), + $address->getAddress1(), + $address->getAddress2(), + $address->getAddress3(), + $address->getZipcode(), + $address->getCity(), + $country->getIsoalpha2(), + $phone, + $cellphone, + $order->getRef(), + $title->getShort(), + // the Expeditor software used to accept a relay id of 0, but no longer does + ($relay_id !== null) ? ($relay_id->getCode() == 0) ? '' : $relay_id->getCode() : 0, + $customer->getEmail(), + $weight, + $store_name, + ($relay_id !== null) ? $relay_id->getType() : 0 + ) + ) + ); + + /** + * Then update order's status if necessary + */ + if ($status_id === 'processing') { + $event = new OrderEvent($order); + $event->setStatus($status[OrderStatus::CODE_PROCESSING]['Id']); + $this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event); + } elseif ($status_id === 'sent') { + $event = new OrderEvent($order); + $event->setStatus($status[OrderStatus::CODE_SENT]['Id']); + $this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event); + } + + } + } + + } catch (\Exception $e) { + return Response::create($e->getMessage(),500); + } + + return Response::create( + utf8_decode($csv->parse()), + 200, + array( + 'Content-Encoding' => 'ISO-8889-1', + 'Content-Type' => 'application/csv-tab-delimited-table', + 'Content-disposition' => 'filename=expeditor_thelia.csv' + ) + ); + } +} diff --git a/local/modules/ColissimoPickupPoint/Controller/FreeShipping.php b/local/modules/ColissimoPickupPoint/Controller/FreeShipping.php new file mode 100755 index 00000000..0a81da5b --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Controller/FreeShipping.php @@ -0,0 +1,150 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Controller; + +use ColissimoPickupPoint\Form\FreeShippingForm; +use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping; +use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery; +use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping; +use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery; +use Symfony\Component\HttpFoundation\JsonResponse; +use Thelia\Controller\Admin\BaseAdminController; +use Thelia\Core\HttpFoundation\Response; + +use Thelia\Core\Security\Resource\AdminResources; +use Thelia\Core\Security\AccessManager; +use Thelia\Model\AreaQuery; + +class FreeShipping extends BaseAdminController +{ + /** + * Toggle on or off free shipping for all areas without minimum cart amount, or set the minimum cart amount to reach for all areas to get free shipping + * + * @return mixed|JsonResponse|Response|null + */ + public function toggleFreeShippingActivation() + { + if (null !== $response = $this + ->checkAuth(array(AdminResources::MODULE), array('ColissimoPickupPoint'), AccessManager::UPDATE)) { + return $response; + } + + $form = new FreeShippingForm($this->getRequest()); + $response=null; + + try { + $vform = $this->validateForm($form); + $freeshipping = $vform->get('freeshipping')->getData(); + $freeshippingFrom = $vform->get('freeshipping_from')->getData(); + + if (null === $deliveryFreeshipping = ColissimoPickupPointFreeshippingQuery::create()->findOneById(1)){ + $deliveryFreeshipping = new ColissimoPickupPointFreeshipping(); + } + + $deliveryFreeshipping + ->setActive($freeshipping) + ->setFreeshippingFrom($freeshippingFrom) + ->save() + ; + + $response = $this->generateRedirectFromRoute( + 'admin.module.configure', + array(), + array ( + 'current_tab'=> 'prices_slices_tab', + 'module_code'=> 'ColissimoPickupPoint', + '_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction', + 'price_error_id' => null, + 'price_error' => null + ) + ); + } catch (\Exception $e) { + $response = JsonResponse::create(array('error' => $e->getMessage()), 500); + } + + return $response; + } + + /** + * @return mixed|null|\Symfony\Component\HttpFoundation\Response + */ + public function setAreaFreeShipping() + { + if (null !== $response = $this + ->checkAuth(array(AdminResources::MODULE), array('ColissimoPickupPoint'), AccessManager::UPDATE)) { + return $response; + } + + $data = $this->getRequest()->request; + + try { + $data = $this->getRequest()->request; + + $colissimo_pickup_area_id = $data->get('area-id'); + $cartAmount = $data->get('cart-amount'); + + if ($cartAmount < 0 || $cartAmount === '') { + $cartAmount = null; + } + + $aeraQuery = AreaQuery::create()->findOneById($colissimo_pickup_area_id); + if (null === $aeraQuery) { + return null; + } + + $colissimoPickupPointAreaFreeshippingQuery = ColissimoPickupPointAreaFreeshippingQuery::create() + ->filterByAreaId($colissimo_pickup_area_id) + ->findOne(); + + if (null === $colissimoPickupPointAreaFreeshippingQuery) { + $colissimoPickupPointFreeShipping = new ColissimoPickupPointAreaFreeshipping(); + + $colissimoPickupPointFreeShipping + ->setAreaId($colissimo_pickup_area_id) + ->setCartAmount($cartAmount) + ->save(); + } + + $cartAmountQuery = ColissimoPickupPointAreaFreeshippingQuery::create() + ->filterByAreaId($colissimo_pickup_area_id) + ->findOneOrCreate() + ->setCartAmount($cartAmount) + ->save(); + + } catch (\Exception $e) { + } + + return $this->generateRedirectFromRoute( + 'admin.module.configure', + array(), + array( + 'current_tab' => 'prices_slices_tab', + 'module_code' => 'ColissimoPickupPoint', + '_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction', + 'price_error_id' => null, + 'price_error' => null + ) + ); + } +} diff --git a/local/modules/ColissimoPickupPoint/Controller/GetSpecificLocation.php b/local/modules/ColissimoPickupPoint/Controller/GetSpecificLocation.php new file mode 100755 index 00000000..2b38ac51 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Controller/GetSpecificLocation.php @@ -0,0 +1,106 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Controller; + +use ColissimoPickupPoint\ColissimoPickupPoint; +use ColissimoPickupPoint\WebService\FindById; +use Exception; +use Symfony\Component\HttpFoundation\JsonResponse; +use Thelia\Controller\Front\BaseFrontController; +use Thelia\Core\HttpFoundation\Response; +use Thelia\Core\Template\ParserInterface; +use Thelia\Core\Template\TemplateDefinition; +use Thelia\Model\ConfigQuery; + +/** + * Class SearchCityController + * @package IciRelais\Controller + * @author Thelia + */ +class GetSpecificLocation extends BaseFrontController +{ + public function get($countryid, $zipcode, $city, $address="") + { + $content = $this->renderRaw( + 'getSpecificLocationColissimoPickupPoint', + array( + '_countryid_' => $countryid, + '_zipcode_' => $zipcode, + '_city_' => $city, + '_address_' => $address + ) + ); + $response = new Response($content, 200, $headers = array('Content-Type' => 'application/json')); + + return $response; + } + + public function getPointInfo($point_id) + { + $req = new FindById(); + + $req->setId($point_id) + ->setLangue('FR') + ->setDate(date('d/m/Y')) + ->setAccountNumber(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME)) + ->setPassword(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD)) + ; + + $response = $req->exec(); + + $response = new JsonResponse($response); + + return $response; + } + + public function search() + { + $countryid = $this->getRequest()->query->get('countryid'); + $zipcode = $this->getRequest()->query->get('zipcode'); + $city = $this->getRequest()->query->get('city'); + $addressId = $this->getRequest()->query->get('address'); + + return $this->get($countryid, $zipcode, $city, $addressId); + } + + /** + * @param null $template + * @return ParserInterface instance parser + * @throws Exception + */ + protected function getParser($template = null) + { + $parser = $this->container->get('thelia.parser'); + + // Define the template that should be used + $parser->setTemplateDefinition( + new TemplateDefinition( + 'default', + TemplateDefinition::FRONT_OFFICE + ) + ); + + return $parser; + } +} diff --git a/local/modules/ColissimoPickupPoint/Controller/ImportController.php b/local/modules/ColissimoPickupPoint/Controller/ImportController.php new file mode 100644 index 00000000..9781d8da --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Controller/ImportController.php @@ -0,0 +1,129 @@ + + */ +class ImportController extends BaseAdminController +{ + public function importAction() + { + $i = 0; + + $con = Propel::getWriteConnection(OrderTableMap::DATABASE_NAME); + $con->beginTransaction(); + + $form = $this->createForm('colissimo.pickup.point.import'); + + try { + $vForm = $this->validateForm($form); + + // Get file + $importedFile = $vForm->getData()['import_file']; + + // Check extension + if (strtolower($importedFile->getClientOriginalExtension()) !='csv') { + throw new FormValidationException( + Translator::getInstance()->trans('Bad file format. CSV expected.', + [], + ColissimoPickupPoint::DOMAIN) + ); + } + + $csvData = file_get_contents($importedFile); + $lines = explode(PHP_EOL, $csvData); + + // For each line, parse columns + foreach ($lines as $line) { + $parsedLine = str_getcsv($line, ";"); + + // Get delivery and order ref + $deliveryRef = $parsedLine[ColissimoPickupPoint::IMPORT_DELIVERY_REF_COL]; + $orderRef = $parsedLine[ColissimoPickupPoint::IMPORT_ORDER_REF_COL]; + + // Save delivery ref if there is one + if (!empty($deliveryRef)) { + $this->importDeliveryRef($deliveryRef, $orderRef, $i); + } + } + + $con->commit(); + + // Get number of affected rows to display + $this->getSession()->getFlashBag()->add( + 'import-result', + Translator::getInstance()->trans( + 'Operation successful. %i orders affected.', + ['%i' => $i], + ColissimoPickupPoint::DOMAIN + ) + ); + + // Redirect + return $this->generateRedirect(URL::getInstance()->absoluteUrl($form->getSuccessUrl(), ['current_tab' => 'import'])); + } catch (FormValidationException $e) { + $con->rollback(); + + $this->setupFormErrorContext(null, $e->getMessage(), $form); + + return $this->render( + 'module-configure', + [ + 'module_code' => ColissimoPickupPoint::getModuleCode(), + 'current_tab' => 'import' + ] + ); + } + } + + /** + * Update order's delivery ref + * + * @param string $deliveryRef + * @param string $orderRef + * @param int $i + * @throws PropelException + */ + public function importDeliveryRef($deliveryRef, $orderRef, &$i) + { + // Check if the order exists + if (null !== $order = OrderQuery::create()->findOneByRef($orderRef)) { + $event = new OrderEvent($order); + + // Check if delivery refs are different + if ($order->getDeliveryRef() != $deliveryRef) { + $event->setDeliveryRef($deliveryRef); + $this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_DELIVERY_REF, $event); + + $sentStatusId = OrderStatusQuery::create() + ->filterByCode('sent') + ->select('ID') + ->findOne(); + + // Set 'sent' order status if not already sent + if ($sentStatusId != null && $order->getStatusId() != $sentStatusId) { + $event->setStatus($sentStatusId); + $this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event); + } + + $i++; + } + } + } +} diff --git a/local/modules/ColissimoPickupPoint/Controller/SaveConfig.php b/local/modules/ColissimoPickupPoint/Controller/SaveConfig.php new file mode 100755 index 00000000..db5d1839 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Controller/SaveConfig.php @@ -0,0 +1,51 @@ +checkAuth(array(AdminResources::MODULE), array('ColissimoPickupPoint'), AccessManager::UPDATE)) { + return $response; + } + + $form = new ConfigureColissimoPickupPoint($this->getRequest()); + try { + $vform = $this->validateForm($form); + + ColissimoPickupPoint::setConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME, $vform->get(ColissimoPickupPoint::COLISSIMO_USERNAME)->getData()); + ColissimoPickupPoint::setConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD, $vform->get(ColissimoPickupPoint::COLISSIMO_PASSWORD)->getData()); + ColissimoPickupPoint::setConfigValue(ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY, $vform->get(ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY)->getData()); + ColissimoPickupPoint::setConfigValue(ColissimoPickupPoint::COLISSIMO_ENDPOINT, $vform->get(ColissimoPickupPoint::COLISSIMO_ENDPOINT)->getData()); + + return $this->generateRedirect( + URL::getInstance()->absoluteUrl('/admin/module/ColissimoPickupPoint', ['current_tab' => 'configure']) + ); + } catch (\Exception $e) { + $this->setupFormErrorContext( + Translator::getInstance()->trans('Colissimo Pickup Point update config'), + $e->getMessage(), + $form, + $e + ); + + return $this->render( + 'module-configure', + [ + 'module_code' => 'ColissimoPickupPoint', + 'current_tab' => 'configure', + ] + ); + } + } +} diff --git a/local/modules/ColissimoPickupPoint/Controller/SliceController.php b/local/modules/ColissimoPickupPoint/Controller/SliceController.php new file mode 100644 index 00000000..dd7ca419 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Controller/SliceController.php @@ -0,0 +1,180 @@ +checkAuth(array(AdminResources::MODULE), ['ColissimoPickupPoint'], AccessManager::UPDATE)) { + return $response; + } + + $this->checkXmlHttpRequest(); + + $responseData = [ + 'success' => false, + 'message' => '', + 'slice' => null + ]; + + $messages = []; + $response = null; + + try { + $requestData = $this->getRequest()->request; + + if (0 !== $id = (int)$requestData->get('id', 0)) { + $slice = ColissimoPickupPointPriceSlicesQuery::create()->findPk($id); + } else { + $slice = new ColissimoPickupPointPriceSlices(); + } + + + if (0 !== $areaId = (int)$requestData->get('area', 0)) { + $slice->setAreaId($areaId); + } else { + $messages[] = $this->getTranslator()->trans( + 'The area is not valid', + [], + ColissimoPickupPoint::DOMAIN + ); + } + + $requestPriceMax = $requestData->get('priceMax', null); + $requestWeightMax = $requestData->get('weightMax', null); + + if (empty($requestPriceMax) && empty($requestWeightMax)) { + $messages[] = $this->getTranslator()->trans( + 'You must specify at least a price max or a weight max value.', + [], + ColissimoPickupPoint::DOMAIN + ); + } else { + if (!empty($requestPriceMax)) { + $priceMax = $this->getFloatVal($requestPriceMax); + if (0 < $priceMax) { + $slice->setPriceMax($priceMax); + } else { + $messages[] = $this->getTranslator()->trans( + 'The price max value is not valid', + [], + ColissimoPickupPoint::DOMAIN + ); + } + } else { + $slice->setPriceMax(null); + } + + if (!empty($requestWeightMax)) { + $weightMax = $this->getFloatVal($requestWeightMax); + if (0 < $weightMax) { + $slice->setWeightMax($weightMax); + } else { + $messages[] = $this->getTranslator()->trans( + 'The weight max value is not valid', + [], + ColissimoPickupPoint::DOMAIN + ); + } + } else { + $slice->setWeightMax(null); + } + } + + + + $price = $this->getFloatVal($requestData->get('price', 0)); + if (0 <= $price) { + $slice->setPrice($price); + } else { + $messages[] = $this->getTranslator()->trans( + 'The price value is not valid', + [], + ColissimoPickupPoint::DOMAIN + ); + } + + if (0 === count($messages)) { + $slice->save(); + $messages[] = $this->getTranslator()->trans( + 'Your slice has been saved', + [], + ColissimoPickupPoint::DOMAIN + ); + + $responseData['success'] = true; + $responseData['slice'] = $slice->toArray(TableMap::TYPE_STUDLYPHPNAME); + } + } catch (\Exception $e) { + $message[] = $e->getMessage(); + } + + $responseData['message'] = $messages; + + return $this->jsonResponse(json_encode($responseData)); + } + + protected function getFloatVal($val, $default = -1) + { + if (preg_match("#^([0-9\.,]+)$#", $val, $match)) { + $val = $match[0]; + if (strstr($val, ",")) { + $val = str_replace(".", "", $val); + $val = str_replace(",", ".", $val); + } + $val = (float)$val; + + return $val; + } + + return $default; + } + + public function deleteSliceAction() + { + $response = $this->checkAuth([], ['ColissimoPickupPoint'], AccessManager::DELETE); + + if (null !== $response) { + return $response; + } + + $this->checkXmlHttpRequest(); + + $responseData = [ + 'success' => false, + 'message' => '', + 'slice' => null + ]; + + $response = null; + + try { + $requestData = $this->getRequest()->request; + + if (0 !== $id = (int)$requestData->get('id', 0)) { + $slice = ColissimoPickupPointPriceSlicesQuery::create()->findPk($id); + $slice->delete(); + $responseData['success'] = true; + } else { + $responseData['message'] = $this->getTranslator()->trans( + 'The slice has not been deleted', + [], + ColissimoPickupPoint::DOMAIN + ); + } + } catch (\Exception $e) { + $responseData['message'] = $e->getMessage(); + } + + return $this->jsonResponse(json_encode($responseData)); + } +} diff --git a/local/modules/ColissimoPickupPoint/Form/AddPriceForm.php b/local/modules/ColissimoPickupPoint/Form/AddPriceForm.php new file mode 100644 index 00000000..0a7d3d51 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Form/AddPriceForm.php @@ -0,0 +1,85 @@ +formBuilder + ->add('area', 'integer', array( + 'constraints' => array( + new Constraints\NotBlank(), + new Constraints\Callback(array( + 'methods' => array( + array($this, + 'verifyAreaExist') + ) + )) + ) + )) + ->add('weight', 'number', array( + 'constraints' => array( + new Constraints\NotBlank(), + new Constraints\Callback(array( + 'methods' => array( + array($this, + 'verifyValidWeight') + ) + )) + ) + )) + ->add('price', 'number', array( + 'constraints' => array( + new Constraints\NotBlank(), + new Constraints\Callback(array( + 'methods' => array( + array($this, + 'verifyValidPrice') + ) + )) + ) + )) + ->add('franco', 'number', array()) + ; + } + + public function verifyAreaExist($value, ExecutionContextInterface $context) + { + $area = AreaQuery::create()->findPk($value); + if (null === $area) { + $context->addViolation(Translator::getInstance()->trans("This area doesn't exists.", [], ColissimoPickupPoint::DOMAIN)); + } + } + + public function verifyValidWeight($value, ExecutionContextInterface $context) + { + if (!preg_match("#^\d+\.?\d*$#", $value)) { + $context->addViolation(Translator::getInstance()->trans("The weight value is not valid.", [], ColissimoPickupPoint::DOMAIN)); + } + + if ($value < 0) { + $context->addViolation(Translator::getInstance()->trans("The weight value must be superior to 0.", [], ColissimoPickupPoint::DOMAIN)); + } + } + + public function verifyValidPrice($value, ExecutionContextInterface $context) + { + if (!preg_match("#^\d+\.?\d*$#", $value)) { + $context->addViolation(Translator::getInstance()->trans("The price value is not valid.", [], ColissimoPickupPoint::DOMAIN)); + } + } + + public function getName() + { + return 'colissimo_pickup_point_price_slices_create'; + } +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/Form/ConfigureColissimoPickupPoint.php b/local/modules/ColissimoPickupPoint/Form/ConfigureColissimoPickupPoint.php new file mode 100755 index 00000000..b759f881 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Form/ConfigureColissimoPickupPoint.php @@ -0,0 +1,121 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Form; + +use ColissimoPickupPoint\ColissimoPickupPoint; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Validator\Constraints\Url; +use Thelia\Core\Translation\Translator; +use Thelia\Form\BaseForm; +use Thelia\Model\ConfigQuery; + +/** + * Class ConfigureColissimoPickupPoint + * @package ColissimoPickupPoint\Form + * @author Thelia + */ +class ConfigureColissimoPickupPoint extends BaseForm +{ + /** + * + * in this function you add all the fields you need for your Form. + * Form this you have to call add method on $this->formBuilder attribute : + * + * $this->formBuilder->add("name", "text") + * ->add("email", "email", array( + * "attr" => array( + * "class" => "field" + * ), + * "label" => "email", + * "constraints" => array( + * new \Symfony\Component\Validator\Constraints\NotBlank() + * ) + * ) + * ) + * ->add('age', 'integer'); + * + * @return null + */ + protected function buildForm() + { + $translator = Translator::getInstance(); + $this->formBuilder + ->add( + ColissimoPickupPoint::COLISSIMO_USERNAME, + TextType::class, + [ + 'constraints' => [new NotBlank()], + 'data' => ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME), + 'label' => $translator->trans('Account number', [], ColissimoPickupPoint::DOMAIN), + 'label_attr' => ['for' => ColissimoPickupPoint::COLISSIMO_USERNAME] + ] + ) + ->add( + ColissimoPickupPoint::COLISSIMO_PASSWORD, + TextType::class, + [ + 'constraints' => [new NotBlank()], + 'data' => ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD), + 'label' => $translator->trans('Password', [], ColissimoPickupPoint::DOMAIN), + 'label_attr' => ['for' => ColissimoPickupPoint::COLISSIMO_PASSWORD] + ] + ) + ->add( + ColissimoPickupPoint::COLISSIMO_ENDPOINT, + TextType::class, + [ + 'constraints' => [ + new NotBlank(), + new Url([ + 'protocols' => ['https', 'http'] + ]) + ], + 'data' => ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_ENDPOINT), + 'label' => $translator->trans('Colissimo URL prod', [], ColissimoPickupPoint::DOMAIN), + 'label_attr' => ['for' => ColissimoPickupPoint::COLISSIMO_ENDPOINT] + ] + ) + ->add( + ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY, + TextType::class, + [ + 'constraints' => [], + 'data' => ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY), + 'label' => $translator->trans('Google map API key', [], ColissimoPickupPoint::DOMAIN), + 'label_attr' => ['for' => ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY] + ] + ) + ; + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return 'configurecolissimopickuppoint'; + } +} diff --git a/local/modules/ColissimoPickupPoint/Form/ExportOrder.php b/local/modules/ColissimoPickupPoint/Form/ExportOrder.php new file mode 100755 index 00000000..46ec31f9 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Form/ExportOrder.php @@ -0,0 +1,121 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Form; +use Propel\Runtime\ActiveQuery\Criteria; +use ColissimoPickupPoint\ColissimoPickupPoint; +use Thelia\Form\BaseForm; +use Thelia\Model\Base\OrderQuery; +use Thelia\Core\Translation\Translator; +use Thelia\Model\Order; +use Thelia\Model\OrderStatusQuery; +use Thelia\Model\OrderStatus; + +/** + * Class ExportOrder + * @package ColissimoPickupPoint\Form + * @author Thelia + */ +class ExportOrder extends BaseForm +{ + /** + * + * in this function you add all the fields you need for your Form. + * Form this you have to call add method on $this->formBuilder attribute : + * + * $this->formBuilder->add("name", "text") + * ->add("email", "email", array( + * "attr" => array( + * "class" => "field" + * ), + * "label" => "email", + * "constraints" => array( + * new \Symfony\Component\Validator\Constraints\NotBlank() + * ) + * ) + * ) + * ->add('age', 'integer'); + * + * @return null + */ + protected function buildForm() + { + $status = OrderStatusQuery::create() + ->filterByCode( + array( + OrderStatus::CODE_PAID, + OrderStatus::CODE_PROCESSING, + OrderStatus::CODE_SENT + ), + Criteria::IN + ) + ->find() + ->toArray('code') + ; + $query = OrderQuery::create() + ->filterByDeliveryModuleId(ColissimoPickupPoint::getModCode()) + ->filterByStatusId(array($status['paid']['Id'], $status['processing']['Id']), Criteria::IN) + ->find(); + + $this->formBuilder + ->add('new_status_id', 'choice',array( + 'label' => Translator::getInstance()->trans('server'), + 'choices' => array( + 'nochange' => Translator::getInstance()->trans('Do not change'), + 'processing' => Translator::getInstance()->trans('Set orders status as processing'), + 'sent' => Translator::getInstance()->trans('Set orders status as sent') + ), + 'required' => 'true', + 'expanded' => true, + 'multiple' => false, + 'data' => 'nochange' + ) + ); + /** @var Order $order */ + foreach ($query as $order) { + $this->formBuilder + ->add( + 'order_' . $order->getId(), + 'checkbox', + [ + 'label' => $order->getRef(), + 'label_attr' => ['for' => 'export_' . $order->getId()] + ] + ) + ->add( + 'order_weight_' . $order->getId(), + 'number' + ) + ; + } + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return 'exportcolissimopickuppointorder'; + } + +} diff --git a/local/modules/ColissimoPickupPoint/Form/FreeShippingForm.php b/local/modules/ColissimoPickupPoint/Form/FreeShippingForm.php new file mode 100755 index 00000000..d7821b7d --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Form/FreeShippingForm.php @@ -0,0 +1,88 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Form; + +use ColissimoPickupPoint\ColissimoPickupPoint; +use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\Extension\Core\Type\NumberType; +use Thelia\Core\Translation\Translator; +use Thelia\Form\BaseForm; + +class FreeShippingForm extends BaseForm +{ + /** + * + * in this function you add all the fields you need for your Form. + * Form this you have to call add method on $this->formBuilder attribute : + * + * $this->formBuilder->add("name", "text") + * ->add("email", "email", array( + * "attr" => array( + * "class" => "field" + * ), + * "label" => "email", + * "constraints" => array( + * new \Symfony\Component\Validator\Constraints\NotBlank() + * ) + * ) + * ) + * ->add('age', 'integer'); + * + * @return null + */ + protected function buildForm() + { + $this->formBuilder + ->add( + 'freeshipping', + CheckboxType::class, + [ + 'label' => Translator::getInstance()->trans('Activate free shipping: ', [], ColissimoPickupPoint::DOMAIN) + ] + ) + ->add( + 'freeshipping_from', + NumberType::class, + [ + 'required' => false, + 'label' => Translator::getInstance()->trans("Free shipping from: ", [], ColissimoPickupPoint::DOMAIN), + 'data' => ColissimoPickupPointFreeshippingQuery::create()->findOneById(1)->getFreeshippingFrom(), + 'scale' => 2, + ] + ) + + ; + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return 'colissimopickuppointfreeshipping'; + } + +} diff --git a/local/modules/ColissimoPickupPoint/Form/ImportForm.php b/local/modules/ColissimoPickupPoint/Form/ImportForm.php new file mode 100644 index 00000000..cf0c02d9 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Form/ImportForm.php @@ -0,0 +1,37 @@ + + */ +class ImportForm extends BaseForm +{ + public function getName() + { + return 'import_form'; + } + + protected function buildForm() + { + $this->formBuilder + ->add( + 'import_file', 'file', + [ + 'label' => Translator::getInstance()->trans('Select file to import', [], ColissimoPickupPoint::DOMAIN), + 'constraints' => [ + new Constraints\NotBlank(), + new Constraints\File(['mimeTypes' => ['text/csv', 'text/plain']]) + ], + 'label_attr' => ['for' => 'import_file'] + ] + ); + } +} diff --git a/local/modules/ColissimoPickupPoint/Form/UpdatePriceForm.php b/local/modules/ColissimoPickupPoint/Form/UpdatePriceForm.php new file mode 100644 index 00000000..b50398e5 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Form/UpdatePriceForm.php @@ -0,0 +1,68 @@ +formBuilder + ->add('area', 'integer', array( + 'constraints' => array( + new Constraints\NotBlank(), + new Constraints\Callback(array( + 'methods' => array( + array($this, + 'verifyAreaExist') + ) + )) + ) + )) + ->add('weight', 'number', array( + 'constraints' => array( + new Constraints\NotBlank(), + ) + )) + ->add('price', 'number', array( + 'constraints' => array( + new Constraints\NotBlank(), + new Constraints\Callback(array( + 'methods' => array( + array($this, + 'verifyValidPrice') + ) + )) + ) + )) + ->add('franco', 'number', array()) + ; + } + + public function verifyAreaExist($value, ExecutionContextInterface $context) + { + $area = AreaQuery::create()->findPk($value); + if (null === $area) { + $context->addViolation(Translator::getInstance()->trans("This area doesn't exists.", [], ColissimoPickupPoint::DOMAIN)); + } + } + + public function verifyValidPrice($value, ExecutionContextInterface $context) + { + if (!preg_match("#^\d+\.?\d*$#", $value)) { + $context->addViolation(Translator::getInstance()->trans('The price value is not valid.', [], ColissimoPickupPoint::DOMAIN)); + } + } + + public function getName() + { + return 'colissimo_pickup_point_price_slices_create'; + } +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/Format/CSV.php b/local/modules/ColissimoPickupPoint/Format/CSV.php new file mode 100755 index 00000000..a54adf6f --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Format/CSV.php @@ -0,0 +1,99 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Format; + +/** + * Class CSV + * @package ColissimoPickupPoint\Format + * @author Thelia + */ +class CSV +{ + protected $separator; + protected $lines=array(); + + const CRLF = "\r\n"; + /** + * @param $separator + * @param array $lines + */ + public function __construct($separator, array $lines=array()) + { + $this->separator = $separator; + + foreach ($lines as $line) { + if ($line instanceof CSVLine) { + $this->addLine($line); + } + } + } + + /** + * @param $separator + * @param array $lines + * @return CSV + */ + public static function create($separator, array $lines=array()) + { + return new static($separator, $lines); + } + + /** + * @param CSVLine $line + * @return $this + */ + public function addLine(CSVLine $line) + { + $this->lines[] = $line; + + return $this; + } + + /** + * @return string parsed CSV + */ + public function parse() + { + $buffer = ''; + + for ($j=0; $j < ($lineslen = count($this->lines)); ++$j) { + /** @var CSVLine $line */ + $line = $this->lines[$j]; + $aline = $line->getValues(); + + for ($i=0; $i < ($linelen = count($aline)); ++$i) { + $buffer .= '"' . $aline[$i] . '"'; + + if ($i !== $linelen-1) { + $buffer .= $this->separator; + } + } + if ($j !== $lineslen - 1) { + $buffer .= self::CRLF; + } + } + + return $buffer; + } +} diff --git a/local/modules/ColissimoPickupPoint/Format/CSVLine.php b/local/modules/ColissimoPickupPoint/Format/CSVLine.php new file mode 100755 index 00000000..90754347 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Format/CSVLine.php @@ -0,0 +1,67 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Format; + +/** + * Class CSVLine + * @package ColissimoPickupPoint\Format + * @author Thelia + */ +class CSVLine +{ + protected $values = array(); + + public function __construct(array $values) + { + $this->values = $values; + } + + /** + * @param array $values + * @return CSVLine + */ + public static function create(array $values) + { + return new static($values); + } + + /** + * @return array + */ + public function getValues() + { + return $this->values; + } + + /** + * @param $value + * @return $this + */ + public function addValue($value) + { + $this->values[] = $value; + + return $this; + } +} diff --git a/local/modules/ColissimoPickupPoint/Hook/BackHook.php b/local/modules/ColissimoPickupPoint/Hook/BackHook.php new file mode 100644 index 00000000..3533cb35 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Hook/BackHook.php @@ -0,0 +1,23 @@ +add($this->render('module_configuration.html')); + } + + public function onModuleConfigJs(HookRenderEvent $event) + { + $event->add($this->render('module-config-js.html')); + } +} diff --git a/local/modules/ColissimoPickupPoint/Hook/FrontHook.php b/local/modules/ColissimoPickupPoint/Hook/FrontHook.php new file mode 100644 index 00000000..0676db0d --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Hook/FrontHook.php @@ -0,0 +1,41 @@ + + */ +class FrontHook extends BaseHook { + public function onOrderDeliveryExtra(HookRenderEvent $event) + { + $content = $this->render('colissimo-pickup-point.html', $event->getArguments()); + $event->add($content); + } + + public function onOrderInvoiceDeliveryAddress(HookRenderEvent $event) + { + $content = $this->render('delivery-address.html', $event->getArguments()); + $event->add($content); + } + + public function onMainHeadBottom(HookRenderEvent $event) + { + $content = $this->addCSS('assets/css/styles.css'); + $event->add($content); + } +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/Hook/PdfHook.php b/local/modules/ColissimoPickupPoint/Hook/PdfHook.php new file mode 100644 index 00000000..3361707b --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Hook/PdfHook.php @@ -0,0 +1,38 @@ +getArgument('module_id')) { + return; + } + + $order = OrderQuery::create()->findOneById($event->getArgument('order')); + + if (!is_null($order)) { + $event->add($this->render( + 'delivery_mode_infos.html', + ['delivery_address_id' => $order->getDeliveryOrderAddressId()] + )); + } + } +} diff --git a/local/modules/ColissimoPickupPoint/I18n/AdminIncludes/en_US.php b/local/modules/ColissimoPickupPoint/I18n/AdminIncludes/en_US.php new file mode 100644 index 00000000..9944984f --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/AdminIncludes/en_US.php @@ -0,0 +1,6 @@ + 'Export', + 'Export Coliship file' => 'Export Coliship file', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/AdminIncludes/fr_FR.php b/local/modules/ColissimoPickupPoint/I18n/AdminIncludes/fr_FR.php new file mode 100755 index 00000000..fd8ed53b --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/AdminIncludes/fr_FR.php @@ -0,0 +1,6 @@ + 'Export', + 'Export Coliship file' => 'Export de fichier Coliship', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/backOffice/default/en_US.php b/local/modules/ColissimoPickupPoint/I18n/backOffice/default/en_US.php new file mode 100644 index 00000000..44e8f8d7 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/backOffice/default/en_US.php @@ -0,0 +1,51 @@ + '*If you choose this option, the exported orders would not be available on this page anymore', + 'Actions' => 'Actions', + 'Activate free shipping from (€) :' => 'Activate free shipping from (€) :', + 'Activate total free shipping ' => 'Activate total free shipping ', + 'Add this price slice' => 'Add this price slice', + 'Advanced configuration' => 'Advanced configuration', + 'An error occured' => 'An error occured', + 'Area : ' => 'Area : ', + 'Change orders status after export' => 'Change orders status after export', + 'Check all' => 'Check all', + 'Customer' => 'Customer', + 'Date' => 'Date', + 'Delete this price slice' => 'Delete this price slice', + 'Do not change' => 'Do not change', + 'Export' => 'Export', + 'Export Coliship file' => 'Export Coliship file', + 'If a cart matches multiple slices, it will take the last slice following that order.' => 'If a cart matches multiple slices, it will take the last slice following that order.', + 'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.' => 'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.', + 'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.' => 'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.', + 'If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice.' => 'If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice.', + 'Import Coliship file' => 'Import Coliship file', + 'Message' => 'Message', + 'Only use this for compatibility reason or if you have no other choice. For domicile delivery, you should use ColissimoWs instead.' => 'Only use this for compatibility reason or if you have no other choice. For domicile delivery, you should use ColissimoWs instead.', + 'Or activate free shipping from (€) :' => 'Or activate free shipping from (€) :', + 'Package weight' => 'Package weight', + 'Please change the access rights' => 'Please change the access rights', + 'Price (%symbol)' => 'Price (%symbol)', + 'Price slices for "%mode"' => 'Price slices for "%mode"', + 'Processing' => 'Processing', + 'REF' => 'REF', + 'Reverse selection' => 'Reverse selection', + 'Save' => 'Save', + 'Save changes' => 'Save changes', + 'Save this price slice' => 'Save this price slice', + 'Sent' => 'Sent', + 'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.' => 'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.', + 'The slices are ordered by maximum cart weight then by maximum cart price.' => 'The slices are ordered by maximum cart weight then by maximum cart price.', + 'Total taxed amount' => 'Total taxed amount', + 'Uncheck all' => 'Uncheck all', + 'Unknown customer' => 'Unknown customer', + 'Untaxed Price up to ... %symbol' => 'Untaxed Price up to ... %symbol', + 'Upload' => 'Upload', + 'Weight up to ... kg' => 'Weight up to ... kg', + 'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.' => 'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.', + 'You should first attribute shipping zones to the modules: ' => 'You should first attribute shipping zones to the modules: ', + 'manage shipping zones' => 'manage shipping zones', + 'operations' => 'operations', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/backOffice/default/fr_FR.php b/local/modules/ColissimoPickupPoint/I18n/backOffice/default/fr_FR.php new file mode 100644 index 00000000..8b65f350 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/backOffice/default/fr_FR.php @@ -0,0 +1,51 @@ + '* Si vous choisissez cette option, les commandes exportées n\'apparaitront plus dans cette page', + 'Actions' => 'Actions', + 'Activate free shipping from (€) :' => 'Activer les frais de port gratuits à partir de (€)', + 'Activate total free shipping ' => 'Activer les frais de port gratuits', + 'Add this price slice' => 'Ajouter cette tranche de prix', + 'Advanced configuration' => 'Configuration avancée', + 'An error occured' => 'Une erreur est survenue', + 'Area : ' => 'Zone :', + 'Change orders status after export' => 'Modifier le statut des commandes après l\'export', + 'Check all' => 'Tout cocher', + 'Customer' => 'Client', + 'Date' => 'Date', + 'Delete this price slice' => 'Supprimer cette tranche de prix', + 'Do not change' => 'Ne pas modifier', + 'Export' => 'Export', + 'Export Coliship file' => 'Export de fichier Coliship', + 'If a cart matches multiple slices, it will take the last slice following that order.' => 'Si un panier correspond à plusieurs tranches, la dernière tranche sera prise en compte selon cet ordre.', + 'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.' => 'Si vous ne renseignez pas de prix de panier max dans une tranche, elle aura la priorité sur les autres tranches ayant le même poids.', + 'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.' => 'Si vous ne renseignez pas de poids max dans une tranche, elle aura la priorité sur les tranches ayant un poids.', + 'If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice.' => 'Si vous renseignez les deux, le panier devra avoir à la fois un poids inférieur ET un prix inférieur pour correspondre à cette tranche.', + 'Import Coliship file' => 'Import de fichier Coliship', + 'Message' => 'Message', + 'Only use this for compatibility reason or if you have no other choice. For domicile delivery, you should use ColissimoWs instead.' => 'N\'utilisez ceci que pour des raisons de compatibilité ou si vous n\'avez pas d\'autres choix. Pour la livraison à domicile, utilisez plutôt désormais le module ColissimoWs', + 'Or activate free shipping from (€) :' => 'Ou activer les frais de port gratuits à partir de (€)', + 'Package weight' => 'Poids des colis (kg)', + 'Please change the access rights' => 'Merci de modifier les droits d\'accès', + 'Price (%symbol)' => 'Frais de livraison (%symbol)', + 'Price slices for "%mode"' => 'Tranche de prix pour "%mode"', + 'Processing' => 'En cours', + 'REF' => 'REF', + 'Reverse selection' => 'Inverser la sélection', + 'Save' => 'Sauvegarder', + 'Save changes' => 'Enregistrer les modifications', + 'Save this price slice' => 'Enregistrer cette tranche de prix', + 'Sent' => 'Envoyé', + 'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.' => 'Le fichier doit être au format CSV et contenir 2 colonnes. La première indique les références colis, la seconde les références des commandes.', + 'The slices are ordered by maximum cart weight then by maximum cart price.' => 'Les tranches sont triés pour poids de panier max puis par prix de panier max.', + 'Total taxed amount' => 'Montant total (avec taxes)', + 'Uncheck all' => 'Tout décocher', + 'Unknown customer' => 'Client inconnu', + 'Untaxed Price up to ... %symbol' => 'Prix HT max du panier (%symbol)', + 'Upload' => 'Charger le fichier', + 'Weight up to ... kg' => 'Poids maximum (kg)', + 'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.' => 'Vous pouvez créer des tranches de prix pour les frais de port en spécifiant un poids de panier maximum et/ou un prix de panier maximum.', + 'You should first attribute shipping zones to the modules: ' => 'Vous devez d\'abord attribuer des zones de livraison à ce module :', + 'manage shipping zones' => 'Configurer les zones de livraison', + 'operations' => 'Opérations', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/en_US.php b/local/modules/ColissimoPickupPoint/I18n/en_US.php new file mode 100644 index 00000000..2204e8c3 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/en_US.php @@ -0,0 +1,34 @@ + 'Account number', + 'Activate free shipping: ' => 'Activate free shipping: ', + 'Bad file format. CSV expected.' => 'Bad file format. CSV expected.', + 'Can\'t read Config directory' => 'Can\'t read Config directory', + 'Can\'t read file' => 'Can\'t read file', + 'Colissimo URL prod' => 'Colissimo URL prod', + 'Do not change' => 'Do not change', + 'Google map API key' => 'Google map API key', + 'No relay points were selected' => 'No relay points were selected', + 'Operation successful. %i orders affected.' => 'Operation successful. %i orders affected.', + 'Password' => 'Password', + 'Select file to import' => 'Select file to import', + 'Set orders status as processing' => 'Set orders status as processing', + 'Set orders status as sent' => 'Set orders status as sent', + 'So Colissimo update config' => 'So Colissimo update config', + 'The area is not valid' => 'The area is not valid', + 'The delivery mode is not valid' => 'The delivery mode is not valid', + 'The price max value is not valid' => 'The price max value is not valid', + 'The price value is not valid' => 'The price value is not valid', + 'The price value is not valid.' => 'The price value is not valid.', + 'The slice has not been deleted' => 'The slice has not been deleted', + 'The weight max value is not valid' => 'The weight max value is not valid', + 'The weight value is not valid.' => 'The weight value is not valid.', + 'The weight value must be superior to 0.' => 'The weight value must be superior to 0.', + 'This area doesn\'t exists.' => 'This area doesn\'t exists.', + 'This delivery mode doesn\'t exists.' => 'This delivery mode doesn\'t exists.', + 'You must specify at least a price max or a weight max value.' => 'You must specify at least a price max or a weight max value.', + 'Your slice has been saved' => 'Your slice has been saved', + '[DEPRECATED] Activate Dom delivery' => '[DEPRECATED] Activate Dom delivery', + 'server' => 'server', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/fr_FR.php b/local/modules/ColissimoPickupPoint/I18n/fr_FR.php new file mode 100755 index 00000000..db0c01fe --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/fr_FR.php @@ -0,0 +1,34 @@ + 'Numéro de compte', + 'Activate free shipping: ' => 'Livraison offerte: ', + 'Bad file format. CSV expected.' => 'Mauvais format de fichier. CSV attendu.', + 'Can\'t read Config directory' => 'Le dossier Config ne peut être lu', + 'Can\'t read file' => 'Le fichier suivant ne peut être lu', + 'Colissimo URL prod' => 'URL de Colissimo en production', + 'Do not change' => 'Ne pas changer', + 'Google map API key' => 'Clé API Google map', + 'No relay points were selected' => 'Aucun point relais n\'a été sélectionné', + 'Operation successful. %i orders affected.' => 'Opération effectuée avec succès. %i commandes affectées.', + 'Password' => 'Mot de passe', + 'Select file to import' => 'Sélectionner un fichier à importer', + 'Set orders status as processing' => 'En traitement', + 'Set orders status as sent' => 'Envoyée', + 'So Colissimo update config' => 'Mise à jour de la configuration de So Colissimo ', + 'The area is not valid' => 'La zone de livraison n\'est pas valide.', + 'The delivery mode is not valid' => 'Le mode de livraison n\'est pas valide.', + 'The price max value is not valid' => 'Le prix maximum n\'est pas valide.', + 'The price value is not valid' => 'Les frais de livraison ne sont pas valides.', + 'The price value is not valid.' => 'Le prix n\'est pas valide.', + 'The slice has not been deleted' => 'La tranche n\'a pas été supprimée.', + 'The weight max value is not valid' => 'Le poids maximum n\'est pas valide.', + 'The weight value is not valid.' => 'Le poids n\'est pas valide.', + 'The weight value must be superior to 0.' => 'Le poids doit être supérieur à 0.', + 'This area doesn\'t exists.' => 'Cette zone n\'existe pas.', + 'This delivery mode doesn\'t exists.' => 'Ce mode de livraison n\'existe pas.', + 'You must specify at least a price max or a weight max value.' => 'Vous devez spécifier au moins un prix maximum ou un poids maximum.', + 'Your slice has been saved' => 'Votre tranche a été enregistrée.', + '[DEPRECATED] Activate Dom delivery' => '[DEPRECIE] Activer la livraison à domicile', + 'server' => 'Serveur', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/frontOffice/default/en_US.php b/local/modules/ColissimoPickupPoint/I18n/frontOffice/default/en_US.php new file mode 100644 index 00000000..1cef33ba --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/frontOffice/default/en_US.php @@ -0,0 +1,33 @@ + 'Actual address can\'t be geolocated', + 'Automatic pickup point' => 'Automatic pickup point', + 'Choose this delivery mode' => 'Choose this delivery mode', + 'Colissimo is unavailable. Please choose another delivery method' => 'Colissimo is unavailable. Please choose another delivery method', + 'Delivery address' => 'Delivery address', + 'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.' => 'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.', + 'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.' => 'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.', + 'Delivery in one of the 7,500 shops in the PICKUP network.' => 'Delivery in one of the 7,500 shops in the PICKUP network.', + 'Delivery to you or a personal address of your choice.' => 'Delivery to you or a personal address of your choice.', + 'Friday' => 'Friday', + 'Monday' => 'Monday', + 'My home' => 'My home', + 'Near you' => 'Near you', + 'No relay points were selected' => 'No relay points were selected', + 'Pickup shop' => 'Pickup shop', + 'Please enter a city and a zipcode' => 'Please enter a city and a zipcode', + 'Post office' => 'Post office', + 'Saturday' => 'Saturday', + 'Search' => 'Search', + 'Search Colissimo relay in a city' => 'Search Colissimo relay in a city', + 'Sunday' => 'Sunday', + 'Thursday' => 'Thursday', + 'Tuesday' => 'Tuesday', + 'Wednesday' => 'Wednesday', + 'address' => 'address', + 'city' => 'city', + 'home delivery' => 'home delivery', + 'include in results' => 'include in results', + 'zipcode' => 'zipcode', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/frontOffice/default/fr_FR.php b/local/modules/ColissimoPickupPoint/I18n/frontOffice/default/fr_FR.php new file mode 100755 index 00000000..6b0699e0 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/frontOffice/default/fr_FR.php @@ -0,0 +1,33 @@ + 'Actual address can\'t be geolocated ', + 'Automatic pickup point' => 'En consigne Pickup Station', + 'Choose this delivery mode' => 'Choisir ce mode de livraison', + 'Colissimo is unavailable. Please choose another delivery method' => 'Colissimo est indisponible. Merci de choisir un autre moyen de livraison.', + 'Delivery address' => 'Adresse de livraison', + 'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.' => 'Livraison en France dans l’une des 500 consignes automatiques de retrait accessibles 7j/7 et 24h/24 (sauf consignes soumises aux horaires des galeries marchandes et zones de transports).', + 'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.' => 'Livraison dans l\'un des 10 000 points de retrait La Poste en France ou dans un bureau de poste à l\'étranger.', + 'Delivery in one of the 7,500 shops in the PICKUP network.' => 'Livraison dans l’un des 7500 commerçants de proximité du réseau Pickup.', + 'Delivery to you or a personal address of your choice.' => '

Livraison chez vous ou à une adresse personnelle de votre choix avec tentative de remise en mains propres ou en boîte aux lettres.

En cas d\'absence, remise en bureau de poste.

', + 'Friday' => 'Jeudi', + 'Monday' => 'Lundi', + 'My home' => 'Mon domicile', + 'Near you' => 'A proximité de chez vous', + 'No relay points were selected' => 'Aucun point relais n\'a été sélectionné', + 'Pickup shop' => 'En relais Pickup', + 'Please enter a city and a zipcode' => 'Merci de renseigner le code postal et la ville', + 'Post office' => 'En bureau de poste', + 'Saturday' => 'Samedi', + 'Search' => 'Rechercher', + 'Search Colissimo relay in a city' => 'Rechercher un point de retrait Colissimo dans une ville', + 'Sunday' => 'Dimanche', + 'Thursday' => 'Vendredi', + 'Tuesday' => 'Mardi', + 'Wednesday' => 'Mercredi', + 'address' => 'adresse', + 'city' => 'ville', + 'home delivery' => 'Livraison à domicile', + 'include in results' => 'inclure dans la recherche', + 'zipcode' => 'code postal', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/pdf/default/en_US.php b/local/modules/ColissimoPickupPoint/I18n/pdf/default/en_US.php new file mode 100644 index 00000000..75d92322 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/pdf/default/en_US.php @@ -0,0 +1,8 @@ + 'Delivered at a relay.', + 'Delivered at home.' => 'Delivered at home.', + 'Relay address:' => 'Relay address:', + 'no address' => 'no address', +); diff --git a/local/modules/ColissimoPickupPoint/I18n/pdf/default/fr_FR.php b/local/modules/ColissimoPickupPoint/I18n/pdf/default/fr_FR.php new file mode 100644 index 00000000..4e71ca3e --- /dev/null +++ b/local/modules/ColissimoPickupPoint/I18n/pdf/default/fr_FR.php @@ -0,0 +1,8 @@ + 'Livré en point relais.', + 'Delivered at home.' => 'Livré à domicile.', + 'Relay address:' => 'Adresse du point relais :', + 'no address' => 'Aucune adresse', +); diff --git a/local/modules/ColissimoPickupPoint/LICENSE.txt b/local/modules/ColissimoPickupPoint/LICENSE.txt new file mode 100644 index 00000000..65c5ca88 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/LICENSE.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/local/modules/ColissimoPickupPoint/Listener/APIListener.php b/local/modules/ColissimoPickupPoint/Listener/APIListener.php new file mode 100644 index 00000000..5ee4865f --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Listener/APIListener.php @@ -0,0 +1,162 @@ +getCountry()) { + $countryCode = $country->getIsoalpha2(); + } + + // Then ask the Web Service + $request = new FindByAddress(); + $request + ->setAddress($pickupLocationEvent->getAddress()) + ->setZipCode($pickupLocationEvent->getZipCode()) + ->setCity($pickupLocationEvent->getCity()) + ->setCountryCode($countryCode) + ->setFilterRelay('1') + ->setRequestId(md5(microtime())) + ->setLang('FR') + ->setOptionInter('1') + ->setShippingDate(date('d/m/Y')) + ->setAccountNumber(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME)) + ->setPassword(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD)) + ; + + try { + $responses = $request->exec(); + } catch (InvalidArgumentException $e) { + $responses = array(); + } catch (\SoapFault $e) { + $responses = array(); + } + + if (!is_array($responses) && $responses !== null) { + $newResponse[] = $responses; + $responses = $newResponse; + } + + return $responses; + } + + /** + * Creates and returns a new location address + * + * @param $response + * @return PickupLocationAddress + */ + protected function createPickupLocationAddressFromResponse($response) + { + /** We create the new location address */ + $pickupLocationAddress = new PickupLocationAddress(); + + /** We set the differents properties of the location address */ + $pickupLocationAddress + ->setId($response->identifiant) + ->setTitle($response->nom) + ->setAddress1($response->adresse1) + ->setAddress2($response->adresse2) + ->setAddress3($response->adresse3) + ->setCity($response->localite) + ->setZipCode($response->codePostal) + ->setPhoneNumber('') + ->setCellphoneNumber('') + ->setCompany('') + ->setCountryCode($response->codePays) + ->setFirstName('') + ->setLastName('') + ->setIsDefault(0) + ->setLabel('') + ->setAdditionalData([]) + ; + + return $pickupLocationAddress; + } + + /** + * Creates then returns a location from a response of the WebService + * + * @param $response + * @return PickupLocation + * @throws \Exception + */ + protected function createPickupLocationFromResponse($response) + { + /** We create the new location */ + $pickupLocation = new PickupLocation(); + + /** We set the differents properties of the location */ + $pickupLocation + ->setId($response->identifiant) + ->setTitle($response->nom) + ->setAddress($this->createPickupLocationAddressFromResponse($response)) + ->setLatitude($response->coordGeolocalisationLatitude) + ->setLongitude($response->coordGeolocalisationLongitude) + ->setOpeningHours(PickupLocation::MONDAY_OPENING_HOURS_KEY, $response->horairesOuvertureLundi) + ->setOpeningHours(PickupLocation::TUESDAY_OPENING_HOURS_KEY, $response->horairesOuvertureMardi) + ->setOpeningHours(PickupLocation::WEDNESDAY_OPENING_HOURS_KEY, $response->horairesOuvertureMercredi) + ->setOpeningHours(PickupLocation::THURSDAY_OPENING_HOURS_KEY, $response->horairesOuvertureJeudi) + ->setOpeningHours(PickupLocation::FRIDAY_OPENING_HOURS_KEY, $response->horairesOuvertureVendredi) + ->setOpeningHours(PickupLocation::SATURDAY_OPENING_HOURS_KEY, $response->horairesOuvertureSamedi) + ->setOpeningHours(PickupLocation::SUNDAY_OPENING_HOURS_KEY, $response->horairesOuvertureDimanche) + ->setModuleId(ColissimoPickupPoint::getModuleId()) + ; + + return $pickupLocation; + } + + /** + * Get the list of locations (relay points) + * + * @param PickupLocationEvent $pickupLocationEvent + * @throws \Exception + */ + public function getPickupLocations(PickupLocationEvent $pickupLocationEvent) + { + if (null !== $moduleIds = $pickupLocationEvent->getModuleIds()) { + if (!in_array(ColissimoPickupPoint::getModuleId(), $moduleIds)) { + return ; + } + } + + $responses = $this->callWebService($pickupLocationEvent); + + foreach ($responses as $response) { + $pickupLocationEvent->appendLocation($this->createPickupLocationFromResponse($response)); + } + } + + public static function getSubscribedEvents() + { + $listenedEvents = []; + + /** Check for old versions of Thelia where the events used by the API didn't exists */ + if (class_exists(PickupLocation::class)) { + $listenedEvents[TheliaEvents::MODULE_DELIVERY_GET_PICKUP_LOCATIONS] = array("getPickupLocations", 128); + } + + return $listenedEvents; + } +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/Listener/SendMail.php b/local/modules/ColissimoPickupPoint/Listener/SendMail.php new file mode 100755 index 00000000..b19d9483 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Listener/SendMail.php @@ -0,0 +1,123 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Listener; + +use ColissimoPickupPoint\ColissimoPickupPoint; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Core\Event\Order\OrderEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Template\ParserInterface; +use Thelia\Mailer\MailerFactory; +use Thelia\Model\ConfigQuery; +use Thelia\Model\MessageQuery; + +/** + * Class SendMail + * @package Colissimo\Listener + * @author Manuel Raynaud + */ +class SendMail implements EventSubscriberInterface +{ + + protected $parser; + + protected $mailer; + + public function __construct(ParserInterface $parser, MailerFactory $mailer) + { + $this->parser = $parser; + $this->mailer = $mailer; + } + + public function updateStatus(OrderEvent $event) + { + $order = $event->getOrder(); + $colissimoPickupPoint = new ColissimoPickupPoint(); + + if ($order->isSent() && $order->getDeliveryModuleId() == $colissimoPickupPoint->getModuleModel()->getId()) { + $contact_email = ConfigQuery::read('store_email'); + + if ($contact_email) { + + $message = MessageQuery::create() + ->filterByName('mail_colissimo_pickup_point') + ->findOne(); + + if (false === $message || null === $message) { + throw new \Exception("Failed to load message 'order_confirmation'."); + } + + $order = $event->getOrder(); + $customer = $order->getCustomer(); + + $this->parser->assign('customer_id', $customer->getId()); + $this->parser->assign('order_ref', $order->getRef()); + $this->parser->assign('order_date', $order->getCreatedAt()); + $this->parser->assign('update_date', $order->getUpdatedAt()); + $this->parser->assign('package', $order->getDeliveryRef()); + + $message + ->setLocale($order->getLang()->getLocale()); + + $instance = \Swift_Message::newInstance() + ->addTo($customer->getEmail(), $customer->getFirstname() . ' ' . $customer->getLastname()) + ->addFrom($contact_email, ConfigQuery::read('store_name')) + ; + + // Build subject and body + + $message->buildMessage($this->parser, $instance); + + $this->mailer->send($instance); + } + } + } + + /** + * Returns an array of event names this subscriber wants to listen to. + * + * The array keys are event names and the value can be: + * + * * The method name to call (priority defaults to 0) + * * An array composed of the method name to call and the priority + * * An array of arrays composed of the method names to call and respective + * priorities, or 0 if unset + * + * For instance: + * + * * array('eventName' => 'methodName') + * * array('eventName' => array('methodName', $priority)) + * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) + * + * @return array The event names to listen to + * + * @api + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::ORDER_UPDATE_STATUS => array('updateStatus', 128) + ); + } +} diff --git a/local/modules/ColissimoPickupPoint/Listener/SetDeliveryModule.php b/local/modules/ColissimoPickupPoint/Listener/SetDeliveryModule.php new file mode 100755 index 00000000..b5874c69 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Listener/SetDeliveryModule.php @@ -0,0 +1,249 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Listener; + +use ColissimoPickupPoint\Utils\ColissimoCodeReseau; +use ColissimoPickupPoint\WebService\FindById; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Core\Event\Delivery\DeliveryPostageEvent; +use Thelia\Core\Event\TheliaEvents; + +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\Translation\Translator; +use Thelia\Model\Address; +use Thelia\Model\CountryQuery; +use Thelia\Model\OrderAddressQuery; +use ColissimoPickupPoint\ColissimoPickupPoint; +use Thelia\Core\Event\Order\OrderEvent; +use Thelia\Model\AddressQuery; +use ColissimoPickupPoint\Model\AddressColissimoPickupPointQuery; +use ColissimoPickupPoint\Model\AddressColissimoPickupPoint; +use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint; + +/** + * Class SetDeliveryModule + * @package ColissimoPickupPoint\Listener + * @author Thelia + */ +class SetDeliveryModule implements EventSubscriberInterface +{ + protected $request; + + public function __construct(Request $request) + { + $this->request = $request; + } + + public function getRequest() + { + return $this->request; + } + + protected function check_module($id) + { + return $id == ColissimoPickupPoint::getModCode(); + } + + private function callWebServiceFindRelayPointByIdFromRequest(Request $request) + { + $relay_infos = explode(':', $request->get('colissimo_pickup_point_code')); + + $pr_code = $relay_infos[0]; + $relayType = count($relay_infos) > 1 ? $relay_infos[1] : null ; + $relayCountryCode = count($relay_infos) > 2 ? $relay_infos[2] : null ; + + if (!empty($pr_code)) { + $req = new FindById(); + + $req->setId($pr_code) + ->setLangue('FR') + ->setDate(date('d/m/Y')) + ->setAccountNumber(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME)) + ->setPassword(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD)); + + // An argument "Code réseau" is now required in addition to the Relay Point Code to identify a relay point outside France. + // This argument is optional for relay points inside France. + if ($relayType != null && $relayCountryCode != null) { + $codeReseau = ColissimoCodeReseau::getCodeReseau($relayCountryCode, $relayType); + if ($codeReseau !== null) { + $req->setReseau($codeReseau); + } + } + + return $req->exec(); + } + + return null; + } + + public function isModuleColissimoPickupPoint(OrderEvent $event) + { + if ($this->check_module($event->getDeliveryModule())) { + $request = $this->getRequest(); + + $address = AddressColissimoPickupPointQuery::create() + ->findPk($event->getDeliveryAddress()); + + $request->getSession()->set('ColissimoPickupPointDeliveryId', $event->getDeliveryAddress()); + if ($address === null) { + $address = new AddressColissimoPickupPoint(); + $address->setId($event->getDeliveryAddress()); + } + + $response = $this->callWebServiceFindRelayPointByIdFromRequest($request); + + if ($response !== null) { + $customerName = AddressQuery::create() + ->findPk($event->getDeliveryAddress()); + + $address = AddressColissimoPickupPointQuery::create() + ->findPk($event->getDeliveryAddress()); + + $request->getSession()->set('ColissimoPickupPointDeliveryId', $event->getDeliveryAddress()); + + if ($address === null) { + $address = new AddressColissimoPickupPoint(); + $address->setId($event->getDeliveryAddress()); + } + + $relayCountry = CountryQuery::create()->findOneByIsoalpha2($response->codePays); + + if ($relayCountry == null) { + $relayCountry = $customerName->getCountry(); + } + + $address + ->setCode($response->identifiant) + ->setType($response->typeDePoint) + ->setCompany($response->nom) + ->setAddress1($response->adresse1) + ->setAddress2($response->adresse2) + ->setAddress3($response->adresse3) + ->setZipcode($response->codePostal) + ->setCity($response->localite) + ->setFirstname($customerName->getFirstname()) + ->setLastname($customerName->getLastname()) + ->setTitleId($customerName->getTitleId()) + ->setCountryId($relayCountry->getId()) + ->save() + ; + } else { + $message = Translator::getInstance()->trans('No pickup points were selected', [], ColissimoPickupPoint::DOMAIN); + throw new \Exception($message); + } + } + } + + public function updateDeliveryAddress(OrderEvent $event) + { + if ($this->check_module($event->getOrder()->getDeliveryModuleId())) { + $request = $this->getRequest(); + + $tmp_address = AddressColissimoPickupPointQuery::create() + ->findPk($request->getSession()->get('ColissimoPickupPointDeliveryId')); + + if ($tmp_address === null) { + throw new \ErrorException('Got an error with ColissimoPickupPoint module. Please try again to checkout.'); + } + + $savecode = new OrderAddressColissimoPickupPoint(); + + $savecode + ->setId($event->getOrder()->getDeliveryOrderAddressId()) + ->setCode($tmp_address->getCode()) + ->setType($tmp_address->getType()) + ->save() + ; + + $update = OrderAddressQuery::create() + ->findPK($event->getOrder()->getDeliveryOrderAddressId()) + ->setCompany($tmp_address->getCompany()) + ->setAddress1($tmp_address->getAddress1()) + ->setAddress2($tmp_address->getAddress2()) + ->setAddress3($tmp_address->getAddress3()) + ->setZipcode($tmp_address->getZipcode()) + ->setCity($tmp_address->getCity()) + ->save() + ; + } + } + + public function getPostageRelayPoint(DeliveryPostageEvent $event) + { + if ($this->check_module($event->getModule()->getModuleModel()->getId())) { + $request = $this->getRequest(); + + // If the relay point service was chosen, we store the address of the chosen relay point in + // the DeliveryPostageEvent in order for Thelia to recalculate the postage cost from this address. + + $response = $this->callWebServiceFindRelayPointByIdFromRequest($request); + + if ($response !== null) { + $address = new Address(); + $relayCountry = CountryQuery::create()->findOneByIsoalpha2($response->codePays); + + $address + ->setCompany($response->nom) + ->setAddress1($response->adresse1) + ->setAddress2($response->adresse2) + ->setAddress3($response->adresse3) + ->setZipcode($response->codePostal) + ->setCity($response->localite) + ->setCountryId($relayCountry->getId()) + ; + + $event->setAddress($address); + } + } + } + + /** + * Returns an array of event names this subscriber wants to listen to. + * + * The array keys are event names and the value can be: + * + * * The method name to call (priority defaults to 0) + * * An array composed of the method name to call and the priority + * * An array of arrays composed of the method names to call and respective + * priorities, or 0 if unset + * + * For instance: + * + * * array('eventName' => 'methodName') + * * array('eventName' => array('methodName', $priority)) + * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) + * + * @return array The event names to listen to + * + * @api + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::ORDER_SET_DELIVERY_MODULE => array('isModuleColissimoPickupPoint', 64), + TheliaEvents::ORDER_BEFORE_PAYMENT => array('updateDeliveryAddress', 256), + TheliaEvents::MODULE_DELIVERY_GET_POSTAGE => array('getPostageRelayPoint', 257) + ); + } +} diff --git a/local/modules/ColissimoPickupPoint/Loop/AreaFreeshipping.php b/local/modules/ColissimoPickupPoint/Loop/AreaFreeshipping.php new file mode 100644 index 00000000..d487e48a --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/AreaFreeshipping.php @@ -0,0 +1,54 @@ +getAreaId(); + + $modes = ColissimoPickupPointAreaFreeshippingQuery::create(); + + if (null !== $areaId) { + $modes->filterByAreaId($areaId); + } + + return $modes; + } + + public function parseResults(LoopResult $loopResult) + { + /** @var ColissimoPickupPointAreaFreeshipping $mode */ + foreach ($loopResult->getResultDataCollection() as $mode) { + $loopResultRow = new LoopResultRow($mode); + $loopResultRow + ->set('ID', $mode->getId()) + ->set('AREA_ID', $mode->getAreaId()) + ->set('CART_AMOUNT', $mode->getCartAmount()); + + $loopResult->addRow($loopResultRow); + } + return $loopResult; + } + +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/Loop/CheckRightsLoop.php b/local/modules/ColissimoPickupPoint/Loop/CheckRightsLoop.php new file mode 100755 index 00000000..6d2e0b0f --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/CheckRightsLoop.php @@ -0,0 +1,78 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Loop; + +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\LoopResultRow; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\ArraySearchLoopInterface; +use Thelia\Core\Translation\Translator; + +/** + * Class CheckRightsLoop + * @package Colissimo\Looop + * @author Thelia + */ + +class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface +{ + protected function getArgDefinitions() + { + return new ArgumentCollection(); + } + + public function buildArray() + { + $ret = array(); + $dir = __DIR__ . '/../Config/'; + if (!is_readable($dir)) { + $ret[] = array('ERRMES' => Translator::getInstance()->trans("Can't read Config directory"), 'ERRFILE' => ''); + } + if ($handle = opendir($dir)) { + while (false !== ($file = readdir($handle))) { + if (strlen($file) > 5 && substr($file, -5) === '.json') { + if (!is_readable($dir.$file)) { + $ret[] = array('ERRMES' => Translator::getInstance()->trans("Can't read file"), 'ERRFILE' => 'Colissimo/Config/' . $file); + } + } + } + } + + return $ret; + } + public function parseResults(LoopResult $loopResult) + { + foreach ($loopResult->getResultDataCollection() as $arr) { + $loopResultRow = new LoopResultRow(); + $loopResultRow + ->set('ERRMES', $arr['ERRMES']) + ->set('ERRFILE', $arr['ERRFILE']) + ; + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointAddress.php b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointAddress.php new file mode 100755 index 00000000..e8afb380 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointAddress.php @@ -0,0 +1,83 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Loop; + +use ColissimoPickupPoint\Model\AddressColissimoPickupPoint; +use ColissimoPickupPoint\Model\AddressColissimoPickupPointQuery; +use Thelia\Core\Template\Loop\Address; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; +/** + * class ColissimoPickupPointDelivery + * @package ColissimoPickupPoint\Loop + * @author Thelia + */ +class ColissimoPickupPointAddress extends Address +{ + protected $exists = false; + protected $timestampable = false; + + protected function setExists($id) + { + $this->exists = AddressColissimoPickupPointQuery::create()->findPK($id) !== null; + } + + public function buildModelCriteria() + { + $id = $this->getId(); + $this->setExists($id[0]); + + return $this->exists ? + AddressColissimoPickupPointQuery::create()->filterById($id[0]) : + parent::buildModelCriteria(); + } + + public function parseResults(LoopResult $loopResult) + { + if (!$this->exists) { + return parent::parseResults($loopResult); + } + + /** @var AddressColissimoPickupPoint $address */ + foreach ($loopResult->getResultDataCollection() as $address) { + $loopResultRow = new LoopResultRow(); + $loopResultRow + ->set('TITLE', $address->getTitleId()) + ->set('COMPANY', $address->getCompany()) + ->set('FIRSTNAME', $address->getFirstname()) + ->set('LASTNAME', $address->getLastname()) + ->set('ADDRESS1', $address->getAddress1()) + ->set('ADDRESS2', $address->getAddress2()) + ->set('ADDRESS3', $address->getAddress3()) + ->set('ZIPCODE', $address->getZipcode()) + ->set('CITY', $address->getCity()) + ->set('COUNTRY', $address->getCountryId()) + ->set('CELLPHONE', $address->getCellphone()) + ; + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointFreeshippingLoop.php b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointFreeshippingLoop.php new file mode 100644 index 00000000..385689ee --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointFreeshippingLoop.php @@ -0,0 +1,52 @@ +findOneById(1)){ + $isFreeShippingActive = new ColissimoPickupPointFreeshipping(); + $isFreeShippingActive->setId(1); + $isFreeShippingActive->setActive(0); + $isFreeShippingActive->save(); + } + + return ColissimoPickupPointFreeshippingQuery::create()->filterById(1); + } + + public function parseResults(LoopResult $loopResult) + { + /** @var ColissimoPickupPointFreeshipping $freeshipping */ + foreach ($loopResult->getResultDataCollection() as $freeshipping) { + $loopResultRow = new LoopResultRow($freeshipping); + $loopResultRow + ->set('FREESHIPPING_ACTIVE', $freeshipping->getActive()) + ->set('FREESHIPPING_FROM', $freeshipping->getFreeshippingFrom()); + $loopResult->addRow($loopResultRow); + } + return $loopResult; + } +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointId.php b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointId.php new file mode 100755 index 00000000..5b9bcd6f --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointId.php @@ -0,0 +1,71 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Loop; +use ColissimoPickupPoint\ColissimoPickupPoint; +use Thelia\Core\Template\Element\ArraySearchLoopInterface; +use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; + +/** + * class ColissimoPickupPointId + * @package ColissimoPickupPoint\Loop + * @author Thelia + */ +class ColissimoPickupPointId extends BaseLoop implements ArraySearchLoopInterface +{ + /** + * this method returns an array + * + * @return array + */ + public function buildArray() + { + return array(ColissimoPickupPoint::getModCode()); + } + + /** + * @param LoopResult $loopResult + * + * @return LoopResult + */ + public function parseResults(LoopResult $loopResult) + { + foreach ($loopResult->getResultDataCollection() as $id) { + $loopResultRow = new LoopResultRow(); + $loopResult->addRow( + $loopResultRow->set('MODULE_ID', $id) + ); + } + + return $loopResult; + } + + protected function getArgDefinitions() + { + return new ArgumentCollection(); + } + +} diff --git a/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointOrderAddressLoop.php b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointOrderAddressLoop.php new file mode 100644 index 00000000..812843f7 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointOrderAddressLoop.php @@ -0,0 +1,92 @@ +getId()) !== null) { + $query->filterById((int)$id); + } + + return $query; + } + + /** + * @param LoopResult $loopResult + * + * @return LoopResult + */ + public function parseResults(LoopResult $loopResult) + { + /** @var OrderAddressColissimoPickupPoint $orderAddressColissimoPickupPoint */ + foreach ($loopResult->getResultDataCollection() as $orderAddressColissimoPickupPoint) { + $row = new LoopResultRow(); + $row->set('ID', $orderAddressColissimoPickupPoint->getId()); + $row->set('CODE', $orderAddressColissimoPickupPoint->getCode()); + $row->set('TYPE', $orderAddressColissimoPickupPoint->getType()); + $loopResult->addRow($row) + ; + } + + return $loopResult; + } +} diff --git a/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointPriceSlices.php b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointPriceSlices.php new file mode 100644 index 00000000..6e351fe6 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointPriceSlices.php @@ -0,0 +1,52 @@ +getAreaId(); + + $areaPrices = ColissimoPickupPointPriceSlicesQuery::create() + ->filterByAreaId($areaId) + ->orderByWeightMax(); + + return $areaPrices; + } + + public function parseResults(LoopResult $loopResult) + { + /** @var \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices $price */ + foreach ($loopResult->getResultDataCollection() as $price) { + $loopResultRow = new LoopResultRow($price); + $loopResultRow + ->set('SLICE_ID', $price->getId()) + ->set('MAX_WEIGHT', $price->getWeightMax()) + ->set('MAX_PRICE', $price->getPriceMax()) + ->set('PRICE', $price->getPrice()) + ->set('FRANCO', $price->getFrancoMinPrice()) + ; + $loopResult->addRow($loopResultRow); + } + return $loopResult; + } +} diff --git a/local/modules/ColissimoPickupPoint/Loop/GetRelais.php b/local/modules/ColissimoPickupPoint/Loop/GetRelais.php new file mode 100755 index 00000000..9fc142a0 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/GetRelais.php @@ -0,0 +1,179 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Loop; + +use ColissimoPickupPoint\ColissimoPickupPoint; +use ColissimoPickupPoint\WebService\FindByAddress; +use Symfony\Component\Serializer\Exception\InvalidArgumentException; +use Thelia\Core\Template\Element\ArraySearchLoopInterface; +use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; +use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Log\Tlog; +use Thelia\Model\AddressQuery; +use Thelia\Model\ConfigQuery; +use Thelia\Model\CountryQuery; + +/** + * Class GetRelais + * @package ColissimoPickupPoint\Loop + * @author Thelia + */ +class GetRelais extends BaseLoop implements ArraySearchLoopInterface +{ + /** + * @inheritdoc + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('countryid', ''), + Argument::createAnyTypeArgument('zipcode', ''), + Argument::createAnyTypeArgument('city', ''), + Argument::createIntTypeArgument('address') + ); + } + + /** + * @return array|mixed + * @throws \ErrorException + * @throws \Propel\Runtime\Exception\PropelException + */ + public function buildArray() + { + // Find the address ... To find ! \m/ + $zipcode = $this->getZipcode(); + $city = $this->getCity(); + $countryId = $this->getCountryid(); + + $addressId = $this->getAddress(); + + if (!empty($addressId) && (!empty($zipcode) || !empty($city))) { + throw new \InvalidArgumentException( + "Cannot have argument 'address' and 'zipcode' or 'city' at the same time." + ); + } + + if (null !== $addressModel = AddressQuery::create()->findPk($addressId)) { + $address = array( + 'zipcode' => $addressModel->getZipcode(), + 'city' => $addressModel->getCity(), + 'address' => $addressModel->getAddress1(), + 'countrycode' => $addressModel->getCountry()->getIsoalpha2() + ); + } elseif (empty($zipcode) || empty($city)) { + $search = AddressQuery::create(); + + $customer = $this->securityContext->getCustomerUser(); + if ($customer !== null) { + $search->filterByCustomerId($customer->getId()); + $search->filterByIsDefault('1'); + } else { + throw new \ErrorException('Customer not connected.'); + } + + $search = $search->findOne(); + $address['zipcode'] = $search->getZipcode(); + $address['city'] = $search->getCity(); + $address['address'] = $search->getAddress1(); + $address['countrycode'] = $search->getCountry()->getIsoalpha2(); + } else { + $address = array( + 'zipcode' => $zipcode, + 'city' => $city, + 'address' => '', + 'countrycode' => CountryQuery::create() + ->findOneById($countryId) + ->getIsoalpha2() + ); + } + + // Then ask the Web Service + $request = new FindByAddress(); + $request + ->setAddress($address['address']) + ->setZipCode($address['zipcode']) + ->setCity($address['city']) + ->setCountryCode($address['countrycode']) + ->setFilterRelay('1') + ->setRequestId(md5(microtime())) + ->setLang('FR') + ->setOptionInter('1') + ->setShippingDate(date('d/m/Y')) + ->setAccountNumber(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME)) + ->setPassword(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD)) + ; + + try { + $response = $request->exec(); + } catch (InvalidArgumentException $e) { + $response = array(); + } catch (\SoapFault $e) { + $response = array(); + } + + if (!is_array($response) && $response !== null) { + $newResponse[] = $response; + $response = $newResponse; + } + + return $response; + } + + /** + * @param LoopResult $loopResult + * + * @return LoopResult + */ + public function parseResults(LoopResult $loopResult) + { + foreach ($loopResult->getResultDataCollection() as $item) { + $loopResultRow = new LoopResultRow(); + + //Tlog::getInstance()->addDebug(print_r($item, true)); + foreach ($item as $key => $value) { + $loopResultRow->set($key, $value); + } + + // format distance + $distance = (string) $loopResultRow->get('distanceEnMetre'); + if (strlen($distance) < 4) { + $distance .= ' m'; + } else { + $distance = (string)(float)$distance / 1000; + while (substr($distance, strlen($distance) - 1, 1) == "0") { + $distance = substr($distance, 0, strlen($distance) - 1); + } + $distance = str_replace('.', ',', $distance) . ' km'; + } + $loopResultRow->set('distance', $distance); + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/local/modules/ColissimoPickupPoint/Loop/NotSentOrders.php b/local/modules/ColissimoPickupPoint/Loop/NotSentOrders.php new file mode 100755 index 00000000..871b68af --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Loop/NotSentOrders.php @@ -0,0 +1,75 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use ColissimoPickupPoint\ColissimoPickupPoint; +use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\OrderQuery; +use Thelia\Core\Template\Loop\Order; +use Thelia\Model\OrderStatus; +use Thelia\Model\OrderStatusQuery; + +/** + * Class NotSentOrders + * @package ColissimoPickupPoint\Loop + * @author Thelia + */ +class NotSentOrders extends Order +{ + public function getArgDefinitions() + { + return new ArgumentCollection(Argument::createBooleanTypeArgument('with_prev_next_info', false)); + } + + /** + * this method returns a Propel ModelCriteria + * + * @return \Propel\Runtime\ActiveQuery\ModelCriteria + */ + public function buildModelCriteria() + { + $status = OrderStatusQuery::create() + ->filterByCode( + array( + OrderStatus::CODE_PAID, + OrderStatus::CODE_PROCESSING, + ), + Criteria::IN + ) + ->find() + ->toArray('code'); + $query = OrderQuery::create() + ->filterByDeliveryModuleId(ColissimoPickupPoint::getModCode()) + ->filterByStatusId( + array( + $status[OrderStatus::CODE_PAID]['Id'], + $status[OrderStatus::CODE_PROCESSING]['Id']), + Criteria::IN + ); + + return $query; + } +} diff --git a/local/modules/ColissimoPickupPoint/Model/AddressColissimoPickupPoint.php b/local/modules/ColissimoPickupPoint/Model/AddressColissimoPickupPoint.php new file mode 100644 index 00000000..38044c2e --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/AddressColissimoPickupPoint.php @@ -0,0 +1,10 @@ +modifiedColumns; + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return $this->modifiedColumns && isset($this->modifiedColumns[$col]); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return boolean true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + if (isset($this->modifiedColumns[$col])) { + unset($this->modifiedColumns[$col]); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another AddressColissimoPickupPoint instance. If + * obj is an instance of AddressColissimoPickupPoint, delegates to + * equals(AddressColissimoPickupPoint). Otherwise, returns false. + * + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @param string $name The virtual column name + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @param string $name The virtual column name + * @return mixed + * + * @throws PropelException + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return AddressColissimoPickupPoint The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return AddressColissimoPickupPoint The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [title_id] column value. + * + * @return int + */ + public function getTitleId() + { + + return $this->title_id; + } + + /** + * Get the [company] column value. + * + * @return string + */ + public function getCompany() + { + + return $this->company; + } + + /** + * Get the [firstname] column value. + * + * @return string + */ + public function getFirstname() + { + + return $this->firstname; + } + + /** + * Get the [lastname] column value. + * + * @return string + */ + public function getLastname() + { + + return $this->lastname; + } + + /** + * Get the [address1] column value. + * + * @return string + */ + public function getAddress1() + { + + return $this->address1; + } + + /** + * Get the [address2] column value. + * + * @return string + */ + public function getAddress2() + { + + return $this->address2; + } + + /** + * Get the [address3] column value. + * + * @return string + */ + public function getAddress3() + { + + return $this->address3; + } + + /** + * Get the [zipcode] column value. + * + * @return string + */ + public function getZipcode() + { + + return $this->zipcode; + } + + /** + * Get the [city] column value. + * + * @return string + */ + public function getCity() + { + + return $this->city; + } + + /** + * Get the [country_id] column value. + * + * @return int + */ + public function getCountryId() + { + + return $this->country_id; + } + + /** + * Get the [code] column value. + * + * @return string + */ + public function getCode() + { + + return $this->code; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getType() + { + + return $this->type; + } + + /** + * Get the [cellphone] column value. + * + * @return string + */ + public function getCellphone() + { + + return $this->cellphone; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::ID] = true; + } + + + return $this; + } // setId() + + /** + * Set the value of [title_id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setTitleId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->title_id !== $v) { + $this->title_id = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::TITLE_ID] = true; + } + + if ($this->aCustomerTitle !== null && $this->aCustomerTitle->getId() !== $v) { + $this->aCustomerTitle = null; + } + + + return $this; + } // setTitleId() + + /** + * Set the value of [company] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setCompany($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->company !== $v) { + $this->company = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::COMPANY] = true; + } + + + return $this; + } // setCompany() + + /** + * Set the value of [firstname] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setFirstname($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->firstname !== $v) { + $this->firstname = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::FIRSTNAME] = true; + } + + + return $this; + } // setFirstname() + + /** + * Set the value of [lastname] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setLastname($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->lastname !== $v) { + $this->lastname = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::LASTNAME] = true; + } + + + return $this; + } // setLastname() + + /** + * Set the value of [address1] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setAddress1($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->address1 !== $v) { + $this->address1 = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::ADDRESS1] = true; + } + + + return $this; + } // setAddress1() + + /** + * Set the value of [address2] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setAddress2($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->address2 !== $v) { + $this->address2 = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::ADDRESS2] = true; + } + + + return $this; + } // setAddress2() + + /** + * Set the value of [address3] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setAddress3($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->address3 !== $v) { + $this->address3 = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::ADDRESS3] = true; + } + + + return $this; + } // setAddress3() + + /** + * Set the value of [zipcode] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setZipcode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->zipcode !== $v) { + $this->zipcode = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::ZIPCODE] = true; + } + + + return $this; + } // setZipcode() + + /** + * Set the value of [city] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setCity($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->city !== $v) { + $this->city = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::CITY] = true; + } + + + return $this; + } // setCity() + + /** + * Set the value of [country_id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setCountryId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->country_id !== $v) { + $this->country_id = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::COUNTRY_ID] = true; + } + + if ($this->aCountry !== null && $this->aCountry->getId() !== $v) { + $this->aCountry = null; + } + + + return $this; + } // setCountryId() + + /** + * Set the value of [code] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setCode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->code !== $v) { + $this->code = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::CODE] = true; + } + + + return $this; + } // setCode() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::TYPE] = true; + } + + + return $this; + } // setType() + + /** + * Set the value of [cellphone] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setCellphone($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->cellphone !== $v) { + $this->cellphone = $v; + $this->modifiedColumns[AddressColissimoPickupPointTableMap::CELLPHONE] = true; + } + + + return $this; + } // setCellphone() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('TitleId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title_id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Company', TableMap::TYPE_PHPNAME, $indexType)]; + $this->company = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Firstname', TableMap::TYPE_PHPNAME, $indexType)]; + $this->firstname = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)]; + $this->lastname = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Address1', TableMap::TYPE_PHPNAME, $indexType)]; + $this->address1 = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Address2', TableMap::TYPE_PHPNAME, $indexType)]; + $this->address2 = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Address3', TableMap::TYPE_PHPNAME, $indexType)]; + $this->address3 = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Zipcode', TableMap::TYPE_PHPNAME, $indexType)]; + $this->zipcode = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('City', TableMap::TYPE_PHPNAME, $indexType)]; + $this->city = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->country_id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; + $this->code = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; + $this->type = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : AddressColissimoPickupPointTableMap::translateFieldName('Cellphone', TableMap::TYPE_PHPNAME, $indexType)]; + $this->cellphone = (null !== $col) ? (string) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 14; // 14 = AddressColissimoPickupPointTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \ColissimoPickupPoint\Model\AddressColissimoPickupPoint object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + if ($this->aCustomerTitle !== null && $this->title_id !== $this->aCustomerTitle->getId()) { + $this->aCustomerTitle = null; + } + if ($this->aCountry !== null && $this->country_id !== $this->aCountry->getId()) { + $this->aCountry = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(AddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildAddressColissimoPickupPointQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCustomerTitle = null; + $this->aCountry = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see AddressColissimoPickupPoint::setDeleted() + * @see AddressColissimoPickupPoint::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(AddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildAddressColissimoPickupPointQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(AddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + AddressColissimoPickupPointTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCustomerTitle !== null) { + if ($this->aCustomerTitle->isModified() || $this->aCustomerTitle->isNew()) { + $affectedRows += $this->aCustomerTitle->save($con); + } + $this->setCustomerTitle($this->aCustomerTitle); + } + + if ($this->aCountry !== null) { + if ($this->aCountry->isModified() || $this->aCountry->isNew()) { + $affectedRows += $this->aCountry->save($con); + } + $this->setCountry($this->aCountry); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::TITLE_ID)) { + $modifiedColumns[':p' . $index++] = 'TITLE_ID'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::COMPANY)) { + $modifiedColumns[':p' . $index++] = 'COMPANY'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::FIRSTNAME)) { + $modifiedColumns[':p' . $index++] = 'FIRSTNAME'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::LASTNAME)) { + $modifiedColumns[':p' . $index++] = 'LASTNAME'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ADDRESS1)) { + $modifiedColumns[':p' . $index++] = 'ADDRESS1'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ADDRESS2)) { + $modifiedColumns[':p' . $index++] = 'ADDRESS2'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ADDRESS3)) { + $modifiedColumns[':p' . $index++] = 'ADDRESS3'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ZIPCODE)) { + $modifiedColumns[':p' . $index++] = 'ZIPCODE'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::CITY)) { + $modifiedColumns[':p' . $index++] = 'CITY'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::COUNTRY_ID)) { + $modifiedColumns[':p' . $index++] = 'COUNTRY_ID'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::CODE)) { + $modifiedColumns[':p' . $index++] = 'CODE'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::TYPE)) { + $modifiedColumns[':p' . $index++] = 'TYPE'; + } + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::CELLPHONE)) { + $modifiedColumns[':p' . $index++] = 'CELLPHONE'; + } + + $sql = sprintf( + 'INSERT INTO address_colissimo_pickup_point (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'TITLE_ID': + $stmt->bindValue($identifier, $this->title_id, PDO::PARAM_INT); + break; + case 'COMPANY': + $stmt->bindValue($identifier, $this->company, PDO::PARAM_STR); + break; + case 'FIRSTNAME': + $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); + break; + case 'LASTNAME': + $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); + break; + case 'ADDRESS1': + $stmt->bindValue($identifier, $this->address1, PDO::PARAM_STR); + break; + case 'ADDRESS2': + $stmt->bindValue($identifier, $this->address2, PDO::PARAM_STR); + break; + case 'ADDRESS3': + $stmt->bindValue($identifier, $this->address3, PDO::PARAM_STR); + break; + case 'ZIPCODE': + $stmt->bindValue($identifier, $this->zipcode, PDO::PARAM_STR); + break; + case 'CITY': + $stmt->bindValue($identifier, $this->city, PDO::PARAM_STR); + break; + case 'COUNTRY_ID': + $stmt->bindValue($identifier, $this->country_id, PDO::PARAM_INT); + break; + case 'CODE': + $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + break; + case 'TYPE': + $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); + break; + case 'CELLPHONE': + $stmt->bindValue($identifier, $this->cellphone, PDO::PARAM_STR); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); + } + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = AddressColissimoPickupPointTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getTitleId(); + break; + case 2: + return $this->getCompany(); + break; + case 3: + return $this->getFirstname(); + break; + case 4: + return $this->getLastname(); + break; + case 5: + return $this->getAddress1(); + break; + case 6: + return $this->getAddress2(); + break; + case 7: + return $this->getAddress3(); + break; + case 8: + return $this->getZipcode(); + break; + case 9: + return $this->getCity(); + break; + case 10: + return $this->getCountryId(); + break; + case 11: + return $this->getCode(); + break; + case 12: + return $this->getType(); + break; + case 13: + return $this->getCellphone(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['AddressColissimoPickupPoint'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['AddressColissimoPickupPoint'][$this->getPrimaryKey()] = true; + $keys = AddressColissimoPickupPointTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getTitleId(), + $keys[2] => $this->getCompany(), + $keys[3] => $this->getFirstname(), + $keys[4] => $this->getLastname(), + $keys[5] => $this->getAddress1(), + $keys[6] => $this->getAddress2(), + $keys[7] => $this->getAddress3(), + $keys[8] => $this->getZipcode(), + $keys[9] => $this->getCity(), + $keys[10] => $this->getCountryId(), + $keys[11] => $this->getCode(), + $keys[12] => $this->getType(), + $keys[13] => $this->getCellphone(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aCustomerTitle) { + $result['CustomerTitle'] = $this->aCustomerTitle->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + if (null !== $this->aCountry) { + $result['Country'] = $this->aCountry->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = AddressColissimoPickupPointTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setTitleId($value); + break; + case 2: + $this->setCompany($value); + break; + case 3: + $this->setFirstname($value); + break; + case 4: + $this->setLastname($value); + break; + case 5: + $this->setAddress1($value); + break; + case 6: + $this->setAddress2($value); + break; + case 7: + $this->setAddress3($value); + break; + case 8: + $this->setZipcode($value); + break; + case 9: + $this->setCity($value); + break; + case 10: + $this->setCountryId($value); + break; + case 11: + $this->setCode($value); + break; + case 12: + $this->setType($value); + break; + case 13: + $this->setCellphone($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = AddressColissimoPickupPointTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setTitleId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setCompany($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setFirstname($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setLastname($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setAddress1($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setAddress2($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setAddress3($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setZipcode($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setCity($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setCountryId($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setCode($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setType($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setCellphone($arr[$keys[13]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(AddressColissimoPickupPointTableMap::DATABASE_NAME); + + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ID)) $criteria->add(AddressColissimoPickupPointTableMap::ID, $this->id); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::TITLE_ID)) $criteria->add(AddressColissimoPickupPointTableMap::TITLE_ID, $this->title_id); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::COMPANY)) $criteria->add(AddressColissimoPickupPointTableMap::COMPANY, $this->company); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::FIRSTNAME)) $criteria->add(AddressColissimoPickupPointTableMap::FIRSTNAME, $this->firstname); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::LASTNAME)) $criteria->add(AddressColissimoPickupPointTableMap::LASTNAME, $this->lastname); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ADDRESS1)) $criteria->add(AddressColissimoPickupPointTableMap::ADDRESS1, $this->address1); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ADDRESS2)) $criteria->add(AddressColissimoPickupPointTableMap::ADDRESS2, $this->address2); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ADDRESS3)) $criteria->add(AddressColissimoPickupPointTableMap::ADDRESS3, $this->address3); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::ZIPCODE)) $criteria->add(AddressColissimoPickupPointTableMap::ZIPCODE, $this->zipcode); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::CITY)) $criteria->add(AddressColissimoPickupPointTableMap::CITY, $this->city); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::COUNTRY_ID)) $criteria->add(AddressColissimoPickupPointTableMap::COUNTRY_ID, $this->country_id); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::CODE)) $criteria->add(AddressColissimoPickupPointTableMap::CODE, $this->code); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::TYPE)) $criteria->add(AddressColissimoPickupPointTableMap::TYPE, $this->type); + if ($this->isColumnModified(AddressColissimoPickupPointTableMap::CELLPHONE)) $criteria->add(AddressColissimoPickupPointTableMap::CELLPHONE, $this->cellphone); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(AddressColissimoPickupPointTableMap::DATABASE_NAME); + $criteria->add(AddressColissimoPickupPointTableMap::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \ColissimoPickupPoint\Model\AddressColissimoPickupPoint (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setId($this->getId()); + $copyObj->setTitleId($this->getTitleId()); + $copyObj->setCompany($this->getCompany()); + $copyObj->setFirstname($this->getFirstname()); + $copyObj->setLastname($this->getLastname()); + $copyObj->setAddress1($this->getAddress1()); + $copyObj->setAddress2($this->getAddress2()); + $copyObj->setAddress3($this->getAddress3()); + $copyObj->setZipcode($this->getZipcode()); + $copyObj->setCity($this->getCity()); + $copyObj->setCountryId($this->getCountryId()); + $copyObj->setCode($this->getCode()); + $copyObj->setType($this->getType()); + $copyObj->setCellphone($this->getCellphone()); + if ($makeNew) { + $copyObj->setNew(true); + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Declares an association between this object and a ChildCustomerTitle object. + * + * @param ChildCustomerTitle $v + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + * @throws PropelException + */ + public function setCustomerTitle(ChildCustomerTitle $v = null) + { + if ($v === null) { + $this->setTitleId(NULL); + } else { + $this->setTitleId($v->getId()); + } + + $this->aCustomerTitle = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildCustomerTitle object, it will not be re-added. + if ($v !== null) { + $v->addAddressColissimoPickupPoint($this); + } + + + return $this; + } + + + /** + * Get the associated ChildCustomerTitle object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildCustomerTitle The associated ChildCustomerTitle object. + * @throws PropelException + */ + public function getCustomerTitle(ConnectionInterface $con = null) + { + if ($this->aCustomerTitle === null && ($this->title_id !== null)) { + $this->aCustomerTitle = CustomerTitleQuery::create()->findPk($this->title_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCustomerTitle->addAddressColissimoPickupPoints($this); + */ + } + + return $this->aCustomerTitle; + } + + /** + * Declares an association between this object and a ChildCountry object. + * + * @param ChildCountry $v + * @return \ColissimoPickupPoint\Model\AddressColissimoPickupPoint The current object (for fluent API support) + * @throws PropelException + */ + public function setCountry(ChildCountry $v = null) + { + if ($v === null) { + $this->setCountryId(NULL); + } else { + $this->setCountryId($v->getId()); + } + + $this->aCountry = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildCountry object, it will not be re-added. + if ($v !== null) { + $v->addAddressColissimoPickupPoint($this); + } + + + return $this; + } + + + /** + * Get the associated ChildCountry object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildCountry The associated ChildCountry object. + * @throws PropelException + */ + public function getCountry(ConnectionInterface $con = null) + { + if ($this->aCountry === null && ($this->country_id !== null)) { + $this->aCountry = CountryQuery::create()->findPk($this->country_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCountry->addAddressColissimoPickupPoints($this); + */ + } + + return $this->aCountry; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->title_id = null; + $this->company = null; + $this->firstname = null; + $this->lastname = null; + $this->address1 = null; + $this->address2 = null; + $this->address3 = null; + $this->zipcode = null; + $this->city = null; + $this->country_id = null; + $this->code = null; + $this->type = null; + $this->cellphone = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCustomerTitle = null; + $this->aCountry = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(AddressColissimoPickupPointTableMap::DEFAULT_STRING_FORMAT); + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/local/modules/ColissimoPickupPoint/Model/Base/AddressColissimoPickupPointQuery.php b/local/modules/ColissimoPickupPoint/Model/Base/AddressColissimoPickupPointQuery.php new file mode 100644 index 00000000..5fde914b --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/AddressColissimoPickupPointQuery.php @@ -0,0 +1,964 @@ +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. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildAddressColissimoPickupPoint|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = AddressColissimoPickupPointTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(AddressColissimoPickupPointTableMap::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 ChildAddressColissimoPickupPoint A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, CODE, TYPE, CELLPHONE FROM address_colissimo_pickup_point 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 ChildAddressColissimoPickupPoint(); + $obj->hydrate($row); + AddressColissimoPickupPointTableMap::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 ChildAddressColissimoPickupPoint|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 + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @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 ChildAddressColissimoPickupPointQuery 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(AddressColissimoPickupPointTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(AddressColissimoPickupPointTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the title_id column + * + * Example usage: + * + * $query->filterByTitleId(1234); // WHERE title_id = 1234 + * $query->filterByTitleId(array(12, 34)); // WHERE title_id IN (12, 34) + * $query->filterByTitleId(array('min' => 12)); // WHERE title_id > 12 + * + * + * @see filterByCustomerTitle() + * + * @param mixed $titleId 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByTitleId($titleId = null, $comparison = null) + { + if (is_array($titleId)) { + $useMinMax = false; + if (isset($titleId['min'])) { + $this->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $titleId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($titleId['max'])) { + $this->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $titleId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $titleId, $comparison); + } + + /** + * Filter the query on the company column + * + * Example usage: + * + * $query->filterByCompany('fooValue'); // WHERE company = 'fooValue' + * $query->filterByCompany('%fooValue%'); // WHERE company LIKE '%fooValue%' + * + * + * @param string $company 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByCompany($company = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($company)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $company)) { + $company = str_replace('*', '%', $company); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::COMPANY, $company, $comparison); + } + + /** + * Filter the query on the firstname column + * + * Example usage: + * + * $query->filterByFirstname('fooValue'); // WHERE firstname = 'fooValue' + * $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%' + * + * + * @param string $firstname 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByFirstname($firstname = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($firstname)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $firstname)) { + $firstname = str_replace('*', '%', $firstname); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::FIRSTNAME, $firstname, $comparison); + } + + /** + * Filter the query on the lastname column + * + * Example usage: + * + * $query->filterByLastname('fooValue'); // WHERE lastname = 'fooValue' + * $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%' + * + * + * @param string $lastname 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByLastname($lastname = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($lastname)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $lastname)) { + $lastname = str_replace('*', '%', $lastname); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::LASTNAME, $lastname, $comparison); + } + + /** + * Filter the query on the address1 column + * + * Example usage: + * + * $query->filterByAddress1('fooValue'); // WHERE address1 = 'fooValue' + * $query->filterByAddress1('%fooValue%'); // WHERE address1 LIKE '%fooValue%' + * + * + * @param string $address1 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByAddress1($address1 = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($address1)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $address1)) { + $address1 = str_replace('*', '%', $address1); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ADDRESS1, $address1, $comparison); + } + + /** + * Filter the query on the address2 column + * + * Example usage: + * + * $query->filterByAddress2('fooValue'); // WHERE address2 = 'fooValue' + * $query->filterByAddress2('%fooValue%'); // WHERE address2 LIKE '%fooValue%' + * + * + * @param string $address2 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByAddress2($address2 = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($address2)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $address2)) { + $address2 = str_replace('*', '%', $address2); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ADDRESS2, $address2, $comparison); + } + + /** + * Filter the query on the address3 column + * + * Example usage: + * + * $query->filterByAddress3('fooValue'); // WHERE address3 = 'fooValue' + * $query->filterByAddress3('%fooValue%'); // WHERE address3 LIKE '%fooValue%' + * + * + * @param string $address3 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByAddress3($address3 = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($address3)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $address3)) { + $address3 = str_replace('*', '%', $address3); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ADDRESS3, $address3, $comparison); + } + + /** + * Filter the query on the zipcode column + * + * Example usage: + * + * $query->filterByZipcode('fooValue'); // WHERE zipcode = 'fooValue' + * $query->filterByZipcode('%fooValue%'); // WHERE zipcode LIKE '%fooValue%' + * + * + * @param string $zipcode 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByZipcode($zipcode = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($zipcode)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $zipcode)) { + $zipcode = str_replace('*', '%', $zipcode); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ZIPCODE, $zipcode, $comparison); + } + + /** + * Filter the query on the city column + * + * Example usage: + * + * $query->filterByCity('fooValue'); // WHERE city = 'fooValue' + * $query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%' + * + * + * @param string $city 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByCity($city = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($city)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $city)) { + $city = str_replace('*', '%', $city); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::CITY, $city, $comparison); + } + + /** + * Filter the query on the country_id column + * + * Example usage: + * + * $query->filterByCountryId(1234); // WHERE country_id = 1234 + * $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34) + * $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12 + * + * + * @see filterByCountry() + * + * @param mixed $countryId 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByCountryId($countryId = null, $comparison = null) + { + if (is_array($countryId)) { + $useMinMax = false; + if (isset($countryId['min'])) { + $this->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($countryId['max'])) { + $this->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $countryId, $comparison); + } + + /** + * Filter the query on the code column + * + * Example usage: + * + * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' + * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * + * + * @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 ChildAddressColissimoPickupPointQuery 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(AddressColissimoPickupPointTableMap::CODE, $code, $comparison); + } + + /** + * Filter the query on the type column + * + * Example usage: + * + * $query->filterByType('fooValue'); // WHERE type = 'fooValue' + * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%' + * + * + * @param string $type 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByType($type = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($type)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $type)) { + $type = str_replace('*', '%', $type); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::TYPE, $type, $comparison); + } + + /** + * Filter the query on the cellphone column + * + * Example usage: + * + * $query->filterByCellphone('fooValue'); // WHERE cellphone = 'fooValue' + * $query->filterByCellphone('%fooValue%'); // WHERE cellphone LIKE '%fooValue%' + * + * + * @param string $cellphone 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByCellphone($cellphone = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($cellphone)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $cellphone)) { + $cellphone = str_replace('*', '%', $cellphone); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(AddressColissimoPickupPointTableMap::CELLPHONE, $cellphone, $comparison); + } + + /** + * Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle object + * + * @param \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle|ObjectCollection $customerTitle The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByCustomerTitle($customerTitle, $comparison = null) + { + if ($customerTitle instanceof \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle) { + return $this + ->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $customerTitle->getId(), $comparison); + } elseif ($customerTitle instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByCustomerTitle() only accepts arguments of type \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the CustomerTitle relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CustomerTitle'); + + // 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, 'CustomerTitle'); + } + + return $this; + } + + /** + * Use the CustomerTitle relation CustomerTitle 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 \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query + */ + public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCustomerTitle($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\ColissimoPickupPoint\Model\Thelia\Model\CustomerTitleQuery'); + } + + /** + * Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\Country object + * + * @param \ColissimoPickupPoint\Model\Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByCountry($country, $comparison = null) + { + if ($country instanceof \ColissimoPickupPoint\Model\Thelia\Model\Country) { + return $this + ->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $country->getId(), $comparison); + } elseif ($country instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByCountry() only accepts arguments of type \ColissimoPickupPoint\Model\Thelia\Model\Country or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Country relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Country'); + + // 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, 'Country'); + } + + return $this; + } + + /** + * Use the Country relation Country 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 \ColissimoPickupPoint\Model\Thelia\Model\CountryQuery A secondary query class using the current class as primary query + */ + public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCountry($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Country', '\ColissimoPickupPoint\Model\Thelia\Model\CountryQuery'); + } + + /** + * Exclude object from result + * + * @param ChildAddressColissimoPickupPoint $addressColissimoPickupPoint Object to remove from the list of results + * + * @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function prune($addressColissimoPickupPoint = null) + { + if ($addressColissimoPickupPoint) { + $this->addUsingAlias(AddressColissimoPickupPointTableMap::ID, $addressColissimoPickupPoint->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the address_colissimo_pickup_point 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(AddressColissimoPickupPointTableMap::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). + AddressColissimoPickupPointTableMap::clearInstancePool(); + AddressColissimoPickupPointTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildAddressColissimoPickupPoint or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildAddressColissimoPickupPoint 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(AddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(AddressColissimoPickupPointTableMap::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(); + + + AddressColissimoPickupPointTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + AddressColissimoPickupPointTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // AddressColissimoPickupPointQuery diff --git a/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointAreaFreeshipping.php b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointAreaFreeshipping.php new file mode 100644 index 00000000..d51ecd8a --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointAreaFreeshipping.php @@ -0,0 +1,1272 @@ +cart_amount = '0.00'; + } + + /** + * Initializes internal state of ColissimoPickupPoint\Model\Base\ColissimoPickupPointAreaFreeshipping object. + * @see applyDefaults() + */ + public function __construct() + { + $this->applyDefaultValues(); + } + + /** + * Returns whether the object has been modified. + * + * @return boolean True if the object has been modified. + */ + public function isModified() + { + return !!$this->modifiedColumns; + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return $this->modifiedColumns && isset($this->modifiedColumns[$col]); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return boolean true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + if (isset($this->modifiedColumns[$col])) { + unset($this->modifiedColumns[$col]); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another ColissimoPickupPointAreaFreeshipping instance. If + * obj is an instance of ColissimoPickupPointAreaFreeshipping, delegates to + * equals(ColissimoPickupPointAreaFreeshipping). Otherwise, returns false. + * + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @param string $name The virtual column name + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @param string $name The virtual column name + * @return mixed + * + * @throws PropelException + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return ColissimoPickupPointAreaFreeshipping The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return ColissimoPickupPointAreaFreeshipping The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [area_id] column value. + * + * @return int + */ + public function getAreaId() + { + + return $this->area_id; + } + + /** + * Get the [cart_amount] column value. + * + * @return string + */ + public function getCartAmount() + { + + return $this->cart_amount; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[ColissimoPickupPointAreaFreeshippingTableMap::ID] = true; + } + + + return $this; + } // setId() + + /** + * Set the value of [area_id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping The current object (for fluent API support) + */ + public function setAreaId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->area_id !== $v) { + $this->area_id = $v; + $this->modifiedColumns[ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID] = true; + } + + if ($this->aArea !== null && $this->aArea->getId() !== $v) { + $this->aArea = null; + } + + + return $this; + } // setAreaId() + + /** + * Set the value of [cart_amount] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping The current object (for fluent API support) + */ + public function setCartAmount($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->cart_amount !== $v) { + $this->cart_amount = $v; + $this->modifiedColumns[ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT] = true; + } + + + return $this; + } // setCartAmount() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->cart_amount !== '0.00') { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ColissimoPickupPointAreaFreeshippingTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ColissimoPickupPointAreaFreeshippingTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->area_id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ColissimoPickupPointAreaFreeshippingTableMap::translateFieldName('CartAmount', TableMap::TYPE_PHPNAME, $indexType)]; + $this->cart_amount = (null !== $col) ? (string) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = ColissimoPickupPointAreaFreeshippingTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) { + $this->aArea = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildColissimoPickupPointAreaFreeshippingQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aArea = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see ColissimoPickupPointAreaFreeshipping::setDeleted() + * @see ColissimoPickupPointAreaFreeshipping::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildColissimoPickupPointAreaFreeshippingQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + ColissimoPickupPointAreaFreeshippingTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aArea !== null) { + if ($this->aArea->isModified() || $this->aArea->isNew()) { + $affectedRows += $this->aArea->save($con); + } + $this->setArea($this->aArea); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + $this->modifiedColumns[ColissimoPickupPointAreaFreeshippingTableMap::ID] = true; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ColissimoPickupPointAreaFreeshippingTableMap::ID . ')'); + } + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(ColissimoPickupPointAreaFreeshippingTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID)) { + $modifiedColumns[':p' . $index++] = 'AREA_ID'; + } + if ($this->isColumnModified(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT)) { + $modifiedColumns[':p' . $index++] = 'CART_AMOUNT'; + } + + $sql = sprintf( + 'INSERT INTO colissimo_pickup_point_area_freeshipping (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'AREA_ID': + $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT); + break; + case 'CART_AMOUNT': + $stmt->bindValue($identifier, $this->cart_amount, PDO::PARAM_STR); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); + } + + try { + $pk = $con->lastInsertId(); + } catch (Exception $e) { + throw new PropelException('Unable to get autoincrement id.', 0, $e); + } + $this->setId($pk); + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = ColissimoPickupPointAreaFreeshippingTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getAreaId(); + break; + case 2: + return $this->getCartAmount(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['ColissimoPickupPointAreaFreeshipping'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['ColissimoPickupPointAreaFreeshipping'][$this->getPrimaryKey()] = true; + $keys = ColissimoPickupPointAreaFreeshippingTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getAreaId(), + $keys[2] => $this->getCartAmount(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aArea) { + $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = ColissimoPickupPointAreaFreeshippingTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setAreaId($value); + break; + case 2: + $this->setCartAmount($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = ColissimoPickupPointAreaFreeshippingTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setAreaId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setCartAmount($arr[$keys[2]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + + if ($this->isColumnModified(ColissimoPickupPointAreaFreeshippingTableMap::ID)) $criteria->add(ColissimoPickupPointAreaFreeshippingTableMap::ID, $this->id); + if ($this->isColumnModified(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID)) $criteria->add(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $this->area_id); + if ($this->isColumnModified(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT)) $criteria->add(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, $this->cart_amount); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + $criteria->add(ColissimoPickupPointAreaFreeshippingTableMap::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setAreaId($this->getAreaId()); + $copyObj->setCartAmount($this->getCartAmount()); + if ($makeNew) { + $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Declares an association between this object and a ChildArea object. + * + * @param ChildArea $v + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping The current object (for fluent API support) + * @throws PropelException + */ + public function setArea(ChildArea $v = null) + { + if ($v === null) { + $this->setAreaId(NULL); + } else { + $this->setAreaId($v->getId()); + } + + $this->aArea = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildArea object, it will not be re-added. + if ($v !== null) { + $v->addColissimoPickupPointAreaFreeshipping($this); + } + + + return $this; + } + + + /** + * Get the associated ChildArea object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildArea The associated ChildArea object. + * @throws PropelException + */ + public function getArea(ConnectionInterface $con = null) + { + if ($this->aArea === null && ($this->area_id !== null)) { + $this->aArea = AreaQuery::create()->findPk($this->area_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aArea->addColissimoPickupPointAreaFreeshippings($this); + */ + } + + return $this->aArea; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->area_id = null; + $this->cart_amount = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aArea = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(ColissimoPickupPointAreaFreeshippingTableMap::DEFAULT_STRING_FORMAT); + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointAreaFreeshippingQuery.php b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointAreaFreeshippingQuery.php new file mode 100644 index 00000000..eafcfcaf --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointAreaFreeshippingQuery.php @@ -0,0 +1,519 @@ +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. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildColissimoPickupPointAreaFreeshipping|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ColissimoPickupPointAreaFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointAreaFreeshippingTableMap::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 ChildColissimoPickupPointAreaFreeshipping A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, AREA_ID, CART_AMOUNT FROM colissimo_pickup_point_area_freeshipping 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 ChildColissimoPickupPointAreaFreeshipping(); + $obj->hydrate($row); + ColissimoPickupPointAreaFreeshippingTableMap::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 ChildColissimoPickupPointAreaFreeshipping|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 + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @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 ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::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 ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @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 ChildColissimoPickupPointAreaFreeshippingQuery 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(ColissimoPickupPointAreaFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the area_id column + * + * Example usage: + * + * $query->filterByAreaId(1234); // WHERE area_id = 1234 + * $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34) + * $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12 + * + * + * @see filterByArea() + * + * @param mixed $areaId 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 ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface + */ + public function filterByAreaId($areaId = null, $comparison = null) + { + if (is_array($areaId)) { + $useMinMax = false; + if (isset($areaId['min'])) { + $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($areaId['max'])) { + $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $areaId, $comparison); + } + + /** + * Filter the query on the cart_amount column + * + * Example usage: + * + * $query->filterByCartAmount(1234); // WHERE cart_amount = 1234 + * $query->filterByCartAmount(array(12, 34)); // WHERE cart_amount IN (12, 34) + * $query->filterByCartAmount(array('min' => 12)); // WHERE cart_amount > 12 + * + * + * @param mixed $cartAmount 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 ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface + */ + public function filterByCartAmount($cartAmount = null, $comparison = null) + { + if (is_array($cartAmount)) { + $useMinMax = false; + if (isset($cartAmount['min'])) { + $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($cartAmount['max'])) { + $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount, $comparison); + } + + /** + * Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\Area object + * + * @param \ColissimoPickupPoint\Model\Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface + */ + public function filterByArea($area, $comparison = null) + { + if ($area instanceof \ColissimoPickupPoint\Model\Thelia\Model\Area) { + return $this + ->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $area->getId(), $comparison); + } elseif ($area instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByArea() only accepts arguments of type \ColissimoPickupPoint\Model\Thelia\Model\Area or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Area relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface + */ + public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Area'); + + // 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, 'Area'); + } + + return $this; + } + + /** + * Use the Area relation Area 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 \ColissimoPickupPoint\Model\Thelia\Model\AreaQuery A secondary query class using the current class as primary query + */ + public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinArea($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Area', '\ColissimoPickupPoint\Model\Thelia\Model\AreaQuery'); + } + + /** + * Exclude object from result + * + * @param ChildColissimoPickupPointAreaFreeshipping $colissimoPickupPointAreaFreeshipping Object to remove from the list of results + * + * @return ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface + */ + public function prune($colissimoPickupPointAreaFreeshipping = null) + { + if ($colissimoPickupPointAreaFreeshipping) { + $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::ID, $colissimoPickupPointAreaFreeshipping->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the colissimo_pickup_point_area_freeshipping 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(ColissimoPickupPointAreaFreeshippingTableMap::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). + ColissimoPickupPointAreaFreeshippingTableMap::clearInstancePool(); + ColissimoPickupPointAreaFreeshippingTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildColissimoPickupPointAreaFreeshipping or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildColissimoPickupPointAreaFreeshipping 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(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(ColissimoPickupPointAreaFreeshippingTableMap::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(); + + + ColissimoPickupPointAreaFreeshippingTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + ColissimoPickupPointAreaFreeshippingTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // ColissimoPickupPointAreaFreeshippingQuery diff --git a/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointFreeshipping.php b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointFreeshipping.php new file mode 100644 index 00000000..22c1c039 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointFreeshipping.php @@ -0,0 +1,1184 @@ +active = false; + } + + /** + * Initializes internal state of ColissimoPickupPoint\Model\Base\ColissimoPickupPointFreeshipping object. + * @see applyDefaults() + */ + public function __construct() + { + $this->applyDefaultValues(); + } + + /** + * Returns whether the object has been modified. + * + * @return boolean True if the object has been modified. + */ + public function isModified() + { + return !!$this->modifiedColumns; + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return $this->modifiedColumns && isset($this->modifiedColumns[$col]); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return boolean true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + if (isset($this->modifiedColumns[$col])) { + unset($this->modifiedColumns[$col]); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another ColissimoPickupPointFreeshipping instance. If + * obj is an instance of ColissimoPickupPointFreeshipping, delegates to + * equals(ColissimoPickupPointFreeshipping). Otherwise, returns false. + * + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @param string $name The virtual column name + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @param string $name The virtual column name + * @return mixed + * + * @throws PropelException + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return ColissimoPickupPointFreeshipping The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return ColissimoPickupPointFreeshipping The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [active] column value. + * + * @return boolean + */ + public function getActive() + { + + return $this->active; + } + + /** + * Get the [freeshipping_from] column value. + * + * @return string + */ + public function getFreeshippingFrom() + { + + return $this->freeshipping_from; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[ColissimoPickupPointFreeshippingTableMap::ID] = true; + } + + + return $this; + } // setId() + + /** + * Sets the value of the [active] column. + * 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 boolean|integer|string $v The new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping The current object (for fluent API support) + */ + public function setActive($v) + { + if ($v !== null) { + if (is_string($v)) { + $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } else { + $v = (boolean) $v; + } + } + + if ($this->active !== $v) { + $this->active = $v; + $this->modifiedColumns[ColissimoPickupPointFreeshippingTableMap::ACTIVE] = true; + } + + + return $this; + } // setActive() + + /** + * Set the value of [freeshipping_from] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping The current object (for fluent API support) + */ + public function setFreeshippingFrom($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->freeshipping_from !== $v) { + $this->freeshipping_from = $v; + $this->modifiedColumns[ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM] = true; + } + + + return $this; + } // setFreeshippingFrom() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->active !== false) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ColissimoPickupPointFreeshippingTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ColissimoPickupPointFreeshippingTableMap::translateFieldName('Active', TableMap::TYPE_PHPNAME, $indexType)]; + $this->active = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ColissimoPickupPointFreeshippingTableMap::translateFieldName('FreeshippingFrom', TableMap::TYPE_PHPNAME, $indexType)]; + $this->freeshipping_from = (null !== $col) ? (string) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = ColissimoPickupPointFreeshippingTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildColissimoPickupPointFreeshippingQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see ColissimoPickupPointFreeshipping::setDeleted() + * @see ColissimoPickupPointFreeshipping::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildColissimoPickupPointFreeshippingQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + ColissimoPickupPointFreeshippingTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(ColissimoPickupPointFreeshippingTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(ColissimoPickupPointFreeshippingTableMap::ACTIVE)) { + $modifiedColumns[':p' . $index++] = 'ACTIVE'; + } + if ($this->isColumnModified(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM)) { + $modifiedColumns[':p' . $index++] = 'FREESHIPPING_FROM'; + } + + $sql = sprintf( + 'INSERT INTO colissimo_pickup_point_freeshipping (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'ACTIVE': + $stmt->bindValue($identifier, (int) $this->active, PDO::PARAM_INT); + break; + case 'FREESHIPPING_FROM': + $stmt->bindValue($identifier, $this->freeshipping_from, PDO::PARAM_STR); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); + } + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = ColissimoPickupPointFreeshippingTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getActive(); + break; + case 2: + return $this->getFreeshippingFrom(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array()) + { + if (isset($alreadyDumpedObjects['ColissimoPickupPointFreeshipping'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['ColissimoPickupPointFreeshipping'][$this->getPrimaryKey()] = true; + $keys = ColissimoPickupPointFreeshippingTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getActive(), + $keys[2] => $this->getFreeshippingFrom(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = ColissimoPickupPointFreeshippingTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setActive($value); + break; + case 2: + $this->setFreeshippingFrom($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = ColissimoPickupPointFreeshippingTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setActive($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setFreeshippingFrom($arr[$keys[2]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + + if ($this->isColumnModified(ColissimoPickupPointFreeshippingTableMap::ID)) $criteria->add(ColissimoPickupPointFreeshippingTableMap::ID, $this->id); + if ($this->isColumnModified(ColissimoPickupPointFreeshippingTableMap::ACTIVE)) $criteria->add(ColissimoPickupPointFreeshippingTableMap::ACTIVE, $this->active); + if ($this->isColumnModified(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM)) $criteria->add(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, $this->freeshipping_from); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + $criteria->add(ColissimoPickupPointFreeshippingTableMap::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setId($this->getId()); + $copyObj->setActive($this->getActive()); + $copyObj->setFreeshippingFrom($this->getFreeshippingFrom()); + if ($makeNew) { + $copyObj->setNew(true); + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->active = null; + $this->freeshipping_from = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(ColissimoPickupPointFreeshippingTableMap::DEFAULT_STRING_FORMAT); + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointFreeshippingQuery.php b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointFreeshippingQuery.php new file mode 100644 index 00000000..f9121ba8 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointFreeshippingQuery.php @@ -0,0 +1,420 @@ +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. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildColissimoPickupPointFreeshipping|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ColissimoPickupPointFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointFreeshippingTableMap::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 ChildColissimoPickupPointFreeshipping A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, ACTIVE, FREESHIPPING_FROM FROM colissimo_pickup_point_freeshipping 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 ChildColissimoPickupPointFreeshipping(); + $obj->hydrate($row); + ColissimoPickupPointFreeshippingTableMap::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 ChildColissimoPickupPointFreeshipping|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 + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @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 ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::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 ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @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 ChildColissimoPickupPointFreeshippingQuery 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(ColissimoPickupPointFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the active column + * + * Example usage: + * + * $query->filterByActive(true); // WHERE active = true + * $query->filterByActive('yes'); // WHERE active = true + * + * + * @param boolean|string $active 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 ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface + */ + public function filterByActive($active = null, $comparison = null) + { + if (is_string($active)) { + $active = in_array(strtolower($active), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ACTIVE, $active, $comparison); + } + + /** + * Filter the query on the freeshipping_from column + * + * Example usage: + * + * $query->filterByFreeshippingFrom(1234); // WHERE freeshipping_from = 1234 + * $query->filterByFreeshippingFrom(array(12, 34)); // WHERE freeshipping_from IN (12, 34) + * $query->filterByFreeshippingFrom(array('min' => 12)); // WHERE freeshipping_from > 12 + * + * + * @param mixed $freeshippingFrom 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 ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface + */ + public function filterByFreeshippingFrom($freeshippingFrom = null, $comparison = null) + { + if (is_array($freeshippingFrom)) { + $useMinMax = false; + if (isset($freeshippingFrom['min'])) { + $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, $freeshippingFrom['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($freeshippingFrom['max'])) { + $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, $freeshippingFrom['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, $freeshippingFrom, $comparison); + } + + /** + * Exclude object from result + * + * @param ChildColissimoPickupPointFreeshipping $colissimoPickupPointFreeshipping Object to remove from the list of results + * + * @return ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface + */ + public function prune($colissimoPickupPointFreeshipping = null) + { + if ($colissimoPickupPointFreeshipping) { + $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ID, $colissimoPickupPointFreeshipping->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the colissimo_pickup_point_freeshipping 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(ColissimoPickupPointFreeshippingTableMap::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). + ColissimoPickupPointFreeshippingTableMap::clearInstancePool(); + ColissimoPickupPointFreeshippingTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildColissimoPickupPointFreeshipping or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildColissimoPickupPointFreeshipping 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(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(ColissimoPickupPointFreeshippingTableMap::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(); + + + ColissimoPickupPointFreeshippingTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + ColissimoPickupPointFreeshippingTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // ColissimoPickupPointFreeshippingQuery diff --git a/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointPriceSlices.php b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointPriceSlices.php new file mode 100644 index 00000000..e308c628 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointPriceSlices.php @@ -0,0 +1,1427 @@ +modifiedColumns; + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return $this->modifiedColumns && isset($this->modifiedColumns[$col]); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return boolean true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + if (isset($this->modifiedColumns[$col])) { + unset($this->modifiedColumns[$col]); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another ColissimoPickupPointPriceSlices instance. If + * obj is an instance of ColissimoPickupPointPriceSlices, delegates to + * equals(ColissimoPickupPointPriceSlices). Otherwise, returns false. + * + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @param string $name The virtual column name + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @param string $name The virtual column name + * @return mixed + * + * @throws PropelException + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return ColissimoPickupPointPriceSlices The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return ColissimoPickupPointPriceSlices The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [area_id] column value. + * + * @return int + */ + public function getAreaId() + { + + return $this->area_id; + } + + /** + * Get the [weight_max] column value. + * + * @return double + */ + public function getWeightMax() + { + + return $this->weight_max; + } + + /** + * Get the [price_max] column value. + * + * @return double + */ + public function getPriceMax() + { + + return $this->price_max; + } + + /** + * Get the [franco_min_price] column value. + * + * @return double + */ + public function getFrancoMinPrice() + { + + return $this->franco_min_price; + } + + /** + * Get the [price] column value. + * + * @return double + */ + public function getPrice() + { + + return $this->price; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[ColissimoPickupPointPriceSlicesTableMap::ID] = true; + } + + + return $this; + } // setId() + + /** + * Set the value of [area_id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices The current object (for fluent API support) + */ + public function setAreaId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->area_id !== $v) { + $this->area_id = $v; + $this->modifiedColumns[ColissimoPickupPointPriceSlicesTableMap::AREA_ID] = true; + } + + if ($this->aArea !== null && $this->aArea->getId() !== $v) { + $this->aArea = null; + } + + + return $this; + } // setAreaId() + + /** + * Set the value of [weight_max] column. + * + * @param double $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices The current object (for fluent API support) + */ + public function setWeightMax($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->weight_max !== $v) { + $this->weight_max = $v; + $this->modifiedColumns[ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX] = true; + } + + + return $this; + } // setWeightMax() + + /** + * Set the value of [price_max] column. + * + * @param double $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices The current object (for fluent API support) + */ + public function setPriceMax($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->price_max !== $v) { + $this->price_max = $v; + $this->modifiedColumns[ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX] = true; + } + + + return $this; + } // setPriceMax() + + /** + * Set the value of [franco_min_price] column. + * + * @param double $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices The current object (for fluent API support) + */ + public function setFrancoMinPrice($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->franco_min_price !== $v) { + $this->franco_min_price = $v; + $this->modifiedColumns[ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE] = true; + } + + + return $this; + } // setFrancoMinPrice() + + /** + * Set the value of [price] column. + * + * @param double $v new value + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices The current object (for fluent API support) + */ + public function setPrice($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->price !== $v) { + $this->price = $v; + $this->modifiedColumns[ColissimoPickupPointPriceSlicesTableMap::PRICE] = true; + } + + + return $this; + } // setPrice() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ColissimoPickupPointPriceSlicesTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ColissimoPickupPointPriceSlicesTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->area_id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ColissimoPickupPointPriceSlicesTableMap::translateFieldName('WeightMax', TableMap::TYPE_PHPNAME, $indexType)]; + $this->weight_max = (null !== $col) ? (double) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ColissimoPickupPointPriceSlicesTableMap::translateFieldName('PriceMax', TableMap::TYPE_PHPNAME, $indexType)]; + $this->price_max = (null !== $col) ? (double) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ColissimoPickupPointPriceSlicesTableMap::translateFieldName('FrancoMinPrice', TableMap::TYPE_PHPNAME, $indexType)]; + $this->franco_min_price = (null !== $col) ? (double) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ColissimoPickupPointPriceSlicesTableMap::translateFieldName('Price', TableMap::TYPE_PHPNAME, $indexType)]; + $this->price = (null !== $col) ? (double) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 6; // 6 = ColissimoPickupPointPriceSlicesTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) { + $this->aArea = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildColissimoPickupPointPriceSlicesQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aArea = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see ColissimoPickupPointPriceSlices::setDeleted() + * @see ColissimoPickupPointPriceSlices::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildColissimoPickupPointPriceSlicesQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + ColissimoPickupPointPriceSlicesTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aArea !== null) { + if ($this->aArea->isModified() || $this->aArea->isNew()) { + $affectedRows += $this->aArea->save($con); + } + $this->setArea($this->aArea); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + $this->modifiedColumns[ColissimoPickupPointPriceSlicesTableMap::ID] = true; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ColissimoPickupPointPriceSlicesTableMap::ID . ')'); + } + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::AREA_ID)) { + $modifiedColumns[':p' . $index++] = 'AREA_ID'; + } + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX)) { + $modifiedColumns[':p' . $index++] = 'WEIGHT_MAX'; + } + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX)) { + $modifiedColumns[':p' . $index++] = 'PRICE_MAX'; + } + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE)) { + $modifiedColumns[':p' . $index++] = 'FRANCO_MIN_PRICE'; + } + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::PRICE)) { + $modifiedColumns[':p' . $index++] = 'PRICE'; + } + + $sql = sprintf( + 'INSERT INTO colissimo_pickup_point_price_slices (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'AREA_ID': + $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT); + break; + case 'WEIGHT_MAX': + $stmt->bindValue($identifier, $this->weight_max, PDO::PARAM_STR); + break; + case 'PRICE_MAX': + $stmt->bindValue($identifier, $this->price_max, PDO::PARAM_STR); + break; + case 'FRANCO_MIN_PRICE': + $stmt->bindValue($identifier, $this->franco_min_price, PDO::PARAM_STR); + break; + case 'PRICE': + $stmt->bindValue($identifier, $this->price, PDO::PARAM_STR); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); + } + + try { + $pk = $con->lastInsertId(); + } catch (Exception $e) { + throw new PropelException('Unable to get autoincrement id.', 0, $e); + } + $this->setId($pk); + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = ColissimoPickupPointPriceSlicesTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getAreaId(); + break; + case 2: + return $this->getWeightMax(); + break; + case 3: + return $this->getPriceMax(); + break; + case 4: + return $this->getFrancoMinPrice(); + break; + case 5: + return $this->getPrice(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['ColissimoPickupPointPriceSlices'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['ColissimoPickupPointPriceSlices'][$this->getPrimaryKey()] = true; + $keys = ColissimoPickupPointPriceSlicesTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getAreaId(), + $keys[2] => $this->getWeightMax(), + $keys[3] => $this->getPriceMax(), + $keys[4] => $this->getFrancoMinPrice(), + $keys[5] => $this->getPrice(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aArea) { + $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = ColissimoPickupPointPriceSlicesTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setAreaId($value); + break; + case 2: + $this->setWeightMax($value); + break; + case 3: + $this->setPriceMax($value); + break; + case 4: + $this->setFrancoMinPrice($value); + break; + case 5: + $this->setPrice($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = ColissimoPickupPointPriceSlicesTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setAreaId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setWeightMax($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setPriceMax($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setFrancoMinPrice($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setPrice($arr[$keys[5]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::ID)) $criteria->add(ColissimoPickupPointPriceSlicesTableMap::ID, $this->id); + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::AREA_ID)) $criteria->add(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $this->area_id); + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX)) $criteria->add(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, $this->weight_max); + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX)) $criteria->add(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, $this->price_max); + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE)) $criteria->add(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, $this->franco_min_price); + if ($this->isColumnModified(ColissimoPickupPointPriceSlicesTableMap::PRICE)) $criteria->add(ColissimoPickupPointPriceSlicesTableMap::PRICE, $this->price); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + $criteria->add(ColissimoPickupPointPriceSlicesTableMap::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setAreaId($this->getAreaId()); + $copyObj->setWeightMax($this->getWeightMax()); + $copyObj->setPriceMax($this->getPriceMax()); + $copyObj->setFrancoMinPrice($this->getFrancoMinPrice()); + $copyObj->setPrice($this->getPrice()); + if ($makeNew) { + $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Declares an association between this object and a ChildArea object. + * + * @param ChildArea $v + * @return \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices The current object (for fluent API support) + * @throws PropelException + */ + public function setArea(ChildArea $v = null) + { + if ($v === null) { + $this->setAreaId(NULL); + } else { + $this->setAreaId($v->getId()); + } + + $this->aArea = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildArea object, it will not be re-added. + if ($v !== null) { + $v->addColissimoPickupPointPriceSlices($this); + } + + + return $this; + } + + + /** + * Get the associated ChildArea object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildArea The associated ChildArea object. + * @throws PropelException + */ + public function getArea(ConnectionInterface $con = null) + { + if ($this->aArea === null && ($this->area_id !== null)) { + $this->aArea = AreaQuery::create()->findPk($this->area_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aArea->addColissimoPickupPointPriceSlicess($this); + */ + } + + return $this->aArea; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->area_id = null; + $this->weight_max = null; + $this->price_max = null; + $this->franco_min_price = null; + $this->price = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aArea = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(ColissimoPickupPointPriceSlicesTableMap::DEFAULT_STRING_FORMAT); + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointPriceSlicesQuery.php b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointPriceSlicesQuery.php new file mode 100644 index 00000000..ded790ea --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/ColissimoPickupPointPriceSlicesQuery.php @@ -0,0 +1,654 @@ +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. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildColissimoPickupPointPriceSlices|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ColissimoPickupPointPriceSlicesTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointPriceSlicesTableMap::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 ChildColissimoPickupPointPriceSlices A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, AREA_ID, WEIGHT_MAX, PRICE_MAX, FRANCO_MIN_PRICE, PRICE FROM colissimo_pickup_point_price_slices 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 ChildColissimoPickupPointPriceSlices(); + $obj->hydrate($row); + ColissimoPickupPointPriceSlicesTableMap::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 ChildColissimoPickupPointPriceSlices|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 + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @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 ChildColissimoPickupPointPriceSlicesQuery 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(ColissimoPickupPointPriceSlicesTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the area_id column + * + * Example usage: + * + * $query->filterByAreaId(1234); // WHERE area_id = 1234 + * $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34) + * $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12 + * + * + * @see filterByArea() + * + * @param mixed $areaId 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function filterByAreaId($areaId = null, $comparison = null) + { + if (is_array($areaId)) { + $useMinMax = false; + if (isset($areaId['min'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($areaId['max'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $areaId, $comparison); + } + + /** + * Filter the query on the weight_max column + * + * Example usage: + * + * $query->filterByWeightMax(1234); // WHERE weight_max = 1234 + * $query->filterByWeightMax(array(12, 34)); // WHERE weight_max IN (12, 34) + * $query->filterByWeightMax(array('min' => 12)); // WHERE weight_max > 12 + * + * + * @param mixed $weightMax 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function filterByWeightMax($weightMax = null, $comparison = null) + { + if (is_array($weightMax)) { + $useMinMax = false; + if (isset($weightMax['min'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, $weightMax['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($weightMax['max'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, $weightMax['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, $weightMax, $comparison); + } + + /** + * Filter the query on the price_max column + * + * Example usage: + * + * $query->filterByPriceMax(1234); // WHERE price_max = 1234 + * $query->filterByPriceMax(array(12, 34)); // WHERE price_max IN (12, 34) + * $query->filterByPriceMax(array('min' => 12)); // WHERE price_max > 12 + * + * + * @param mixed $priceMax 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function filterByPriceMax($priceMax = null, $comparison = null) + { + if (is_array($priceMax)) { + $useMinMax = false; + if (isset($priceMax['min'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, $priceMax['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($priceMax['max'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, $priceMax['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, $priceMax, $comparison); + } + + /** + * Filter the query on the franco_min_price column + * + * Example usage: + * + * $query->filterByFrancoMinPrice(1234); // WHERE franco_min_price = 1234 + * $query->filterByFrancoMinPrice(array(12, 34)); // WHERE franco_min_price IN (12, 34) + * $query->filterByFrancoMinPrice(array('min' => 12)); // WHERE franco_min_price > 12 + * + * + * @param mixed $francoMinPrice 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function filterByFrancoMinPrice($francoMinPrice = null, $comparison = null) + { + if (is_array($francoMinPrice)) { + $useMinMax = false; + if (isset($francoMinPrice['min'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($francoMinPrice['max'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice, $comparison); + } + + /** + * Filter the query on the price column + * + * Example usage: + * + * $query->filterByPrice(1234); // WHERE price = 1234 + * $query->filterByPrice(array(12, 34)); // WHERE price IN (12, 34) + * $query->filterByPrice(array('min' => 12)); // WHERE price > 12 + * + * + * @param mixed $price 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function filterByPrice($price = null, $comparison = null) + { + if (is_array($price)) { + $useMinMax = false; + if (isset($price['min'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE, $price['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($price['max'])) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE, $price['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE, $price, $comparison); + } + + /** + * Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\Area object + * + * @param \ColissimoPickupPoint\Model\Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function filterByArea($area, $comparison = null) + { + if ($area instanceof \ColissimoPickupPoint\Model\Thelia\Model\Area) { + return $this + ->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $area->getId(), $comparison); + } elseif ($area instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByArea() only accepts arguments of type \ColissimoPickupPoint\Model\Thelia\Model\Area or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Area relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Area'); + + // 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, 'Area'); + } + + return $this; + } + + /** + * Use the Area relation Area 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 \ColissimoPickupPoint\Model\Thelia\Model\AreaQuery A secondary query class using the current class as primary query + */ + public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinArea($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Area', '\ColissimoPickupPoint\Model\Thelia\Model\AreaQuery'); + } + + /** + * Exclude object from result + * + * @param ChildColissimoPickupPointPriceSlices $colissimoPickupPointPriceSlices Object to remove from the list of results + * + * @return ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface + */ + public function prune($colissimoPickupPointPriceSlices = null) + { + if ($colissimoPickupPointPriceSlices) { + $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::ID, $colissimoPickupPointPriceSlices->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the colissimo_pickup_point_price_slices 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(ColissimoPickupPointPriceSlicesTableMap::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). + ColissimoPickupPointPriceSlicesTableMap::clearInstancePool(); + ColissimoPickupPointPriceSlicesTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildColissimoPickupPointPriceSlices or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildColissimoPickupPointPriceSlices 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(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(ColissimoPickupPointPriceSlicesTableMap::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(); + + + ColissimoPickupPointPriceSlicesTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + ColissimoPickupPointPriceSlicesTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // ColissimoPickupPointPriceSlicesQuery diff --git a/local/modules/ColissimoPickupPoint/Model/Base/OrderAddressColissimoPickupPoint.php b/local/modules/ColissimoPickupPoint/Model/Base/OrderAddressColissimoPickupPoint.php new file mode 100644 index 00000000..fb4fa11a --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/OrderAddressColissimoPickupPoint.php @@ -0,0 +1,1236 @@ +modifiedColumns; + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return $this->modifiedColumns && isset($this->modifiedColumns[$col]); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return boolean true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + if (isset($this->modifiedColumns[$col])) { + unset($this->modifiedColumns[$col]); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another OrderAddressColissimoPickupPoint instance. If + * obj is an instance of OrderAddressColissimoPickupPoint, delegates to + * equals(OrderAddressColissimoPickupPoint). Otherwise, returns false. + * + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @param string $name The virtual column name + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @param string $name The virtual column name + * @return mixed + * + * @throws PropelException + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return OrderAddressColissimoPickupPoint The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return OrderAddressColissimoPickupPoint The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [code] column value. + * + * @return string + */ + public function getCode() + { + + return $this->code; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getType() + { + + return $this->type; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[OrderAddressColissimoPickupPointTableMap::ID] = true; + } + + if ($this->aOrderAddress !== null && $this->aOrderAddress->getId() !== $v) { + $this->aOrderAddress = null; + } + + + return $this; + } // setId() + + /** + * Set the value of [code] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setCode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->code !== $v) { + $this->code = $v; + $this->modifiedColumns[OrderAddressColissimoPickupPointTableMap::CODE] = true; + } + + + return $this; + } // setCode() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[OrderAddressColissimoPickupPointTableMap::TYPE] = true; + } + + + return $this; + } // setType() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : OrderAddressColissimoPickupPointTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : OrderAddressColissimoPickupPointTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; + $this->code = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : OrderAddressColissimoPickupPointTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; + $this->type = (null !== $col) ? (string) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = OrderAddressColissimoPickupPointTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + if ($this->aOrderAddress !== null && $this->id !== $this->aOrderAddress->getId()) { + $this->aOrderAddress = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildOrderAddressColissimoPickupPointQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aOrderAddress = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see OrderAddressColissimoPickupPoint::setDeleted() + * @see OrderAddressColissimoPickupPoint::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildOrderAddressColissimoPickupPointQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + OrderAddressColissimoPickupPointTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aOrderAddress !== null) { + if ($this->aOrderAddress->isModified() || $this->aOrderAddress->isNew()) { + $affectedRows += $this->aOrderAddress->save($con); + } + $this->setOrderAddress($this->aOrderAddress); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(OrderAddressColissimoPickupPointTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(OrderAddressColissimoPickupPointTableMap::CODE)) { + $modifiedColumns[':p' . $index++] = 'CODE'; + } + if ($this->isColumnModified(OrderAddressColissimoPickupPointTableMap::TYPE)) { + $modifiedColumns[':p' . $index++] = 'TYPE'; + } + + $sql = sprintf( + 'INSERT INTO order_address_colissimo_pickup_point (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'CODE': + $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + break; + case 'TYPE': + $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); + } + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = OrderAddressColissimoPickupPointTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getCode(); + break; + case 2: + return $this->getType(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['OrderAddressColissimoPickupPoint'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['OrderAddressColissimoPickupPoint'][$this->getPrimaryKey()] = true; + $keys = OrderAddressColissimoPickupPointTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getCode(), + $keys[2] => $this->getType(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aOrderAddress) { + $result['OrderAddress'] = $this->aOrderAddress->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = OrderAddressColissimoPickupPointTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setCode($value); + break; + case 2: + $this->setType($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = OrderAddressColissimoPickupPointTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + + if ($this->isColumnModified(OrderAddressColissimoPickupPointTableMap::ID)) $criteria->add(OrderAddressColissimoPickupPointTableMap::ID, $this->id); + if ($this->isColumnModified(OrderAddressColissimoPickupPointTableMap::CODE)) $criteria->add(OrderAddressColissimoPickupPointTableMap::CODE, $this->code); + if ($this->isColumnModified(OrderAddressColissimoPickupPointTableMap::TYPE)) $criteria->add(OrderAddressColissimoPickupPointTableMap::TYPE, $this->type); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + $criteria->add(OrderAddressColissimoPickupPointTableMap::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setId($this->getId()); + $copyObj->setCode($this->getCode()); + $copyObj->setType($this->getType()); + if ($makeNew) { + $copyObj->setNew(true); + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Declares an association between this object and a ChildOrderAddress object. + * + * @param ChildOrderAddress $v + * @return \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint The current object (for fluent API support) + * @throws PropelException + */ + public function setOrderAddress(ChildOrderAddress $v = null) + { + if ($v === null) { + $this->setId(NULL); + } else { + $this->setId($v->getId()); + } + + $this->aOrderAddress = $v; + + // Add binding for other direction of this 1:1 relationship. + if ($v !== null) { + $v->setOrderAddressColissimoPickupPoint($this); + } + + + return $this; + } + + + /** + * Get the associated ChildOrderAddress object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildOrderAddress The associated ChildOrderAddress object. + * @throws PropelException + */ + public function getOrderAddress(ConnectionInterface $con = null) + { + if ($this->aOrderAddress === null && ($this->id !== null)) { + $this->aOrderAddress = OrderAddressQuery::create()->findPk($this->id, $con); + // Because this foreign key represents a one-to-one relationship, we will create a bi-directional association. + $this->aOrderAddress->setOrderAddressColissimoPickupPoint($this); + } + + return $this->aOrderAddress; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->code = null; + $this->type = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aOrderAddress = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(OrderAddressColissimoPickupPointTableMap::DEFAULT_STRING_FORMAT); + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/local/modules/ColissimoPickupPoint/Model/Base/OrderAddressColissimoPickupPointQuery.php b/local/modules/ColissimoPickupPoint/Model/Base/OrderAddressColissimoPickupPointQuery.php new file mode 100644 index 00000000..c517ea98 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Base/OrderAddressColissimoPickupPointQuery.php @@ -0,0 +1,495 @@ +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. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildOrderAddressColissimoPickupPoint|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = OrderAddressColissimoPickupPointTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(OrderAddressColissimoPickupPointTableMap::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 ChildOrderAddressColissimoPickupPoint A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, CODE, TYPE FROM order_address_colissimo_pickup_point 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 ChildOrderAddressColissimoPickupPoint(); + $obj->hydrate($row); + OrderAddressColissimoPickupPointTableMap::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 ChildOrderAddressColissimoPickupPoint|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 + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @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 ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::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 ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @see filterByOrderAddress() + * + * @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 ChildOrderAddressColissimoPickupPointQuery 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(OrderAddressColissimoPickupPointTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the code column + * + * Example usage: + * + * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' + * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * + * + * @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 ChildOrderAddressColissimoPickupPointQuery 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(OrderAddressColissimoPickupPointTableMap::CODE, $code, $comparison); + } + + /** + * Filter the query on the type column + * + * Example usage: + * + * $query->filterByType('fooValue'); // WHERE type = 'fooValue' + * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%' + * + * + * @param string $type 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 ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByType($type = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($type)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $type)) { + $type = str_replace('*', '%', $type); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::TYPE, $type, $comparison); + } + + /** + * Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\OrderAddress object + * + * @param \ColissimoPickupPoint\Model\Thelia\Model\OrderAddress|ObjectCollection $orderAddress The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function filterByOrderAddress($orderAddress, $comparison = null) + { + if ($orderAddress instanceof \ColissimoPickupPoint\Model\Thelia\Model\OrderAddress) { + return $this + ->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $orderAddress->getId(), $comparison); + } elseif ($orderAddress instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByOrderAddress() only accepts arguments of type \ColissimoPickupPoint\Model\Thelia\Model\OrderAddress or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the OrderAddress relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function joinOrderAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('OrderAddress'); + + // 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, 'OrderAddress'); + } + + return $this; + } + + /** + * Use the OrderAddress relation OrderAddress 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 \ColissimoPickupPoint\Model\Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query + */ + public function useOrderAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinOrderAddress($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'OrderAddress', '\ColissimoPickupPoint\Model\Thelia\Model\OrderAddressQuery'); + } + + /** + * Exclude object from result + * + * @param ChildOrderAddressColissimoPickupPoint $orderAddressColissimoPickupPoint Object to remove from the list of results + * + * @return ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface + */ + public function prune($orderAddressColissimoPickupPoint = null) + { + if ($orderAddressColissimoPickupPoint) { + $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $orderAddressColissimoPickupPoint->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the order_address_colissimo_pickup_point 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(OrderAddressColissimoPickupPointTableMap::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). + OrderAddressColissimoPickupPointTableMap::clearInstancePool(); + OrderAddressColissimoPickupPointTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildOrderAddressColissimoPickupPoint or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildOrderAddressColissimoPickupPoint 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(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(OrderAddressColissimoPickupPointTableMap::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(); + + + OrderAddressColissimoPickupPointTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + OrderAddressColissimoPickupPointTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // OrderAddressColissimoPickupPointQuery diff --git a/local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointAreaFreeshipping.php b/local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointAreaFreeshipping.php new file mode 100644 index 00000000..7c2fd1fa --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/ColissimoPickupPointAreaFreeshipping.php @@ -0,0 +1,10 @@ + array('Id', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Code', 'Type', 'Cellphone', ), + self::TYPE_STUDLYPHPNAME => array('id', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'code', 'type', 'cellphone', ), + self::TYPE_COLNAME => array(AddressColissimoPickupPointTableMap::ID, AddressColissimoPickupPointTableMap::TITLE_ID, AddressColissimoPickupPointTableMap::COMPANY, AddressColissimoPickupPointTableMap::FIRSTNAME, AddressColissimoPickupPointTableMap::LASTNAME, AddressColissimoPickupPointTableMap::ADDRESS1, AddressColissimoPickupPointTableMap::ADDRESS2, AddressColissimoPickupPointTableMap::ADDRESS3, AddressColissimoPickupPointTableMap::ZIPCODE, AddressColissimoPickupPointTableMap::CITY, AddressColissimoPickupPointTableMap::COUNTRY_ID, AddressColissimoPickupPointTableMap::CODE, AddressColissimoPickupPointTableMap::TYPE, AddressColissimoPickupPointTableMap::CELLPHONE, ), + self::TYPE_RAW_COLNAME => array('ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'CODE', 'TYPE', 'CELLPHONE', ), + self::TYPE_FIELDNAME => array('id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'code', 'type', 'cellphone', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'TitleId' => 1, 'Company' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Address1' => 5, 'Address2' => 6, 'Address3' => 7, 'Zipcode' => 8, 'City' => 9, 'CountryId' => 10, 'Code' => 11, 'Type' => 12, 'Cellphone' => 13, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'titleId' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'countryId' => 10, 'code' => 11, 'type' => 12, 'cellphone' => 13, ), + self::TYPE_COLNAME => array(AddressColissimoPickupPointTableMap::ID => 0, AddressColissimoPickupPointTableMap::TITLE_ID => 1, AddressColissimoPickupPointTableMap::COMPANY => 2, AddressColissimoPickupPointTableMap::FIRSTNAME => 3, AddressColissimoPickupPointTableMap::LASTNAME => 4, AddressColissimoPickupPointTableMap::ADDRESS1 => 5, AddressColissimoPickupPointTableMap::ADDRESS2 => 6, AddressColissimoPickupPointTableMap::ADDRESS3 => 7, AddressColissimoPickupPointTableMap::ZIPCODE => 8, AddressColissimoPickupPointTableMap::CITY => 9, AddressColissimoPickupPointTableMap::COUNTRY_ID => 10, AddressColissimoPickupPointTableMap::CODE => 11, AddressColissimoPickupPointTableMap::TYPE => 12, AddressColissimoPickupPointTableMap::CELLPHONE => 13, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE_ID' => 1, 'COMPANY' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'ADDRESS1' => 5, 'ADDRESS2' => 6, 'ADDRESS3' => 7, 'ZIPCODE' => 8, 'CITY' => 9, 'COUNTRY_ID' => 10, 'CODE' => 11, 'TYPE' => 12, 'CELLPHONE' => 13, ), + self::TYPE_FIELDNAME => array('id' => 0, 'title_id' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'country_id' => 10, 'code' => 11, 'type' => 12, 'cellphone' => 13, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('address_colissimo_pickup_point'); + $this->setPhpName('AddressColissimoPickupPoint'); + $this->setClassName('\\ColissimoPickupPoint\\Model\\AddressColissimoPickupPoint'); + $this->setPackage('ColissimoPickupPoint.Model'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null); + $this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null); + $this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null); + $this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null); + $this->addColumn('ADDRESS1', 'Address1', 'VARCHAR', true, 255, null); + $this->addColumn('ADDRESS2', 'Address2', 'VARCHAR', true, 255, null); + $this->addColumn('ADDRESS3', 'Address3', 'VARCHAR', true, 255, null); + $this->addColumn('ZIPCODE', 'Zipcode', 'VARCHAR', true, 10, null); + $this->addColumn('CITY', 'City', 'VARCHAR', true, 255, null); + $this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', true, null, null); + $this->addColumn('CODE', 'Code', 'VARCHAR', true, 10, null); + $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 10, null); + $this->addColumn('CELLPHONE', 'Cellphone', 'VARCHAR', false, 20, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CustomerTitle', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT'); + $this->addRelation('Country', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'RESTRICT', 'RESTRICT'); + } // buildRelations() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return (int) $row[ + $indexType == TableMap::TYPE_NUM + ? 0 + $offset + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) + ]; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? AddressColissimoPickupPointTableMap::CLASS_DEFAULT : AddressColissimoPickupPointTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (AddressColissimoPickupPoint object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = AddressColissimoPickupPointTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = AddressColissimoPickupPointTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + AddressColissimoPickupPointTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = AddressColissimoPickupPointTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + AddressColissimoPickupPointTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = AddressColissimoPickupPointTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = AddressColissimoPickupPointTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + AddressColissimoPickupPointTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ID); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::TITLE_ID); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::COMPANY); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::FIRSTNAME); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::LASTNAME); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ADDRESS1); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ADDRESS2); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ADDRESS3); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ZIPCODE); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::CITY); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::COUNTRY_ID); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::CODE); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::TYPE); + $criteria->addSelectColumn(AddressColissimoPickupPointTableMap::CELLPHONE); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.TITLE_ID'); + $criteria->addSelectColumn($alias . '.COMPANY'); + $criteria->addSelectColumn($alias . '.FIRSTNAME'); + $criteria->addSelectColumn($alias . '.LASTNAME'); + $criteria->addSelectColumn($alias . '.ADDRESS1'); + $criteria->addSelectColumn($alias . '.ADDRESS2'); + $criteria->addSelectColumn($alias . '.ADDRESS3'); + $criteria->addSelectColumn($alias . '.ZIPCODE'); + $criteria->addSelectColumn($alias . '.CITY'); + $criteria->addSelectColumn($alias . '.COUNTRY_ID'); + $criteria->addSelectColumn($alias . '.CODE'); + $criteria->addSelectColumn($alias . '.TYPE'); + $criteria->addSelectColumn($alias . '.CELLPHONE'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(AddressColissimoPickupPointTableMap::DATABASE_NAME)->getTable(AddressColissimoPickupPointTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(AddressColissimoPickupPointTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(AddressColissimoPickupPointTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new AddressColissimoPickupPointTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a AddressColissimoPickupPoint or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or AddressColissimoPickupPoint 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 static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(AddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \ColissimoPickupPoint\Model\AddressColissimoPickupPoint) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(AddressColissimoPickupPointTableMap::DATABASE_NAME); + $criteria->add(AddressColissimoPickupPointTableMap::ID, (array) $values, Criteria::IN); + } + + $query = AddressColissimoPickupPointQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { AddressColissimoPickupPointTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { AddressColissimoPickupPointTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the address_colissimo_pickup_point table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return AddressColissimoPickupPointQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a AddressColissimoPickupPoint or Criteria object. + * + * @param mixed $criteria Criteria or AddressColissimoPickupPoint object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(AddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from AddressColissimoPickupPoint object + } + + + // Set the correct dbName + $query = AddressColissimoPickupPointQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // AddressColissimoPickupPointTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +AddressColissimoPickupPointTableMap::buildTableMap(); diff --git a/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointAreaFreeshippingTableMap.php b/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointAreaFreeshippingTableMap.php new file mode 100644 index 00000000..8933c601 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointAreaFreeshippingTableMap.php @@ -0,0 +1,419 @@ + array('Id', 'AreaId', 'CartAmount', ), + self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'cartAmount', ), + self::TYPE_COLNAME => array(ColissimoPickupPointAreaFreeshippingTableMap::ID, ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, ), + self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'CART_AMOUNT', ), + self::TYPE_FIELDNAME => array('id', 'area_id', 'cart_amount', ), + self::TYPE_NUM => array(0, 1, 2, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'CartAmount' => 2, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'cartAmount' => 2, ), + self::TYPE_COLNAME => array(ColissimoPickupPointAreaFreeshippingTableMap::ID => 0, ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID => 1, ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT => 2, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'CART_AMOUNT' => 2, ), + self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'cart_amount' => 2, ), + self::TYPE_NUM => array(0, 1, 2, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('colissimo_pickup_point_area_freeshipping'); + $this->setPhpName('ColissimoPickupPointAreaFreeshipping'); + $this->setClassName('\\ColissimoPickupPoint\\Model\\ColissimoPickupPointAreaFreeshipping'); + $this->setPackage('ColissimoPickupPoint.Model'); + $this->setUseIdGenerator(true); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null); + $this->addColumn('CART_AMOUNT', 'CartAmount', 'DECIMAL', false, 18, 0); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('Area', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT'); + } // buildRelations() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return (int) $row[ + $indexType == TableMap::TYPE_NUM + ? 0 + $offset + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) + ]; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? ColissimoPickupPointAreaFreeshippingTableMap::CLASS_DEFAULT : ColissimoPickupPointAreaFreeshippingTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (ColissimoPickupPointAreaFreeshipping object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = ColissimoPickupPointAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ColissimoPickupPointAreaFreeshippingTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + ColissimoPickupPointAreaFreeshippingTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = ColissimoPickupPointAreaFreeshippingTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + ColissimoPickupPointAreaFreeshippingTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = ColissimoPickupPointAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ColissimoPickupPointAreaFreeshippingTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ColissimoPickupPointAreaFreeshippingTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(ColissimoPickupPointAreaFreeshippingTableMap::ID); + $criteria->addSelectColumn(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID); + $criteria->addSelectColumn(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.AREA_ID'); + $criteria->addSelectColumn($alias . '.CART_AMOUNT'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME)->getTable(ColissimoPickupPointAreaFreeshippingTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ColissimoPickupPointAreaFreeshippingTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ColissimoPickupPointAreaFreeshippingTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a ColissimoPickupPointAreaFreeshipping or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ColissimoPickupPointAreaFreeshipping 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 static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + $criteria->add(ColissimoPickupPointAreaFreeshippingTableMap::ID, (array) $values, Criteria::IN); + } + + $query = ColissimoPickupPointAreaFreeshippingQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { ColissimoPickupPointAreaFreeshippingTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { ColissimoPickupPointAreaFreeshippingTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the colissimo_pickup_point_area_freeshipping table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return ColissimoPickupPointAreaFreeshippingQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a ColissimoPickupPointAreaFreeshipping or Criteria object. + * + * @param mixed $criteria Criteria or ColissimoPickupPointAreaFreeshipping object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from ColissimoPickupPointAreaFreeshipping object + } + + if ($criteria->containsKey(ColissimoPickupPointAreaFreeshippingTableMap::ID) && $criteria->keyContainsValue(ColissimoPickupPointAreaFreeshippingTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimoPickupPointAreaFreeshippingTableMap::ID.')'); + } + + + // Set the correct dbName + $query = ColissimoPickupPointAreaFreeshippingQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // ColissimoPickupPointAreaFreeshippingTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +ColissimoPickupPointAreaFreeshippingTableMap::buildTableMap(); diff --git a/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointFreeshippingTableMap.php b/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointFreeshippingTableMap.php new file mode 100644 index 00000000..968fa576 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointFreeshippingTableMap.php @@ -0,0 +1,414 @@ + array('Id', 'Active', 'FreeshippingFrom', ), + self::TYPE_STUDLYPHPNAME => array('id', 'active', 'freeshippingFrom', ), + self::TYPE_COLNAME => array(ColissimoPickupPointFreeshippingTableMap::ID, ColissimoPickupPointFreeshippingTableMap::ACTIVE, ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, ), + self::TYPE_RAW_COLNAME => array('ID', 'ACTIVE', 'FREESHIPPING_FROM', ), + self::TYPE_FIELDNAME => array('id', 'active', 'freeshipping_from', ), + self::TYPE_NUM => array(0, 1, 2, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'Active' => 1, 'FreeshippingFrom' => 2, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'active' => 1, 'freeshippingFrom' => 2, ), + self::TYPE_COLNAME => array(ColissimoPickupPointFreeshippingTableMap::ID => 0, ColissimoPickupPointFreeshippingTableMap::ACTIVE => 1, ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM => 2, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'ACTIVE' => 1, 'FREESHIPPING_FROM' => 2, ), + self::TYPE_FIELDNAME => array('id' => 0, 'active' => 1, 'freeshipping_from' => 2, ), + self::TYPE_NUM => array(0, 1, 2, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('colissimo_pickup_point_freeshipping'); + $this->setPhpName('ColissimoPickupPointFreeshipping'); + $this->setClassName('\\ColissimoPickupPoint\\Model\\ColissimoPickupPointFreeshipping'); + $this->setPackage('ColissimoPickupPoint.Model'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addColumn('ACTIVE', 'Active', 'BOOLEAN', false, 1, false); + $this->addColumn('FREESHIPPING_FROM', 'FreeshippingFrom', 'DECIMAL', false, 18, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return (int) $row[ + $indexType == TableMap::TYPE_NUM + ? 0 + $offset + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) + ]; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? ColissimoPickupPointFreeshippingTableMap::CLASS_DEFAULT : ColissimoPickupPointFreeshippingTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (ColissimoPickupPointFreeshipping object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = ColissimoPickupPointFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ColissimoPickupPointFreeshippingTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + ColissimoPickupPointFreeshippingTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = ColissimoPickupPointFreeshippingTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + ColissimoPickupPointFreeshippingTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = ColissimoPickupPointFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ColissimoPickupPointFreeshippingTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ColissimoPickupPointFreeshippingTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(ColissimoPickupPointFreeshippingTableMap::ID); + $criteria->addSelectColumn(ColissimoPickupPointFreeshippingTableMap::ACTIVE); + $criteria->addSelectColumn(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.ACTIVE'); + $criteria->addSelectColumn($alias . '.FREESHIPPING_FROM'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME)->getTable(ColissimoPickupPointFreeshippingTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ColissimoPickupPointFreeshippingTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ColissimoPickupPointFreeshippingTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a ColissimoPickupPointFreeshipping or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ColissimoPickupPointFreeshipping 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 static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + $criteria->add(ColissimoPickupPointFreeshippingTableMap::ID, (array) $values, Criteria::IN); + } + + $query = ColissimoPickupPointFreeshippingQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { ColissimoPickupPointFreeshippingTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { ColissimoPickupPointFreeshippingTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the colissimo_pickup_point_freeshipping table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return ColissimoPickupPointFreeshippingQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a ColissimoPickupPointFreeshipping or Criteria object. + * + * @param mixed $criteria Criteria or ColissimoPickupPointFreeshipping object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from ColissimoPickupPointFreeshipping object + } + + + // Set the correct dbName + $query = ColissimoPickupPointFreeshippingQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // ColissimoPickupPointFreeshippingTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +ColissimoPickupPointFreeshippingTableMap::buildTableMap(); diff --git a/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointPriceSlicesTableMap.php b/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointPriceSlicesTableMap.php new file mode 100644 index 00000000..d7b40a4b --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Map/ColissimoPickupPointPriceSlicesTableMap.php @@ -0,0 +1,443 @@ + array('Id', 'AreaId', 'WeightMax', 'PriceMax', 'FrancoMinPrice', 'Price', ), + self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'weightMax', 'priceMax', 'francoMinPrice', 'price', ), + self::TYPE_COLNAME => array(ColissimoPickupPointPriceSlicesTableMap::ID, ColissimoPickupPointPriceSlicesTableMap::AREA_ID, ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, ColissimoPickupPointPriceSlicesTableMap::PRICE, ), + self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'WEIGHT_MAX', 'PRICE_MAX', 'FRANCO_MIN_PRICE', 'PRICE', ), + self::TYPE_FIELDNAME => array('id', 'area_id', 'weight_max', 'price_max', 'franco_min_price', 'price', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'WeightMax' => 2, 'PriceMax' => 3, 'FrancoMinPrice' => 4, 'Price' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'weightMax' => 2, 'priceMax' => 3, 'francoMinPrice' => 4, 'price' => 5, ), + self::TYPE_COLNAME => array(ColissimoPickupPointPriceSlicesTableMap::ID => 0, ColissimoPickupPointPriceSlicesTableMap::AREA_ID => 1, ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX => 2, ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX => 3, ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE => 4, ColissimoPickupPointPriceSlicesTableMap::PRICE => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'WEIGHT_MAX' => 2, 'PRICE_MAX' => 3, 'FRANCO_MIN_PRICE' => 4, 'PRICE' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'weight_max' => 2, 'price_max' => 3, 'franco_min_price' => 4, 'price' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('colissimo_pickup_point_price_slices'); + $this->setPhpName('ColissimoPickupPointPriceSlices'); + $this->setClassName('\\ColissimoPickupPoint\\Model\\ColissimoPickupPointPriceSlices'); + $this->setPackage('ColissimoPickupPoint.Model'); + $this->setUseIdGenerator(true); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null); + $this->addColumn('WEIGHT_MAX', 'WeightMax', 'FLOAT', false, null, null); + $this->addColumn('PRICE_MAX', 'PriceMax', 'FLOAT', false, null, null); + $this->addColumn('FRANCO_MIN_PRICE', 'FrancoMinPrice', 'FLOAT', false, null, null); + $this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('Area', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT'); + } // buildRelations() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return (int) $row[ + $indexType == TableMap::TYPE_NUM + ? 0 + $offset + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) + ]; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? ColissimoPickupPointPriceSlicesTableMap::CLASS_DEFAULT : ColissimoPickupPointPriceSlicesTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (ColissimoPickupPointPriceSlices object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = ColissimoPickupPointPriceSlicesTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ColissimoPickupPointPriceSlicesTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + ColissimoPickupPointPriceSlicesTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = ColissimoPickupPointPriceSlicesTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + ColissimoPickupPointPriceSlicesTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = ColissimoPickupPointPriceSlicesTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ColissimoPickupPointPriceSlicesTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + ColissimoPickupPointPriceSlicesTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::ID); + $criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::AREA_ID); + $criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX); + $criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX); + $criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE); + $criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::PRICE); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.AREA_ID'); + $criteria->addSelectColumn($alias . '.WEIGHT_MAX'); + $criteria->addSelectColumn($alias . '.PRICE_MAX'); + $criteria->addSelectColumn($alias . '.FRANCO_MIN_PRICE'); + $criteria->addSelectColumn($alias . '.PRICE'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME)->getTable(ColissimoPickupPointPriceSlicesTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ColissimoPickupPointPriceSlicesTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ColissimoPickupPointPriceSlicesTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a ColissimoPickupPointPriceSlices or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ColissimoPickupPointPriceSlices 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 static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + $criteria->add(ColissimoPickupPointPriceSlicesTableMap::ID, (array) $values, Criteria::IN); + } + + $query = ColissimoPickupPointPriceSlicesQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { ColissimoPickupPointPriceSlicesTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { ColissimoPickupPointPriceSlicesTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the colissimo_pickup_point_price_slices table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return ColissimoPickupPointPriceSlicesQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a ColissimoPickupPointPriceSlices or Criteria object. + * + * @param mixed $criteria Criteria or ColissimoPickupPointPriceSlices object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from ColissimoPickupPointPriceSlices object + } + + if ($criteria->containsKey(ColissimoPickupPointPriceSlicesTableMap::ID) && $criteria->keyContainsValue(ColissimoPickupPointPriceSlicesTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimoPickupPointPriceSlicesTableMap::ID.')'); + } + + + // Set the correct dbName + $query = ColissimoPickupPointPriceSlicesQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // ColissimoPickupPointPriceSlicesTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +ColissimoPickupPointPriceSlicesTableMap::buildTableMap(); diff --git a/local/modules/ColissimoPickupPoint/Model/Map/OrderAddressColissimoPickupPointTableMap.php b/local/modules/ColissimoPickupPoint/Model/Map/OrderAddressColissimoPickupPointTableMap.php new file mode 100644 index 00000000..6b58545e --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/Map/OrderAddressColissimoPickupPointTableMap.php @@ -0,0 +1,415 @@ + array('Id', 'Code', 'Type', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', ), + self::TYPE_COLNAME => array(OrderAddressColissimoPickupPointTableMap::ID, OrderAddressColissimoPickupPointTableMap::CODE, OrderAddressColissimoPickupPointTableMap::TYPE, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', ), + self::TYPE_FIELDNAME => array('id', 'code', 'type', ), + self::TYPE_NUM => array(0, 1, 2, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, ), + self::TYPE_COLNAME => array(OrderAddressColissimoPickupPointTableMap::ID => 0, OrderAddressColissimoPickupPointTableMap::CODE => 1, OrderAddressColissimoPickupPointTableMap::TYPE => 2, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, ), + self::TYPE_NUM => array(0, 1, 2, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('order_address_colissimo_pickup_point'); + $this->setPhpName('OrderAddressColissimoPickupPoint'); + $this->setClassName('\\ColissimoPickupPoint\\Model\\OrderAddressColissimoPickupPoint'); + $this->setPackage('ColissimoPickupPoint.Model'); + $this->setUseIdGenerator(false); + // columns + $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_address', 'ID', true, null, null); + $this->addColumn('CODE', 'Code', 'VARCHAR', true, 10, null); + $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 10, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('OrderAddress', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\OrderAddress', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', 'CASCADE'); + } // buildRelations() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return (int) $row[ + $indexType == TableMap::TYPE_NUM + ? 0 + $offset + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) + ]; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? OrderAddressColissimoPickupPointTableMap::CLASS_DEFAULT : OrderAddressColissimoPickupPointTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (OrderAddressColissimoPickupPoint object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = OrderAddressColissimoPickupPointTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = OrderAddressColissimoPickupPointTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + OrderAddressColissimoPickupPointTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = OrderAddressColissimoPickupPointTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + OrderAddressColissimoPickupPointTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = OrderAddressColissimoPickupPointTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = OrderAddressColissimoPickupPointTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + OrderAddressColissimoPickupPointTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(OrderAddressColissimoPickupPointTableMap::ID); + $criteria->addSelectColumn(OrderAddressColissimoPickupPointTableMap::CODE); + $criteria->addSelectColumn(OrderAddressColissimoPickupPointTableMap::TYPE); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.CODE'); + $criteria->addSelectColumn($alias . '.TYPE'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME)->getTable(OrderAddressColissimoPickupPointTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(OrderAddressColissimoPickupPointTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new OrderAddressColissimoPickupPointTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a OrderAddressColissimoPickupPoint or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or OrderAddressColissimoPickupPoint 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 static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + $criteria->add(OrderAddressColissimoPickupPointTableMap::ID, (array) $values, Criteria::IN); + } + + $query = OrderAddressColissimoPickupPointQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { OrderAddressColissimoPickupPointTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { OrderAddressColissimoPickupPointTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the order_address_colissimo_pickup_point table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return OrderAddressColissimoPickupPointQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a OrderAddressColissimoPickupPoint or Criteria object. + * + * @param mixed $criteria Criteria or OrderAddressColissimoPickupPoint object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from OrderAddressColissimoPickupPoint object + } + + + // Set the correct dbName + $query = OrderAddressColissimoPickupPointQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // OrderAddressColissimoPickupPointTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +OrderAddressColissimoPickupPointTableMap::buildTableMap(); diff --git a/local/modules/ColissimoPickupPoint/Model/OrderAddressColissimoPickupPoint.php b/local/modules/ColissimoPickupPoint/Model/OrderAddressColissimoPickupPoint.php new file mode 100644 index 00000000..1d4ddc03 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Model/OrderAddressColissimoPickupPoint.php @@ -0,0 +1,10 @@ +/local/modules/``` directory and be sure that the name of the module is ColissimoPickupPoint. +* Activate it in your thelia administration panel + +### Composer + +Add it in your main thelia composer.json file + +``` +composer require thelia/colissimo-pickup-point-module:~1.0.0 +``` + +How to use +----------- +First, go to your back office, tab Modules, and activate the module ColissimoPickupPoint. +Then go to the ColissimoPickupPoint config page, tab "Advanced Configuration" and enter your Colissimo id and password. +To import exported files in Expeditor INET, you need the file THELIA_INET.FMT, that is in the archive. + +Loops +----- +1. colissimo.pickup.point.check.rights + - Arguments: + None + - Output: + 1. $ERRMES: Error message + 2. $ERRFILE: File where the error has been detected + - Usage: + ```{loop name="yourloopname" type="colissimo.pickup.point.check.rights"}{/loop}``` + +2. colissimo.pickup.point + - Arguments: + 1. area_id | mandatory | id of the area we want to know the price slices of + - Output: + 1. $SLICE_ID: The ID of this price slice + 2. $MAX_WEIGHT: Max cart weight for the price slice + 3. $MAX_PRICE: Max cart price for the price slice + 4. $PRICE: Delivery price for this price slice + 5. $FRANCO: UNUSED + - Usage: + ```{loop name="yourloopname" type="colissimo.pickup.point"}{/loop}``` + +3. colissimo.pickup.point.id + - Arguments: + None + - Output: + 1. $MODULE_ID: Id of the ColissimoPickupPoint module + - Usage: + ```{loop name="yourloopname" type="colissimo.pickup.point.id"}{/loop}``` + +4. colissimo.pickup.point.around + - Arguments: + 1. countryid | optionnal | Country ID of where the search location is + 2. zipcode | optionnal | Zipcode of the searched city + 3. city | optionnal | Name of the searched city + 4. address | optionnal | Id of the address to use for the search. + address cannot be used at the same time as zipcode + city + - Output: + 1. $LONGITUDE: longitude of the pickup & go store + 2. $LATITUDE : latitude of the pickup & go store + 3. $CODE : ID of the pickup & go store + 4. $ADDRESS : address of the pickup & go store + 5. $ZIPCODE : zipcode of the pickup & go store + 6. $CITY : city of the pickup & go store + 7. $DISTANCE : distance between the store and the customer's address/searched address + - Usage: + ```{loop name="yourloopname" type="colissimo.pickup.point.around"}{/loop}``` + +5. address.colissimo.pickup.point + - Arguments: + The same as the loop address + - Output: + The same as the loop address, but with pickup & go store's address + - Usage: + ```{loop name="yourloopname" type="address.colissimo.pickup.point"}{/loop}``` + +6. order.notsent.colissimo.pickup.point + - Arguments: + None + - Output: + The same as the loop order, but with not sent ColissimoPickupPoint orders. + - Usage: + ```{loop name="yourloopname" type="order.notsent.colissimo.pickup.point"}{/loop}``` + +7. colissimo.pickup.point.order_address + - Arguments: + 1. id | mandatory | ID of the OrderAddressColissimoPickupPoint that should be retrieved by the loop. + - Outputs: + 1. $ID : OrderAddressColissimoPickupPoint ID. + 2. $CODE : OrderAddressColissimoPickupPoint code. + 3. $TYPE : OrderAddressColissimoPickupPoint type. + - Usage: + ```{loop name="yourloopname" type="colissimo.pickup.point.order_address"}{/loop}``` + +8. colissimo.pickup.point.area.freeshipping + - Arguments: + 1. area_id | optionnal | Id of the area we want to know if freeshipping from is active + - Outputs: + 1. $ID : ColissimoPickupPointAreaFreeshipping ID. + 2. $AREA_ID : The area ID. + 3. $CART_AMOUNT : The minimum cart amount to have free shipping for this area. + - Usage: + ```{loop name="yourloopname" type="colissimo.pickup.point.area.freeshipping"}{/loop}``` + +9. colissimo.pickup.point.freeshipping + - Arguments: + 1. id | optionnal | Should always be 1. + - Outputs: + 1. $FREESHIPPING_ACTIVE : Whether free shipping is activated with no restrictions on all area. + 2. $FREESHIPPING_FROM : The minimum cart amount to have free shipping on all alreas. + - Usage: + ```{loop name="yourloopname" type="colissimo.pickup.point.freeshipping"}{/loop}``` + +Plugins Smarty +----- +1. colissimoPickupPointDeliveryPrice + - Arguments: + 1. country | optionnal | The country ID from which you want to get the delivery prices. Defaults to store country + - Outputs: + 1. $isValidMode : Whether the delivery is valid for the cart in session and the chosen country. + 2. $deliveryPrice : The delivery price for the cart in session in the chosen country. + - Usage: + ```{colissimoPickupPointDeliveryPrice country=64}``` + +Integration +----------- +A integration example is available for the default theme of Thelia. +To install it, copy the files of pathToColissimoPickupPoint/templates/frontOffice/default and +pathToColissimoPickupPoint/templates/frontOffice/default/ajax respectively in pathToThelia/templates/frontOffice/default +and pathToThelia/templates/frontOffice/default/ajax diff --git a/local/modules/ColissimoPickupPoint/Smarty/Plugins/ColissimoPickupPointDeliveryPrice.php b/local/modules/ColissimoPickupPoint/Smarty/Plugins/ColissimoPickupPointDeliveryPrice.php new file mode 100644 index 00000000..8bdc929b --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Smarty/Plugins/ColissimoPickupPointDeliveryPrice.php @@ -0,0 +1,56 @@ +request = $request; + $this->dispatcher = $dispatcher; + } + + public function getPluginDescriptors() + { + return array( + new SmartyPluginDescriptor('function', 'colissimoPickupPointDeliveryPrice', $this, 'colissimoPickupPointDeliveryPrice') + ); + } + + public function colissimoPickupPointDeliveryPrice($params, $smarty) + { + $country = Country::getShopLocation(); + if (isset($params['country'])) { + $country = CountryQuery::create()->findOneById($params['country']); + } + + $cartWeight = $this->request->getSession()->getSessionCart($this->dispatcher)->getWeight(); + $cartAmount = $this->request->getSession()->getSessionCart($this->dispatcher)->getTaxedAmount($country); + + try { + $price = ColissimoPickupPoint::getPostageAmount( + $country->getAreaId(), + $cartWeight, + $cartAmount + ); + } catch (DeliveryException $ex) { + $smarty->assign('isValidMode', false); + } + + $smarty->assign('deliveryPrice', $price); + } +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/Smarty/Plugins/ColissimoPickupPointGoogleApiKey.php b/local/modules/ColissimoPickupPoint/Smarty/Plugins/ColissimoPickupPointGoogleApiKey.php new file mode 100644 index 00000000..323d7f77 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Smarty/Plugins/ColissimoPickupPointGoogleApiKey.php @@ -0,0 +1,45 @@ +request = $request; + $this->dispatcher = $dispatcher; + } + + public function getPluginDescriptors() + { + return array( + new SmartyPluginDescriptor('function', 'colissimoPickupPointGoogleApiKey', $this, 'colissimoPickupPointGoogleApiKey') + ); + } + + public function colissimoPickupPointGoogleApiKey($params, $smarty) + { + $key = ModuleConfigQuery::create() + ->filterByName('colissimo_pickup_point_google_map_key') + ->findOne() + ->getValue() + ; + + $smarty->assign('colissimoPickupPointGoogleMapKey', $key); + + return $key; + } +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/THELIA_INET.FMT b/local/modules/ColissimoPickupPoint/THELIA_INET.FMT new file mode 100644 index 00000000..9697ab83 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/THELIA_INET.FMT @@ -0,0 +1,25 @@ +[GENERAL] +DELIMITE=O +SEPARATEUR=59 +DELIMITEUR=34 +FINDELIGNE=CRLF +Unité poids=KG +[CHAMPS] +Prenom=1 +NomDestinataire=2 +RaisonSociale=3 +Adresse1=4 +Adresse2=5 +Adresse3=6 +CodePostal=7 +Commune=8 +CodePays=9 +Telephone=10 +Portable=11 +CodeProduit=12 +Civilite=13 +CodePointRetrait=14 +Mail=15 +Poids=16 +NomCommercialChargeur=17 +typeDePoint=18 \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/Utils/ColissimoCodeReseau.php b/local/modules/ColissimoPickupPoint/Utils/ColissimoCodeReseau.php new file mode 100644 index 00000000..68d48483 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/Utils/ColissimoCodeReseau.php @@ -0,0 +1,56 @@ + + [ + 'CMT' => 'R03', + 'BDP' => 'X00', + 'PCS' => 'X00' + ], + 'ES' => + [ + 'CMT' => 'R03', + 'BDP' => 'X00', + ], + 'GB' => + [ + 'CMT' => 'R03' + ], + 'LU' => + [ + 'CMT' => 'R03' + ], + 'NL' => + [ + 'BDP' => 'X00', + 'CMT' => 'R03', + ], + 'BE' => + [ + 'BDP' => 'R12', + 'CMT' => 'R12', + ] + ]; + + public static function getCodeReseau($countryCode, $relayTypeCode) + { + if (array_key_exists($countryCode, self::CODE_RESEAU_ARRAY)) { + $innerArray = self::CODE_RESEAU_ARRAY[$countryCode]; + if (array_key_exists($relayTypeCode, $innerArray)) { + return $innerArray[$relayTypeCode]; + } + } + return null; + } +} diff --git a/local/modules/ColissimoPickupPoint/WebService/BaseColissimoPickupPointWebService.php b/local/modules/ColissimoPickupPoint/WebService/BaseColissimoPickupPointWebService.php new file mode 100755 index 00000000..d09fb5ff --- /dev/null +++ b/local/modules/ColissimoPickupPoint/WebService/BaseColissimoPickupPointWebService.php @@ -0,0 +1,55 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\WebService; + +use ColissimoPickupPoint\ColissimoPickupPoint; + +/** + * Class BaseColissimoPickupPointWebService + * @package ColissimoPickupPoint\WebService + * @author Thelia + * + * @method BaseColissimoPickupPointWebService getAccountNumber() + * @method BaseColissimoPickupPointWebService setAccountNumber($value) + * @method BaseColissimoPickupPointWebService getPassword() + * @method BaseColissimoPickupPointWebService setPassword($value) + * @method BaseColissimoPickupPointWebService getWeight() + * @method BaseColissimoPickupPointWebService setWeight($value) + */ +abstract class BaseColissimoPickupPointWebService extends BaseWebService +{ + + protected $account_number=null; + protected $password=null; + protected $filter_relay=null; + /** @var string Weight in grammes !*/ + protected $weight=null; + + public function __construct($function) + { + $url = ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_ENDPOINT); + + parent::__construct($url, $function); + } +} diff --git a/local/modules/ColissimoPickupPoint/WebService/BaseWebService.php b/local/modules/ColissimoPickupPoint/WebService/BaseWebService.php new file mode 100755 index 00000000..1e780389 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/WebService/BaseWebService.php @@ -0,0 +1,229 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\WebService; +use Symfony\Component\Serializer\Exception\InvalidArgumentException; + +/** + * Class BaseWebService + * @package ColissimoPickupPoint\WebService + * @author Thelia + * + * @method BaseWebService getSoap() + * @method BaseWebService setSoap(\SoapClient $soap) + * @method BaseWebService getWebFunction() + * @method BaseWebService setWebFunction($value) + */ +abstract class BaseWebService +{ + protected $soap; + protected $web_function; + + public function __construct($wsdl, $web_function=null) + { + $this->soap = new \SoapClient($wsdl); + $this->web_function=$web_function; + } + + /** + * @param $name + * @return mixed|string + */ + private function getProprietyRealName($name) + { + $propriety_real_name = substr($name,3); + + if (preg_match("#^[A-Z]$#", substr($propriety_real_name, 0,1))) { + $propriety_real_name = strtolower(substr($propriety_real_name, 0, 1)).substr($propriety_real_name, 1); + $propriety_real_name = preg_replace_callback( + "#([A-Z])#", + function ($match) { + return strtolower("_".$match[0]); + }, + $propriety_real_name + ); + } + + return $propriety_real_name; + } + + /** + * @param $name + * @param $arguments + * @return mixed + * @throws \Symfony\Component\Serializer\Exception\InvalidArgumentException + * @throws \BadFunctionCallException + */ + public function __call($name, $arguments) + { + if (method_exists($this, $name)) { + return call_user_func($this->$name, $arguments); + } + + if (substr($name,0,3) === "get") { + if (!empty($arguments)) { + throw new InvalidArgumentException("The function ".$name." in ".get_class($this)." doesn't take any argument."); + } + + $real_name = $this->getProprietyRealName($name); + if (property_exists($this, $real_name)) { + return $this->$real_name; + } + + } elseif (substr($name,0,3) === "set") { + if (count($arguments) !== 1) { + throw new InvalidArgumentException("The function ".$name." in ".get_class($this)." take only one argument."); + } + + $real_name = $this->getProprietyRealName($name); + $this->$real_name = $arguments[array_keys($arguments)[0]]; + + return $this; + } + + throw new \BadFunctionCallException("The function ".$name." doesn't exist in ".get_class($this)); + } + + /** + * @return mixed + * @throws \Symfony\Component\Serializer\Exception\InvalidArgumentException + */ + public function exec() + { + $function = $this->web_function; + $response = $this->soap->$function($this->getArgs()); + + if ($this->isError($response)) { + throw new InvalidArgumentException($this->getError($response)); + } + + return $this->getFormattedResponse($response); + } + + /** + * @return array of web function args + */ + public function getArgs() + { + $args= $this->getSoapNames($this->getThisVars()); + + /* + * Clear array + */ + foreach ($args as $key => $value) { + if ($key == "address" || $key == "city") { + $args[$key] = $this->normalize($value); + } + + if (empty($value)) { + unset($args[$key]); + } + } + + return $args; + } + + /** + * @return array + */ + protected function getThisVars() + { + $this_class_vars = get_object_vars($this); + $base_class_vars = get_class_vars("\\ColissimoPickupPoint\\WebService\\BaseWebService"); + $pks = array_diff_key($this_class_vars, $base_class_vars); + + return $pks; + } + + /** + * @param array $names + * @return array + */ + protected function getSoapNames(array $names) + { + foreach ($names as $name=>$value) { + $real_name = $this->getSoapName($name); + $names[$real_name] = $value; + if ($name !== $real_name) { + unset($names[$name]); + } + } + + return $names; + } + + /** + * @param string $name + * @return string + */ + protected function getSoapName($name) + { + return preg_replace_callback( + "#_([a-z]{1})#", + function ($match) { + return strtoupper($match[1]); + }, + $name + ); + } + + protected function normalize($text) + { + $utf8 = array( + '/[áàâãªä]/u' => 'a', + '/[ÁÀÂÃÄ]/u' => 'A', + '/[ÍÌÎÏ]/u' => 'I', + '/[íìîï]/u' => 'i', + '/[éèêë]/u' => 'e', + '/[ÉÈÊË]/u' => 'E', + '/[óòôõºö]/u' => 'o', + '/[ÓÒÔÕÖ]/u' => 'O', + '/[úùûü]/u' => 'u', + '/[ÚÙÛÜ]/u' => 'U', + '/ç/' => 'c', + '/Ç/' => 'C', + '/ñ/' => 'n', + '/Ñ/' => 'N', + '/–/' => '-', // UTF-8 hyphen to "normal" hyphen + '/[’‘‹›‚]/u' => ' ', // Literally a single quote + '/[“”«»„]/u' => ' ', // Double quote + '/ /' => ' ', // nonbreaking space (equiv. to 0x160) + ); + return preg_replace(array_keys($utf8), array_values($utf8), $text); + } + + /** + * @return bool + */ + abstract public function isError(\stdClass $response); + + /** + * @return string + */ + abstract public function getError(\stdClass $response); + + /** + * @return something + */ + abstract public function getFormattedResponse(\stdClass $response); +} diff --git a/local/modules/ColissimoPickupPoint/WebService/FindByAddress.php b/local/modules/ColissimoPickupPoint/WebService/FindByAddress.php new file mode 100755 index 00000000..d4c56726 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/WebService/FindByAddress.php @@ -0,0 +1,92 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\WebService; + +use stdClass; +use Symfony\Component\Config\Definition\Exception\Exception; + +/** + * Class FindByAddress + * @package ColissimoPickupPoint\WebService + * @author Thelia + * + * @method FindByAddress getAddress() + * @method FindByAddress setAddress($value) + * @method FindByAddress getZipCode() + * @method FindByAddress setZipCode($value) + * @method FindByAddress getCity() + * @method FindByAddress setCity($value) + * @method FindByAddress getCountryCode() + * @method FindByAddress setCountryCode($value) + * @method FindByAddress getFilterRelay() + * @method FindByAddress setFilterRelay($value) + * @method FindByAddress getRequestId() + * @method FindByAddress setRequestId($value) + * @method FindByAddress getLang() + * @method FindByAddress setLang($value) + * @method FindByAddress getOptionInter() + * @method FindByAddress setOptionInter($value) + * @method FindByAddress getShippingDate() + * @method FindByAddress setShippingDate($value) + */ +class FindByAddress extends BaseColissimoPickupPointWebService +{ + protected $address=null; + protected $zip_code=null; + protected $city=null; + protected $country_code=null; + protected $request_id=null; + protected $lang=null; + protected $option_inter=null; + protected $shipping_date=null; + + public function __construct() + { + parent::__construct('findRDVPointRetraitAcheminement'); + } + + public function isError(stdClass $response) + { + return isset($response->return->errorCode) && $response->return->errorCode != 0; + } + + public function getError(stdClass $response) + { + return isset($response->return->errorMessage) ? $response->return->errorMessage : 'Unknown error'; + } + + /** + * @param stdClass $response + * @return array + * @throws Exception + */ + public function getFormattedResponse(stdClass $response) + { + if (!isset($response->return->listePointRetraitAcheminement)) { + throw new Exception('An unknown error happened'); + } + + return $response->return->listePointRetraitAcheminement; + } +} diff --git a/local/modules/ColissimoPickupPoint/WebService/FindById.php b/local/modules/ColissimoPickupPoint/WebService/FindById.php new file mode 100755 index 00000000..793e442c --- /dev/null +++ b/local/modules/ColissimoPickupPoint/WebService/FindById.php @@ -0,0 +1,79 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoPickupPoint\WebService; +use stdClass; +use Symfony\Component\Config\Definition\Exception\Exception; + +/** + * Class FindById + * @package ColissimoPickupPoint\WebService + * @author Thelia + * + * @method FindById getId() + * @method FindById setId($value) + * @method FindById getReseau() + * @method FindById setReseau($value) + * @method FindById getLangue() + * @method FindById setLangue($value) + * @method FindById getDate() + * @method FindById setDate($value) + */ +class FindById extends BaseColissimoPickupPointWebService +{ + protected $id; + /** @var string if belgique: R12, else empty */ + protected $reseau; + protected $langue; + protected $date; + + public function __construct() + { + parent::__construct('findPointRetraitAcheminementByID'); + } + + public function isError(stdClass $response) + { + return isset($response->return->errorCode) && $response->return->errorCode != 0; + } + + public function getError(stdClass $response) + { + return isset($response->return->errorMessage) ? $response->return->errorMessage : 'Unknown error'; + } + + /** + * @param stdClass $response + * @return stdClass + * @throws Exception + */ + public function getFormattedResponse(stdClass $response) + { + if (!isset($response->return->pointRetraitAcheminement)) { + throw new Exception('An unknown error happened'); + } + + return $response->return->pointRetraitAcheminement; + } + +} diff --git a/local/modules/ColissimoPickupPoint/composer.json b/local/modules/ColissimoPickupPoint/composer.json new file mode 100644 index 00000000..320dbcb6 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/composer.json @@ -0,0 +1,11 @@ +{ + "name": "thelia/colissimo-pickup-point-module", + "license": "LGPL-3.0+", + "type": "thelia-module", + "require": { + "thelia/installer": "~1.1" + }, + "extra": { + "installer-name": "ColissimoPickupPoint" + } +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/images/socolissimo.png b/local/modules/ColissimoPickupPoint/images/socolissimo.png new file mode 100644 index 0000000000000000000000000000000000000000..6317f927d1491ecc04016e14dc3056d931c62291 GIT binary patch literal 16104 zcmeHuWmKF^wf-Q9J_d+&Ge{Fran z%#LB_R#l^}%%ErRV#?12e=VD~#;N#@tW8)_M&mZ|)Z{N%; z_*BIu|Ff^RnjraCCnpC!W@cAcS0-0>Ci`!e%&fe;yniv+*cjg|7(wnpCu288Ac*2$ z2;$}-({EM|PFD6n(!YqtCic!wg5+KpP9R3Ry2>Q=7y(Ns<&DepNm5Jr=kp5+; zpzyypwX^##Ymk$w`G3dzzXS%UyE~XOtD1xCoxhpBO`HYA->w|^#J-suJK29zx3{Q_?5ngr{RvvD4iGTTu+nYMunFF2vum?j~1K+}M-`bi6)_;(*L3eX% zxmwzKr7)L}Q&7~fl~j8)eLsEum3&e@G&C|a6vn&~?sh8ChesBK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CMp(h_K?Ps-JpIlkfh2QPTMv_rcK2~mC*AopLj+ed#mn9WhP&6-T z(5HdlQM@(WI?IiD+C|i-jRB8riz<^ImXHLRqZpT8yRe3_N)M2m*R!jN_fmZBE6|KO;czLJGou3e@-|rmmg_cU2tBuA1?kL!SqF{V^>U zyJW1|*U$oaP|TAYKRCGjO|WA8b9~8+yR+qU^}%mhHmyJm(E&m;FPwBlI-TD}o5N+} zEwcyH&y(L_8D`>zxQt(YZZ`rcm47ucGsxFxFL$gfu(wrK806u zRxVze#)c4jDJ%af8{wow*m-oMKEznls>qD45 zMHsuO!9j!+%&Z62p?6oT8ueax-|TKuDg6B70QVPrlm{(S$@*&-?agl4M@NuzS%?Mz zDS#Oe>@eXYSJFeldz0y2@{c4;4*H!}xY5hF+hB{B$=9JErUUF~*Ig)2h@Nq#Z>Swy z>m98<`ah6d(djUt??09woln<=5{(JBxfw@cb+RHA6FHa(nvVOOBTq_`eT?CoVQ$&rO}tx9k<4s7qCvK=V<_(VhqfE#S+{a zM0`ge{(nJ039IuiwYl!%%#45_i4wH;VUyAW7MFJG)^AHR3k~>jsVw^jNu*qb!dKRr z8JF5$xc#fI&@30$uzBQ{e=MArOdzlyW*FsT^DOFEEh5Ebdcy;4J*({6x22Te$Ucbo z;Te2{s)c& BvrGU0 literal 0 HcmV?d00001 diff --git a/local/modules/ColissimoPickupPoint/templates/backOffice/default/module-config-js.html b/local/modules/ColissimoPickupPoint/templates/backOffice/default/module-config-js.html new file mode 100755 index 00000000..c6811084 --- /dev/null +++ b/local/modules/ColissimoPickupPoint/templates/backOffice/default/module-config-js.html @@ -0,0 +1,201 @@ +{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'} + +{/javascripts} + +{javascripts file='assets/js/libs/underscore-min.js'} + +{/javascripts} + + + \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/templates/backOffice/default/module_configuration.html b/local/modules/ColissimoPickupPoint/templates/backOffice/default/module_configuration.html new file mode 100755 index 00000000..1b8a8c3e --- /dev/null +++ b/local/modules/ColissimoPickupPoint/templates/backOffice/default/module_configuration.html @@ -0,0 +1,474 @@ + +
+ + {loop name="checkrights.colissimo.pickup.point" type="colissimo.pickup.point.check.rights"} +
+

{$ERRMES} {$ERRFILE} | {intl l="Please change the access rights" d='colissimo.pickup.point.bo.default'}.

+
+ {/loop} +
+ +{elseloop rel="checkrights.colissimo.pickup.point"} + + + +{assign var="tab" value="export"} +{if isset($smarty.get.current_tab)} + {assign var="tab" value=$smarty.get.current_tab} +{/if} + +{* default currency *} +{loop type="currency" name="default_currency" default_only="1"} +{$currencySymbol=$SYMBOL} +{/loop} + +
+
+
+ + + +
+
+
+
+ {intl l="operations" d='colissimo.pickup.point.bo.default'} +
+
+ + + +
+
+ {form name="colissimo.pickup.point.export"} + + {form_hidden_fields form=$form} +
+
+ {intl l="Change orders status after export" d='colissimo.pickup.point.bo.default'} +
+
+ {form_field form=$form field="new_status_id"} + + + + + + + + + + + + + + +
+   + + +
+   + + +
+   + + +
+ {/form_field} + {intl l="*If you choose this option, the exported orders would not be available on this page anymore" d='colissimo.pickup.point.bo.default'} +
+
+ + + + + + + + + + + + {loop name="order.notsent.colissimo.pickup.point" type="order.notsent.colissimo.pickup.point"} + + + + + + + + + {/loop} + +
+ {intl l="REF" d='colissimo.pickup.point.bo.default'} + + {intl l="Customer"} + + {intl l="Date" d='colissimo.pickup.point.bo.default'} + + {intl l="Total taxed amount" d='colissimo.pickup.point.bo.default'} + + {intl l="Package weight" d='colissimo.pickup.point.bo.default'} + + {intl l="Export" d='colissimo.pickup.point.bo.default'} +
+ + + {loop name='order-customer' type='customer' id={$CUSTOMER} current=false} + {$FIRSTNAME} {$LASTNAME} + {/loop} + {elseloop rel='order-customer'} + {intl l='Unknown customer' d='colissimo.pickup.point.bo.default'} + {/elseloop} + + {format_date date=$CREATE_DATE output="datetime"} + + {$TOTAL_TAXED_AMOUNT} {loop name="list.colissimo.pickup.point.getcurrency" type="currency" id=$CURRENCY}{$SYMBOL}{/loop} + + {form_field form=$form field="order_weight_"|cat:$ID} + + {/form_field} + + {form_field form=$form field="order_"|cat:$ID} + + {/form_field} +
+ + + {/form} +
+ + +
+ +
+
+ {intl l="The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference." d='colissimo.pickup.point.bo.default'} +
+ +
+ + {flash type='import-result'} +
+ {$MESSAGE} +
+ {/flash} + + {form name='colissimo.pickup.point.import'} +
+ {form_hidden_fields form=$form} + {render_form_field form=$form field="success_url" value={url path="/admin/module/ColissimoPickupPoint"} current_tab="import"} + + {if $form_error} +
{$form_error_message}
+ {/if} + + {form_field form=$form field="import_file"} +
+ + + +
+ {/form_field} + + +
+ {/form} +
+
+
+ +
+
+
+ {intl l="Advanced configuration" d='colissimo.pickup.bo.default'} +
+ +
+ {form name="colissimo.pickup.point.configure"} + {if $form_error && $form_error_message} +
{$form_error_message}
+ {/if} +
+ {form_hidden_fields form=$form} + {form_field form=$form field='colissimo_pickup_point_endpoint_url'} +
+ + +
+ {/form_field} + {form_field form=$form field='colissimo_pickup_point_username'} +
+ + +
+ {/form_field} + {form_field form=$form field='colissimo_pickup_point_password'} +
+ + +
+ {/form_field} + {form_field form=$form field='colissimo_pickup_point_google_map_key'} +
+ + +
+ {/form_field} +
+ +
+ {/form} +
+
+
+ +
+ {if null !== $smarty.get.price_error} + + {/if} +
+ +
+ + {assign var="isColissimoPickupPointFreeShipping" value=0} + {form name="colissimo.pickup.point.freeshipping.form"} +
+
+ {form_hidden_fields form=$form} + + {form_field form=$form field="freeshipping"} + +
+ {loop type="colissimo.pickup.point.freeshipping" name="freeshipping_colissimo_pickup_point"} + + {/loop} +
+ {/form_field} +
+ +
+
+ {form_field form=$form field="freeshipping_from"} + {loop type="colissimo.pickup.point.freeshipping" name="freeshipping_colissimo_pickup_point"} + {intl l="Or activate free shipping from (€) :" d="colissimo.pickup.point.bo.default"} + + {/loop} + {/form_field} + + + +
+
+
+ {/form} +
+ + +
+ +
+ {intl l="You can create price slices by specifying a maximum cart weight and/or a maximum cart price." d='colissimo.pickup.point.bo.default'} + {intl l="The slices are ordered by maximum cart weight then by maximum cart price." d='colissimo.pickup.point.bo.default'} + {intl l="If a cart matches multiple slices, it will take the last slice following that order." d='colissimo.pickup.point.bo.default'} + {intl l="If you don't specify a cart weight in a slice, it will have priority over the slices with weight." d='colissimo.pickup.point.bo.default'} + {intl l="If you don't specify a cart price in a slice, it will have priority over the other slices with the same weight." d='colissimo.pickup.point.bo.default'} + {intl l="If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice." d='colissimo.pickup.point.bo.default'} +
+ +
+ + {loop type="module" name="module-id-loop" code="ColissimoPickupPoint"} + {assign var="module_id" value=$ID} + {/loop} + {loop type="area" name="area_loop" module_id=$module_id backend_context=true} + {$area_id=$ID} +
+
+ + + + + + + + + + + + + + + + + {loop type="colissimo.pickup.point" name="colissimo_pickup_point_area_$ID" area_id={$area_id} } + + + + + + + {/loop} + + {* New slice *} + {loop type="auth" name="can_change" role="ADMIN" module="colissimopickuppoint" access="CREATE"} + + + + + + + {/loop} + +
+ + + +
{intl l="Weight up to ... kg" d='colissimo.pickup.point.bo.default'}{intl l="Untaxed Price up to ... %symbol" symbol=$currencySymbol d='colissimo.pickup.point.bo.default'}{intl l="Price (%symbol)" symbol=$currencySymbol d='colissimo.pickup.point.bo.default'}{intl l="Actions" d='colissimo.pickup.point.bo.default'}
+ + + + + + +
+ {loop type="auth" name="can_change" role="ADMIN" module="colissimopickuppoint" access="UPDATE"} + + + + {/loop} + {loop type="auth" name="can_change" role="ADMIN" module="colissimopickuppoint" access="DELETE"} + + + + {/loop} +
+
+ + + + + + + + + +
+
+
+ + {/loop} + {elseloop rel="area_loop"} +
+
+ {intl d='colissimo.pickup.point.bo.default' l="You should first attribute shipping zones to the modules: "} + + {intl d='colissimo.pickup.point.bo.default' l="manage shipping zones"} + +
+
+ {/elseloop} +
+ +
+ +
+
+
+
+ + + {include + file = "includes/generic-warning-dialog.html" + + dialog_id = "colissimo_pickup_point_dialog" + dialog_title = {intl d='colissimo.pickup.bo.default' l="Message"} + dialog_body = "" +} + + {* JS Templates *} + + +{/elseloop} diff --git a/local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/css/styles.css b/local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/css/styles.css new file mode 100644 index 00000000..0661c09c --- /dev/null +++ b/local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/css/styles.css @@ -0,0 +1,7 @@ +#colissimo-pickup-pointmap .table tbody > tr > th, #colissimo-pickup-pointmap .table tbody > tr > td { + padding: 10px 10px 0; +} + +.title-colissimo-pickup-point-pickup-type{ + color: #E47A10; +} \ No newline at end of file diff --git a/local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/A2P.png b/local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/A2P.png new file mode 100644 index 0000000000000000000000000000000000000000..6930dc525c4eeb028b75ecb6288b69edd323f043 GIT binary patch literal 2253 zcmV;;2r~DHP)qLDxjuC zAs7f4NK=yXSO~TWi;dq8ypP%0dEa|`W_Q*sW&soNqpEtPquISPbMJS*bIy0pklnBC zf^Y~yK$aPNzUeTuB^Dr{G6Xj3Vg>$`FUS`Y)M=FbK;t$SqUe)3uVG4Z*x#%`IfU~w zIknMuBn2EP4sG@VthBSh2!-X2get)kdoIG+X>)N-2mx~4rv(ta_gRU;&ti@IF~LNN z1m$Ud zSRYYyj!y|t*FOnV-w5vIec(@=2O+5-D8Z`)1i^Nh)8CUgYZyzdc?y>+-Zut0x-1Np zb?Wf?FKs;akLFeWCLU99Q=C-Ls0V8A4?*pD5{RNg;*l3XZvPYlckw*}BxD}1AXDfx zXP;=Yi+|#j>ZBYH%QuOL@>+FW9D-c8cIKtdHO0+=90S0B1vLcDfF`;??sy!W^mAan z`(yCO-U4mwk1!;7WkDK+NB9Rf*^tY8E9tv0xyZ1OiMAYLvI03D!1md#E)IkYy~@x} zyH-tq(-U#rkkkaF3sPzeu;NF+OILx$SAsY4Cd5DUJV?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xbdHpOOE{z|9nJk#x6ybjpbDAc}em9sTzkpl@x08usQZac30f(bffl_Ws{i= zDCqq5@#Z;H$W*r5wG!deJwP0xI4^Pc74}GUUX^>(D}w+jtH-G=rO^73I<^{aT8HT! zZW&h!(~eIDZM^sgl{(Dc*k6!!u&~VCz07#7KDI)?pem}y1_8TuQB~-6EQ<>b)Tm#o z+lof57hxpDCpI&4%0WcQRB!QE#I&b5%kSyFXs6djm6^$yAfxG<#*CAi=sv=d_$Xjf zwsvOo}2? z7YHWG;#zI6Sf&gm64d*P#^mHk$Ciy-Izplb0k0#uCxo~LmFh@yT}QBS)I|3EJp0qx zHksz8DQE20ow;Z5>h=12=T2=>!pg)pa}qDJCY-V3O&JO5LrJ4U?I@GBB9(Go%yXH22B)_)^pE zr;~-pe0_YbN374u5Ahqi*KU%mqBoRX&%Kk8!`TJqk_Wgc9~(4AiuxDX5Isohj&4z0 SEwobi7ssS~(`u-{CjSLCmRqF& literal 0 HcmV?d00001 diff --git a/local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/mobilite-reduite.gif b/local/modules/ColissimoPickupPoint/templates/frontOffice/default/assets/img/mobilite-reduite.gif new file mode 100644 index 0000000000000000000000000000000000000000..f2505d74659730b89b87ed7cd98711ca4944e700 GIT binary patch literal 2113 zcmeHI`$J4=7(OK_ca~kO%W1HSt+~}0GYn;>Nlnw;=B{bxRHJ6jnVC~FO`g?0wNX(j%pN{!;&8Z+e`|XD_;K#xBZ1rC_&o`wXU|tx-#t@$&eheOopF}Cr%b`+_<^7w{OSJ$eXt`di}kcnwsY3W*;Bl`o@N|v^0f6 z+0xcpq%N+i(q!l6#3$^%rM<1u+-9-ZI-P#c-o&o1uGg>Ml$M?g4wk2+q$#(DJ$cg6 z+1ZI8NI}8zh^WYj$X$G2|KyakxVU&Whm@bUNMo^&7E$iA3V$=n{;E4h{_Z`T4oId1y2m7?$+) zy&o7DeEY69RJnb3Tzq)=&h(5du^9397w%HU==J)<{mH86xcK-zA`!eVG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