From 9304624708c21093345ccebf2973049b04f98a9b Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 12 Sep 2013 08:12:44 +0200 Subject: [PATCH] fix title name in insert.sql file --- .../lib/Thelia/Core/Template/Loop/Address.php | 4 +- core/lib/Thelia/Model/Customer.php | 2 + install/faker.php | 42 ++++++++--- install/insert.sql | 8 +- templates/admin/default/customer-edit.html | 74 ++++--------------- 5 files changed, 54 insertions(+), 76 deletions(-) diff --git a/core/lib/Thelia/Core/Template/Loop/Address.php b/core/lib/Thelia/Core/Template/Loop/Address.php index 831a8dca1..1321592f4 100755 --- a/core/lib/Thelia/Core/Template/Loop/Address.php +++ b/core/lib/Thelia/Core/Template/Loop/Address.php @@ -63,7 +63,7 @@ class Address extends BaseLoop ), 'current' ), - Argument::createBooleanTypeArgument('default', false), + Argument::createBooleanTypeArgument('default'), Argument::createIntListTypeArgument('exclude') ); } @@ -100,6 +100,8 @@ class Address extends BaseLoop if ($default === true) { $search->filterByIsDefault(1, Criteria::EQUAL); + } else if($default === false) { + $search->filterByIsDefault(0, Criteria::EQUAL); } $exclude = $this->getExclude(); diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php index 080c02ed6..965b2176d 100755 --- a/core/lib/Thelia/Model/Customer.php +++ b/core/lib/Thelia/Model/Customer.php @@ -88,6 +88,7 @@ class Customer extends BaseCustomer implements UserInterface ->setPhone($phone) ->setCellphone($cellphone) ->setZipcode($zipcode) + ->setCity($city) ->setCountryId($countryId) ->setIsDefault(1) ; @@ -107,6 +108,7 @@ class Customer extends BaseCustomer implements UserInterface ->setPhone($phone) ->setCellphone($cellphone) ->setZipcode($zipcode) + ->setCity($city) ->setCountryId($countryId) ->save($con) ; diff --git a/install/faker.php b/install/faker.php index ae608bf7d..167286138 100755 --- a/install/faker.php +++ b/install/faker.php @@ -159,20 +159,40 @@ try { for($i = 0; $i < 50; $i++) { $customer = new Thelia\Model\Customer(); $customer->createOrUpdate( - 1, - "thelia".$i, - "thelia".$i, - "5 rue rochon", - "", - "", - "0102030405", - "0601020304", - "63000", - "clermont-ferrand", + rand(1,3), + $faker->firstname, + $faker->lastname, + $faker->streetAddress, + $faker->streetAddress, + $faker->streetAddress, + $faker->phoneNumber, + $faker->phoneNumber, + $faker->postcode, + $faker->city, 64, - sprintf("test%d@thelia.net", $i), + $faker->email, "azerty".$i ); + + for ($j = 0; $j <= 3; $j++) { + $address = new Thelia\Model\Address(); + $address->setLabel($faker->text(20)) + ->setTitleId(rand(1,3)) + ->setFirstname($faker->firstname) + ->setLastname($faker->lastname) + ->setAddress1($faker->streetAddress) + ->setAddress2($faker->streetAddress) + ->setAddress3($faker->streetAddress) + ->setCellphone($faker->phoneNumber) + ->setPhone($faker->phoneNumber) + ->setZipcode($faker->postcode) + ->setCity($faker->city) + ->setCountryId(64) + ->setCustomer($customer) + ->save() + ; + + } } //features and features_av diff --git a/install/insert.sql b/install/insert.sql index 253b6cb30..d91035382 100755 --- a/install/insert.sql +++ b/install/insert.sql @@ -32,10 +32,10 @@ INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `upda INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES (1, 'fr_FR', 'Mr', 'Monsieur'), (1, 'en_US', 'M', 'Mister'), -(2, 'fr_FR', 'Mrs', 'Madame'), -(2, 'en_US', 'Mme', 'Misses'), -(3, 'fr_FR', 'Miss', 'Madamemoiselle'), -(3, 'en_US', 'Mlle', 'Miss'); +(2, 'fr_FR', 'Mme', 'Madame'), +(2, 'en_US', 'Mrs', 'Misses'), +(3, 'fr_FR', 'Mlle', 'Madamemoiselle'), +(3, 'en_US', 'Miss', 'Miss'); INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate`, `position` ,`by_default` ,`created_at` ,`updated_at`) VALUES diff --git a/templates/admin/default/customer-edit.html b/templates/admin/default/customer-edit.html index c512bb056..216337927 100644 --- a/templates/admin/default/customer-edit.html +++ b/templates/admin/default/customer-edit.html @@ -52,8 +52,8 @@ @@ -143,67 +143,20 @@ + {loop name="address" type="address" customer="$customer_id" backend_context="1" default="0"}
- Twitter, Inc.
- 795 Folsom Ave, Suite 600
- San Francisco, CA 94107
- P: (123) 456-7890 -
- - -
- - - - - - - - - - - - - -
- - - - -
- Twitter, Inc.
- 795 Folsom Ave, Suite 600
- San Francisco, CA 94107
- P: (123) 456-7890 -
- - -
- - - - - - - - - - - - - -
- - - - -
- Twitter, Inc.
- 795 Folsom Ave, Suite 600
- San Francisco, CA 94107
- P: (123) 456-7890 + {loop name="address.title" type="title" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME} {$LASTNAME}
+ {$ADDRESS1}
+ {$ADDRESS2}
+ {$ADDRESS3}
+ {if $PHONE} + P: {$PHONE}
+ {/if} + {if $CELLPHONE} + P: {$CELLPHONE} + {/if}
@@ -224,6 +177,7 @@ + {/loop}