diff --git a/core/lib/Thelia/Form/CustomerCreateForm.php b/core/lib/Thelia/Form/CustomerCreateForm.php index d0e915657..34159ea12 100644 --- a/core/lib/Thelia/Form/CustomerCreateForm.php +++ b/core/lib/Thelia/Form/CustomerCreateForm.php @@ -86,17 +86,8 @@ class CustomerCreateForm extends AddressCreateForm "for" => "newsletter" ), "required" => false - )) - // Add terms & conditions - ->add("agreed", "checkbox", array( - "constraints" => array( - new Constraints\True(array("message" => Translator::getInstance()->trans("Please accept the Terms and conditions in order to register."))) - ), - "label"=>"Test", - "label_attr" => array( - "for" => "agreed" - ) )); + } public function verifyPasswordField($value, ExecutionContextInterface $context) diff --git a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php index 1d4d07b30..7c8748519 100644 --- a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php @@ -43,9 +43,7 @@ class CustomerProfileUpdateForm extends CustomerCreateForm ->remove("country") // Remove Login Information ->remove("password") - ->remove("password_confirm") - // Remove Terms & conditions - ->remove("agreed"); + ->remove("password_confirm"); } /** diff --git a/core/lib/Thelia/Form/OrderPayment.php b/core/lib/Thelia/Form/OrderPayment.php index 4ecabfe2e..83d795d29 100644 --- a/core/lib/Thelia/Form/OrderPayment.php +++ b/core/lib/Thelia/Form/OrderPayment.php @@ -50,6 +50,16 @@ class OrderPayment extends FirewallForm ) )) ) + )) + // Add terms & conditions + ->add("agreed", "checkbox", array( + "constraints" => array( + new Constraints\True(array("message" => Translator::getInstance()->trans("Please accept the Terms and conditions in order to register."))) + ), + "label"=>"Agreed", + "label_attr" => array( + "for" => "agreed" + ) )); } diff --git a/setup/import.php b/setup/import.php index 2848c83cf..a4c6b4fd7 100644 --- a/setup/import.php +++ b/setup/import.php @@ -81,6 +81,12 @@ try { createProduct($faker, $categories, $brands, $contents, $template, $color, $material, $con); + createCustomer($faker, $con); + + // set some config key + createConfig($faker, $folders, $contents, $con); + + $con->commit(); } catch (Exception $e) { echo "error : ".$e->getMessage()."\n"; @@ -228,6 +234,61 @@ function createProduct($faker, $categories, $brands, $contents, $template, $attr echo "end creating products\n"; } +function createConfig($faker, $folders, $contents, $con){ + + // Store + \Thelia\Model\ConfigQuery::write("store_name", "Thelia"); + \Thelia\Model\ConfigQuery::write("store_description", "E-commerce solution based on Symfony 2"); + \Thelia\Model\ConfigQuery::write("store_email", "Thelia"); + \Thelia\Model\ConfigQuery::write("store_address1", "5 rue Rochon"); + \Thelia\Model\ConfigQuery::write("store_city", "Clermont-Ferrrand"); + \Thelia\Model\ConfigQuery::write("store_phone", "+(33)444053102"); + \Thelia\Model\ConfigQuery::write("store_email", "contact@thelia.net"); + // Contents + \Thelia\Model\ConfigQuery::write("information_folder_id", $folders['Information']->getId()); + \Thelia\Model\ConfigQuery::write("terms_conditions_content_id", $contents["Terms and Conditions"]->getId()); +} + +function createCustomer($faker, $con){ + + echo "Creating customer\n"; + + //customer + $customer = new Thelia\Model\Customer(); + $customer->createOrUpdate( + 1, + "thelia", + "thelia", + "5 rue rochon", + "", + "", + "0102030405", + "0601020304", + "63000", + "Clermont-Ferrand", + 64, + "test@thelia.net", + "azerty" + ); + for ($j = 0; $j <= 2; $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($con) + ; + } +} function createMaterials($con) { @@ -382,12 +443,12 @@ function createFolders($faker, $con) ->setPosition($row-1) ->setLocale('fr_FR') ->setTitle(trim($data[0])) - ->setChapo(trim($data[2]) || $faker->text(20)) - ->setDescription(trim($data[4]) || $faker->text(100)) + ->setChapo($faker->text(20)) + ->setDescription($faker->text(100)) ->setLocale('en_US') ->setTitle(trim($data[1])) - ->setChapo(trim($data[3]) || $faker->text(20)) - ->setDescription(trim($data[5]) || $faker->text(100)) + ->setChapo($faker->text(20)) + ->setDescription($faker->text(100)) ->save($con); $folders[trim($data[1])] = $folder; @@ -432,12 +493,12 @@ function createContents($faker, $folders, $con) ->setPosition($row-1) ->setLocale('fr_FR') ->setTitle(trim($data[0])) - ->setChapo(trim($data[2])) - ->setDescription(trim($data[4])) + ->setChapo($faker->text(20)) + ->setDescription($faker->text(200)) ->setLocale('en_US') ->setTitle(trim($data[1])) - ->setChapo(trim($data[3])) - ->setDescription(trim($data[5])); + ->setChapo($faker->text(20)) + ->setDescription($faker->text(200)); // folder $contentFolders = explode(';', $data[7]); @@ -565,7 +626,6 @@ function clearTables($con) ->find($con); $brand->delete($con); - $category = Thelia\Model\CategoryQuery::create() ->find($con); $category->delete($con); @@ -612,6 +672,10 @@ function clearTables($con) \Thelia\Model\ProductImageQuery::create()->find($con)->delete($con); + $customer = Thelia\Model\CustomerQuery::create() + ->find(); + $customer->delete(); + echo "Tables cleared with success\n"; } diff --git a/setup/insert.sql b/setup/insert.sql index 51de07153..2494099d5 100644 --- a/setup/insert.sql +++ b/setup/insert.sql @@ -37,6 +37,8 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat ('unknown-flag-path','assets/img/flags/unknown.png', 0, 0, NOW(), NOW()), ('html_output_trim_level','1', 0, 0, NOW(), NOW()), ('default_available_stock', '100', 0, 0, NOW(), NOW()), +('information_folder_id', '', 0, 0, NOW(), NOW()), +('terms_conditions_content_id', '', 0, 0, NOW(), NOW()), ('session_config.default', '1', 1, 1, NOW(), NOW()), ('default_lang_without_translation', '1', 1, 1, NOW(), NOW()), @@ -91,6 +93,8 @@ INSERT INTO `config_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `pos (28, 'en_US', 'The path (relative to the default back-office template) to the image used when no flag image can be found for a country', NULL, NULL, NULL), (29, 'en_US', 'Whitespace trim level of the generated HTML code (0 = none, 1 = medium, 2 = maximum)', NULL, NULL, NULL), (30, 'en_US', 'Default available stock when check-available-stock is set to 0.', NULL, NULL, NULL), +(31, 'en_US', 'The ID of the folder containing your information pages : terms, imprint, ...', NULL, NULL, NULL), +(32, 'en_US', 'The ID of the ''Terms & Conditions'' content.', NULL, NULL, NULL), (1, 'fr_FR', 'Nom de la classe du gestionnaire de session', NULL, NULL, NULL), (2, 'fr_FR', 'Vérifier la présence de produits en stock (1) ou l''ignorer (0) lors de l''affichage et la modification des quantités commandées', NULL, NULL, NULL), (3, 'fr_FR', 'Nom du modèle de front-office actif', NULL, NULL, NULL), @@ -120,7 +124,9 @@ INSERT INTO `config_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `pos (27, 'fr_FR', 'Nom de la vue de la livraison dans le modèle PDF en cours (sans extension)', NULL, NULL, NULL), (28, 'fr_FR', 'Le chemin (par rapport au modèle de back-office par défaut) vers l''image utilisée lorsque aucune image de drapeau ne peut être trouvée pour un pays', NULL, NULL, NULL), (29, 'fr_FR', 'Niveau de découpe des espaces dans le code HTML généré (0 = aucun, 1 = moyen, 2 = maximum)', NULL, NULL, NULL), -(30, 'fr_FR', 'Stock disponible par défaut quand check-available-stock est à 0.', NULL, NULL, NULL); +(30, 'fr_FR', 'Stock disponible par défaut quand check-available-stock est à 0.', NULL, NULL, NULL), +(31, 'fr_FR', 'L''ID du dossier contenant vos pages d''informations : CGV, mentions légales, ...', NULL, NULL, NULL), +(32, 'fr_FR', 'L''ID du contenu de vos ''CGV''.', NULL, NULL, NULL); INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES diff --git a/templates/backOffice/default/customers.html b/templates/backOffice/default/customers.html index e9b02a74f..321911e63 100644 --- a/templates/backOffice/default/customers.html +++ b/templates/backOffice/default/customers.html @@ -226,10 +226,6 @@ {/form_field} - {form_field form=$form field="agreed"} - - {/form_field} - {form_field form=$form field='company'}