diff --git a/local/modules/DHL/Config/config.xml b/local/modules/DHL/Config/config.xml index aba082b7..0793ca7c 100644 --- a/local/modules/DHL/Config/config.xml +++ b/local/modules/DHL/Config/config.xml @@ -11,8 +11,6 @@ - -
diff --git a/local/modules/DHL/Config/drop.sql b/local/modules/DHL/Config/drop.sql new file mode 100644 index 00000000..91471a4e --- /dev/null +++ b/local/modules/DHL/Config/drop.sql @@ -0,0 +1,5 @@ +SET FOREIGN_KEY_CHECKS = 0; + +DROP TABLE IF EXISTS `dhl_delivery_price`; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/local/modules/DHL/Controller/Configuration.php b/local/modules/DHL/Controller/Configuration.php index 23e9c835..284b72e8 100644 --- a/local/modules/DHL/Controller/Configuration.php +++ b/local/modules/DHL/Controller/Configuration.php @@ -14,7 +14,7 @@ use Thelia\Tools\URL; /** * Class Configuration * @package DHL\Controller - * @author Thomas Arnaud + * @author Laurent LE CORRE */ class Configuration extends BaseAdminController { diff --git a/local/modules/DHL/Controller/EditPrices.php b/local/modules/DHL/Controller/EditPrices.php index baf9850e..6febc986 100644 --- a/local/modules/DHL/Controller/EditPrices.php +++ b/local/modules/DHL/Controller/EditPrices.php @@ -17,7 +17,7 @@ use Thelia\Tools\URL; /** * Class EditPrices * @package DHL\Controller - * @author Thelia + * @author Laurent LE CORRE */ class EditPrices extends BaseAdminController { diff --git a/local/modules/DHL/DHL.php b/local/modules/DHL/DHL.php index 0136f0e4..3c2a5599 100644 --- a/local/modules/DHL/DHL.php +++ b/local/modules/DHL/DHL.php @@ -15,9 +15,16 @@ use Thelia\Model\AreaQuery; use Thelia\Model\Country; use Thelia\Model\CountryArea; use Thelia\Model\CountryQuery; +use Thelia\Model\MessageQuery; +use Thelia\Model\ModuleConfigQuery; use Thelia\Module\AbstractDeliveryModule; use Thelia\Module\Exception\DeliveryException; +/** + * Class DHL + * @package DHL + * @author Laurent LE CORRE + */ class DHL extends AbstractDeliveryModule { protected $request; @@ -29,6 +36,9 @@ class DHL extends AbstractDeliveryModule const JSON_PRICE_RESOURCE = "/Config/prices.json"; const WEBSERVICE_URL = 'tracking_url'; + const TRACKING_MESSAGE_NAME = 'mail_dhl'; + + public static function getPrices($areaId) { if (null === self::$prices) { @@ -183,4 +193,28 @@ class DHL extends AbstractDeliveryModule return $postage; } + /** + * @param ConnectionInterface|null $con + * @param bool $deleteModuleData + * @throws \Propel\Runtime\Exception\PropelException + */ + public function destroy(ConnectionInterface $con = null, $deleteModuleData = false) + { + if ($deleteModuleData) { + // Delete message + MessageQuery::create()->filterByName(self::TRACKING_MESSAGE_NAME)->delete($con); + + // Delete module config data + ModuleConfigQuery::create()->filterByModuleId(self::getModuleId())->delete($con); + + // Delete module tables. + if (null !== $con) { + $database = new Database($con); + $database->insertSql(null, [__DIR__ . '/Config/drop.sql']); + } + } + + parent::destroy($con, $deleteModuleData); + } + } diff --git a/local/modules/DHL/Form/Configuration.php b/local/modules/DHL/Form/Configuration.php index 6ad8da5d..642d6647 100644 --- a/local/modules/DHL/Form/Configuration.php +++ b/local/modules/DHL/Form/Configuration.php @@ -3,8 +3,6 @@ namespace DHL\Form; use DHL\DHL; -use DHL\Model\Config\Base\DHLConfigValue; -use Thelia\Core\Translation\Translator; use Thelia\Form\BaseForm; /** diff --git a/local/modules/DHL/Hook/HookManager.php b/local/modules/DHL/Hook/HookManager.php index 7c255401..85d53ae9 100644 --- a/local/modules/DHL/Hook/HookManager.php +++ b/local/modules/DHL/Hook/HookManager.php @@ -8,7 +8,7 @@ use Thelia\Core\Hook\BaseHook; /** * Class HookManager * @package DHL\Hook - * @author Thomas Arnaud + * @author Laurent LE CORRE */ class HookManager extends BaseHook { diff --git a/local/modules/DHL/I18n/backOffice/default/de_DE.php b/local/modules/DHL/I18n/backOffice/default/de_DE.php deleted file mode 100644 index 867bf22d..00000000 --- a/local/modules/DHL/I18n/backOffice/default/de_DE.php +++ /dev/null @@ -1,25 +0,0 @@ - '*Wenn Sie diese Option auswählen, sind die exportierten Bestellungen auf dieser Seite nicht mehr verfügbar', - 'Actions' => 'Aktionen', - 'An error occured' => 'Ein Fehler ist aufgetreten', - 'Area : ' => 'Bereich : ', - 'Cancel' => 'Abbrechen', - 'Change orders status after export' => 'Status der Bestellung nach dem Export ändern', - 'DHL Module allows to send your products all around the world with La Poste.' => 'DHL Modul ermöglicht, Ihre Produkte mit La Poste weltweit zu versenden.', - 'Create' => 'Erstellen', - 'Date' => 'Datum', - 'Delete' => 'Löschen', - 'Do not change' => 'Nicht ändern', - 'Edit' => 'Ändern', - 'Export' => 'Export', - 'Please change the access rights' => 'Bitte ändern Sie die Zugriffsrechte', - 'Price (€)' => 'Preis (€)', - 'Processing' => 'Bearbeitung', - 'REF' => 'REF', - 'Sent' => 'Gesendet', - 'There is currently not orders to export' => 'Es gibt derzeit keine Bestellungen, die exportiert werden können', - 'Total taxed amount' => 'Gesamter besteuerter Betrag', - 'Weight up to ... (kg)' => 'Gewicht bis zu ... (kg)', -]; diff --git a/local/modules/DHL/I18n/backOffice/default/en_US.php b/local/modules/DHL/I18n/backOffice/default/en_US.php index fb60da5e..5a80f8c9 100644 --- a/local/modules/DHL/I18n/backOffice/default/en_US.php +++ b/local/modules/DHL/I18n/backOffice/default/en_US.php @@ -1,7 +1,6 @@ '*If you choose this option, the exported orders would not be available on this page anymore', 'Actions' => 'Actions', 'An error occured' => 'An error occured', 'Area : ' => 'Area : ', @@ -21,7 +20,6 @@ return array( 'Edit a price slice' => 'Edit a price slice', 'Edit this price slice' => 'Edit this price slice', 'Export' => 'Export', - 'Export expeditor inet file' => 'Export expeditor inet file', 'Please change the access rights' => 'Please change the access rights', 'Price (€)' => 'Price (€)', 'Price slices' => 'Price slices', diff --git a/local/modules/DHL/I18n/backOffice/default/fr_FR.php b/local/modules/DHL/I18n/backOffice/default/fr_FR.php index d7889dbc..7aa7553f 100644 --- a/local/modules/DHL/I18n/backOffice/default/fr_FR.php +++ b/local/modules/DHL/I18n/backOffice/default/fr_FR.php @@ -1,37 +1,22 @@ '* Si vous choisissez cette option, les commandes exportées ne seront plus affichée sur cette page.', +return array( 'Actions' => 'Actions', - 'An error occured' => 'Une erreur est survenue', 'Area : ' => 'Zone de livraison : ', 'Cancel' => 'Annuler', - 'Change orders status after export' => 'Modification du statut des commande après l\'export', - 'DHL Module allows to send your products all around the world with La Poste.' => 'DHL vous permet d’expédier vos colis dans le monde entier avec La Poste', 'Create' => 'Créer', 'Create a new price slice' => 'Créer une nouvelle tranche de prix', 'Create a price slice' => 'Créer une tranche de prix', - 'Customer' => 'Client', - 'Date' => 'Date', + 'DHL Module allows to send your products all around the world.' => 'Les services DHL vous permettent d\'envoyer des colis partout dans le monde.', 'Delete' => 'Supprimer', 'Delete a price slice' => 'Supprimer une tranche de prix', 'Delete this price slice' => 'Supprimer cette tranche de prix', - 'Do not change' => 'Ne pas modifier', 'Do you really want to delete this slice ?' => 'Confirmez-vous la suppression de cette tranche de prix', 'Edit' => 'Modifier', 'Edit a price slice' => 'Modifier une tranche de prix', 'Edit this price slice' => 'Modifier cette tranche de prix', - 'Export' => 'Export', - 'Export expeditor inet file' => 'Exporter le fichier Expeditor INET', - 'Number of packages' => 'Nombre de colis', - 'Packages weight' => 'Poids des colis', 'Please change the access rights' => 'Merci de modifier les droits d\'accès', 'Price (€)' => 'Prix (€)', - 'Price slices' => 'Prix et poids', - 'Processing' => 'Traitement', - 'REF' => 'REF', - 'Sent' => 'Envoyée', - 'There is currently not orders to export' => 'Il n\'y a pas de commande à exporter pour le moment', - 'Total taxed amount' => 'Total TTC', + 'Save' => 'Sauvegarder', 'Weight up to ... (kg)' => 'Jusqu\'au poids (Kg)', -]; +); diff --git a/local/modules/DHL/I18n/backOffice/default/it_IT.php b/local/modules/DHL/I18n/backOffice/default/it_IT.php deleted file mode 100644 index 58e711dc..00000000 --- a/local/modules/DHL/I18n/backOffice/default/it_IT.php +++ /dev/null @@ -1,13 +0,0 @@ - 'Azioni', - 'Cancel' => 'Annulla', - 'Create' => 'Creare', - 'Date' => 'Data', - 'Delete' => 'Cancellare', - 'Edit' => 'Modifica', - 'Export' => 'Esporta', - 'Number of packages' => 'Numero di pacchetti', - 'Packages weight' => 'Peso pacchi', -]; diff --git a/local/modules/DHL/I18n/backOffice/default/tr_TR.php b/local/modules/DHL/I18n/backOffice/default/tr_TR.php deleted file mode 100644 index 35584af1..00000000 --- a/local/modules/DHL/I18n/backOffice/default/tr_TR.php +++ /dev/null @@ -1,34 +0,0 @@ - '* Bu seçeneği seçerseniz, ihracat siparişleri artık bu sayfadaki müsait olmaz', - 'Actions' => 'Eylemler', - 'An error occured' => 'Bir hata meydana geldi', - 'Area : ' => 'Alanı: ', - 'Cancel' => 'Vazgeç', - 'Change orders status after export' => 'İhracat sonra sipariş durumunu değiştir', - 'DHL Module allows to send your products all around the world with La Poste.' => 'DHL modülü sağlar ürünlerinizi göndermek için La Poste ile dünyanın her yerinden.', - 'Create' => 'Oluştur', - 'Create a new price slice' => 'Yeni fiyat dilimi oluşturmak', - 'Create a price slice' => 'Bir fiyat dilim oluşturma', - 'Date' => 'Tarih', - 'Delete' => 'sil', - 'Delete a price slice' => 'Bir fiyat dilim silmek', - 'Delete this price slice' => 'Bu fiyat dilim silmek', - 'Do not change' => 'Değiştirme', - 'Do you really want to delete this slice ?' => 'Gerçekten bu dosyayı silmek istiyor musunuz ?', - 'Edit' => 'Düzenle', - 'Edit a price slice' => 'Bir fiyat dilim Düzenle', - 'Edit this price slice' => 'Bu fiyat dilim Düzenle', - 'Export' => 'Dışa aktarma', - 'Export expeditor inet file' => 'Expeditor inet dosyası dışa aktarma', - 'Please change the access rights' => 'Lütfen erişim haklarını Değiştir', - 'Price (€)' => 'Fiyat (TL)', - 'Price slices' => 'Fiyat dilimleri', - 'Processing' => 'İşlem devam ediyor', - 'REF' => 'ÜRÜN KODU', - 'Sent' => 'Gönder', - 'There is currently not orders to export' => 'Şu anda hiçbir emir vermek için', - 'Total taxed amount' => 'Toplam Kdvtutarı', - 'Weight up to ... (kg)' => 'Fazla kilo... (kg)', -]; diff --git a/local/modules/DHL/I18n/de_DE.php b/local/modules/DHL/I18n/de_DE.php deleted file mode 100644 index 60a35d52..00000000 --- a/local/modules/DHL/I18n/de_DE.php +++ /dev/null @@ -1,14 +0,0 @@ - 'Kostenlose Lieferung aktivieren: ', - 'Can\'t read Config directory' => 'Config-Verzeichnis kann nicht gelesen werden', - 'Can\'t read file' => 'Datei kann nicht gelesen werden', - 'Can\'t write Config directory' => 'Config-Verzeichnis kann nicht beschrieben werden', - 'Can\'t write file' => 'Datei kann nicht geschrieben werden', - 'DHL delivery unavailable for the delivery country' => 'Eine Lieferung mit DHL ist für das Land nicht verfügbar', - 'DHL delivery unavailable for this cart weight (%weight kg)' => 'Eine Lieferung mit DHL ist für Warenkörbe mit diesem Gewicht (%weight kg) nicht verfügbar', - 'Modify status export after export' => 'Status der Bestellung nach dem Export ändern', - 'dhl expeditor export' => 'DHL expeditor export', - 'select a valid status' => 'Wählen Sie einen gültigen Bestellungsstatus aus', -]; diff --git a/local/modules/DHL/I18n/en_US.php b/local/modules/DHL/I18n/en_US.php index 0155cfff..b7f744c7 100644 --- a/local/modules/DHL/I18n/en_US.php +++ b/local/modules/DHL/I18n/en_US.php @@ -1,14 +1,11 @@ 'Activate free shipping: ', 'Can\'t read Config directory' => 'Can\'t read Config directory', 'Can\'t read file' => 'Can\'t read file', 'Can\'t write Config directory' => 'Can\'t write Config directory', 'Can\'t write file' => 'Can\'t write file', 'DHL delivery unavailable for the delivery country' => 'DHL delivery unavailable for the delivery country', 'DHL delivery unavailable for this cart weight (%weight kg)' => 'DHL delivery unavailable for this cart weight (%weight kg)', - 'Modify status export after export' => 'Change orders status after export', - 'dhl expeditor export' => 'DHL Expeditor export', 'select a valid status' => 'Select a valid order status', ); diff --git a/local/modules/DHL/I18n/fr_FR.php b/local/modules/DHL/I18n/fr_FR.php index e970ef93..cdd64071 100644 --- a/local/modules/DHL/I18n/fr_FR.php +++ b/local/modules/DHL/I18n/fr_FR.php @@ -1,14 +1,12 @@ 'Activer la livraison offerte: ', +return array( 'Can\'t read Config directory' => 'Le dossier Config ne peut être lu', 'Can\'t read file' => 'Le fichier suivant ne peut être lu', 'Can\'t write Config directory' => 'Le dossier Config ne peut être écrit', 'Can\'t write file' => 'Le fichier suivant ne peut être écrit', 'DHL delivery unavailable for the delivery country' => 'La livraison par DHL n\'est pas disponible dans ce pays', 'DHL delivery unavailable for this cart weight (%weight kg)' => 'La livraison par DHL n\'est pas disponible pour un panier de %weight Kg', - 'Modify status export after export' => 'Modification du statut des commandes après l\'export', - 'dhl expeditor export' => 'Export pour le logiciel Expeditor', - 'select a valid status' => 'Choisissez un statut de commande valide.', -]; + 'DHL tracking URL' => 'URL de suivi DHL', + 'This is the URL of the DHL tracking service.' => 'Saisissez ici l\'URL du service de suivi DHL', +); diff --git a/local/modules/DHL/I18n/tr_TR.php b/local/modules/DHL/I18n/tr_TR.php deleted file mode 100644 index 6f82e712..00000000 --- a/local/modules/DHL/I18n/tr_TR.php +++ /dev/null @@ -1,14 +0,0 @@ - 'Ücretsiz nakliye etkinleştirmek için: ', - 'Can\'t read Config directory' => 'Yapılandırma dizini okunamıyor', - 'Can\'t read file' => 'Dosyayı okuyamıyor', - 'Can\'t write Config directory' => 'Dosyayı okuyamıyor', - 'Can\'t write file' => 'Dosyaya yazılamıyor', - 'DHL delivery unavailable for the delivery country' => 'Bu Teslimat Bu ülke için kullanılamaz DHL teslim', - 'DHL delivery unavailable for this cart weight (%weight kg)' => 'DHL teslimat için bu sepeti ağırlık (%weight kg) kullanılamaz', - 'Modify status export after export' => 'İhracat sonra sipariş durumunu değiştir', - 'dhl expeditor export' => 'DHL Expeditor verme', - 'select a valid status' => 'Geçerli sipariş durumunu seçin', -]; diff --git a/local/modules/DHL/Loop/CheckRightsLoop.php b/local/modules/DHL/Loop/CheckRightsLoop.php index 289b8998..a163018f 100644 --- a/local/modules/DHL/Loop/CheckRightsLoop.php +++ b/local/modules/DHL/Loop/CheckRightsLoop.php @@ -1,14 +1,5 @@ + * @package DHL\Loop + * @author Laurent LE CORRE */ class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface { diff --git a/local/modules/DHL/Loop/NotSendLoop.php b/local/modules/DHL/Loop/NotSendLoop.php index 20101712..9104ff7c 100644 --- a/local/modules/DHL/Loop/NotSendLoop.php +++ b/local/modules/DHL/Loop/NotSendLoop.php @@ -1,14 +1,4 @@ + * @author Laurent LE CORRE */ class NotSendLoop extends Order { diff --git a/local/modules/DHL/Model/Base/DHLDeliveryPrice.php b/local/modules/DHL/Model/Base/DHLDeliveryPrice.php index 6ec91652..24bec712 100644 --- a/local/modules/DHL/Model/Base/DHLDeliveryPrice.php +++ b/local/modules/DHL/Model/Base/DHLDeliveryPrice.php @@ -10,7 +10,6 @@ use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveRecord\ActiveRecordInterface; -use Propel\Runtime\Collection\Collection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\BadMethodCallException; use Propel\Runtime\Exception\PropelException; diff --git a/local/modules/DHL/Model/Base/DHLDeliveryPriceQuery.php b/local/modules/DHL/Model/Base/DHLDeliveryPriceQuery.php index 2831e2d2..7e345a20 100644 --- a/local/modules/DHL/Model/Base/DHLDeliveryPriceQuery.php +++ b/local/modules/DHL/Model/Base/DHLDeliveryPriceQuery.php @@ -11,11 +11,9 @@ use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelJoin; -use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\Area; /** * Base class that represents a query for the 'dhl_delivery_price' table. diff --git a/local/modules/DHL/Model/Config/Base/DHLDeliveryPrice.php b/local/modules/DHL/Model/Config/Base/DHLDeliveryPrice.php index 6ec91652..24bec712 100644 --- a/local/modules/DHL/Model/Config/Base/DHLDeliveryPrice.php +++ b/local/modules/DHL/Model/Config/Base/DHLDeliveryPrice.php @@ -10,7 +10,6 @@ use Propel\Runtime\Propel; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveRecord\ActiveRecordInterface; -use Propel\Runtime\Collection\Collection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\BadMethodCallException; use Propel\Runtime\Exception\PropelException; diff --git a/local/modules/DHL/Model/Config/Base/DHLDeliveryPriceQuery.php b/local/modules/DHL/Model/Config/Base/DHLDeliveryPriceQuery.php index a900bbd2..82ce2b64 100644 --- a/local/modules/DHL/Model/Config/Base/DHLDeliveryPriceQuery.php +++ b/local/modules/DHL/Model/Config/Base/DHLDeliveryPriceQuery.php @@ -14,7 +14,6 @@ use Propel\Runtime\ActiveQuery\ModelJoin; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\Area; /** * Base class that represents a query for the 'dhl_delivery_price' table. diff --git a/local/modules/DHL/Model/Config/Map/DHLDeliveryPriceTableMap.php b/local/modules/DHL/Model/Config/Map/DHLDeliveryPriceTableMap.php deleted file mode 100644 index bf1a6c47..00000000 --- a/local/modules/DHL/Model/Config/Map/DHLDeliveryPriceTableMap.php +++ /dev/null @@ -1,426 +0,0 @@ - array('Id', 'MaxWeight', 'PriceWithTax', 'AreaId', ), - self::TYPE_STUDLYPHPNAME => array('id', 'maxWeight', 'priceWithTax', 'areaId', ), - self::TYPE_COLNAME => array(DHLDeliveryPriceTableMap::ID, DHLDeliveryPriceTableMap::MAX_WEIGHT, DHLDeliveryPriceTableMap::PRICE_WITH_TAX, DHLDeliveryPriceTableMap::AREA_ID, ), - self::TYPE_RAW_COLNAME => array('ID', 'MAX_WEIGHT', 'PRICE_WITH_TAX', 'AREA_ID', ), - self::TYPE_FIELDNAME => array('id', 'max_weight', 'price_with_tax', 'area_id', ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); - - /** - * 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, 'MaxWeight' => 1, 'PriceWithTax' => 2, 'AreaId' => 3, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'maxWeight' => 1, 'priceWithTax' => 2, 'areaId' => 3, ), - self::TYPE_COLNAME => array(DHLDeliveryPriceTableMap::ID => 0, DHLDeliveryPriceTableMap::MAX_WEIGHT => 1, DHLDeliveryPriceTableMap::PRICE_WITH_TAX => 2, DHLDeliveryPriceTableMap::AREA_ID => 3, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'MAX_WEIGHT' => 1, 'PRICE_WITH_TAX' => 2, 'AREA_ID' => 3, ), - self::TYPE_FIELDNAME => array('id' => 0, 'max_weight' => 1, 'price_with_tax' => 2, 'area_id' => 3, ), - self::TYPE_NUM => array(0, 1, 2, 3, ) - ); - - /** - * 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('dhl_delivery_price'); - $this->setPhpName('DHLDeliveryPrice'); - $this->setClassName('\\DHL\\Model\\DHLDeliveryPrice'); - $this->setPackage('DHL.Model'); - $this->setUseIdGenerator(true); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('MAX_WEIGHT', 'MaxWeight', 'DECIMAL', true, 16, 0); - $this->addColumn('PRICE_WITH_TAX', 'PriceWithTax', 'DECIMAL', true, 16, 0); - $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null); - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'CASCADE', '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 ? DHLDeliveryPriceTableMap::CLASS_DEFAULT : DHLDeliveryPriceTableMap::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 (DHLDeliveryPrice object, last column rank) - */ - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) - { - $key = DHLDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = DHLDeliveryPriceTableMap::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 + DHLDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS; - } else { - $cls = DHLDeliveryPriceTableMap::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $offset, false, $indexType); - DHLDeliveryPriceTableMap::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 = DHLDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = DHLDeliveryPriceTableMap::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; - DHLDeliveryPriceTableMap::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(DHLDeliveryPriceTableMap::ID); - $criteria->addSelectColumn(DHLDeliveryPriceTableMap::MAX_WEIGHT); - $criteria->addSelectColumn(DHLDeliveryPriceTableMap::PRICE_WITH_TAX); - $criteria->addSelectColumn(DHLDeliveryPriceTableMap::AREA_ID); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.MAX_WEIGHT'); - $criteria->addSelectColumn($alias . '.PRICE_WITH_TAX'); - $criteria->addSelectColumn($alias . '.AREA_ID'); - } - } - - /** - * 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(DHLDeliveryPriceTableMap::DATABASE_NAME)->getTable(DHLDeliveryPriceTableMap::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this tableMap class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(DHLDeliveryPriceTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(DHLDeliveryPriceTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new DHLDeliveryPriceTableMap()); - } - } - - /** - * Performs a DELETE on the database, given a DHLDeliveryPrice or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or DHLDeliveryPrice 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(DHLDeliveryPriceTableMap::DATABASE_NAME); - } - - if ($values instanceof Criteria) { - // rename for clarity - $criteria = $values; - } elseif ($values instanceof \DHL\Model\DHLDeliveryPrice) { // 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(DHLDeliveryPriceTableMap::DATABASE_NAME); - $criteria->add(DHLDeliveryPriceTableMap::ID, (array) $values, Criteria::IN); - } - - $query = DHLDeliveryPriceQuery::create()->mergeWith($criteria); - - if ($values instanceof Criteria) { DHLDeliveryPriceTableMap::clearInstancePool(); - } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { DHLDeliveryPriceTableMap::removeInstanceFromPool($singleval); - } - } - - return $query->delete($con); - } - - /** - * Deletes all rows from the dhl_delivery_price 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 DHLDeliveryPriceQuery::create()->doDeleteAll($con); - } - - /** - * Performs an INSERT on the database, given a DHLDeliveryPrice or Criteria object. - * - * @param mixed $criteria Criteria or DHLDeliveryPrice 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(DHLDeliveryPriceTableMap::DATABASE_NAME); - } - - if ($criteria instanceof Criteria) { - $criteria = clone $criteria; // rename for clarity - } else { - $criteria = $criteria->buildCriteria(); // build Criteria from DHLDeliveryPrice object - } - - if ($criteria->containsKey(DHLDeliveryPriceTableMap::ID) && $criteria->keyContainsValue(DHLDeliveryPriceTableMap::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.DHLDeliveryPriceTableMap::ID.')'); - } - - - // Set the correct dbName - $query = DHLDeliveryPriceQuery::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; - } - -} // DHLDeliveryPriceTableMap -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -DHLDeliveryPriceTableMap::buildTableMap(); diff --git a/local/modules/DHL/Model/DHLDeliveryPriceQuery.php b/local/modules/DHL/Model/DHLDeliveryPriceQuery.php index a69bc5dd..2a9bfdd9 100644 --- a/local/modules/DHL/Model/DHLDeliveryPriceQuery.php +++ b/local/modules/DHL/Model/DHLDeliveryPriceQuery.php @@ -4,7 +4,6 @@ namespace DHL\Model; use DHL\Model\Base\DHLDeliveryPriceQuery as BaseDHLDeliveryPriceQuery; - class DHLDeliveryPriceQuery extends BaseDHLDeliveryPriceQuery {