From 50b55fba14aca36bfd20b31ff8df5899a178c0a8 Mon Sep 17 00:00:00 2001 From: TheCoreDev Date: Fri, 5 Nov 2021 21:52:08 +0100 Subject: [PATCH] Il manquait plein de fichiers dans Git --- ...-de-grenoble-version-2010-francais-17.html | 228 ++--- .../AdminOrderCreation/AdminOrderCreation.php | 68 ++ local/modules/AdminOrderCreation/CHANGELOG.md | 7 + .../AdminOrderCreation/Config/config.xml | 21 + .../AdminOrderCreation/Config/module.xml | 28 + .../AdminOrderCreation/Config/routing.xml | 18 + .../AdminOrderCreation/Config/schema.xml | 30 + .../Controller/OrderController.php | 803 ++++++++++++++++++ .../Form/OrderCreateForm.php | 213 +++++ .../Hook/Back/OrderEditHook.php | 22 + .../Hook/Back/OrderHook.php | 35 + .../I18n/backOffice/default/fr_FR.php | 61 ++ .../modules/AdminOrderCreation/I18n/en_US.php | 4 + .../modules/AdminOrderCreation/I18n/fr_FR.php | 4 + local/modules/AdminOrderCreation/LICENSE | 21 + .../AdminOrderCreation/Model/Order.php | 63 ++ local/modules/AdminOrderCreation/Readme.md | 24 + .../modules/AdminOrderCreation/Util/Calc.php | 39 + .../Util/CriteriaSearchTrait.php | 54 ++ .../modules/AdminOrderCreation/composer.json | 13 + .../ajax/order-create-modal-success.html | 5 + .../ajax/order-create-modal.html | 592 +++++++++++++ .../admin-order-creation/assets/js/script.js | 465 ++++++++++ .../hook/orders.edit.js.html | 17 + .../admin-order-creation/hook/orders.js.html | 56 ++ .../hook/orders.table-header.html | 3 + .../include/product-line.html | 152 ++++ .../Atos/Config/certif.fr.031203376400035 | 86 +- .../modules/Atos/I18n/email-templates/en.html | 118 +-- .../modules/Atos/I18n/email-templates/en.txt | 16 +- .../modules/Atos/I18n/email-templates/fr.html | 122 +-- .../modules/Atos/I18n/email-templates/fr.txt | 16 +- .../I18n/email-templates/en.html | 108 +-- .../I18n/email-templates/en.txt | 12 +- .../I18n/email-templates/fr.html | 112 +-- .../I18n/email-templates/fr.txt | 12 +- .../PurgeFakeCustomer/Config/config.xml | 18 + .../PurgeFakeCustomer/Config/module.xml | 28 + .../PurgeFakeCustomer/Config/routing.xml | 12 + .../PurgeFakeCustomer/PurgeFakeCustomer.php | 11 + local/modules/PurgeFakeCustomer/Readme.md | 55 ++ local/modules/PurgeFakeCustomer/composer.json | 11 + .../sterivein/assets/less/styles.less | 22 +- .../assets/themes/default/less/variables.less | 230 ++--- .../sterivein/includes/brand-menu.html | 24 +- templates/frontOffice/sterivein/layout.tpl | 790 ++++++++--------- templates/frontOffice/sterivein/password.html | 88 +- 47 files changed, 3945 insertions(+), 992 deletions(-) create mode 100644 local/modules/AdminOrderCreation/AdminOrderCreation.php create mode 100644 local/modules/AdminOrderCreation/CHANGELOG.md create mode 100644 local/modules/AdminOrderCreation/Config/config.xml create mode 100644 local/modules/AdminOrderCreation/Config/module.xml create mode 100644 local/modules/AdminOrderCreation/Config/routing.xml create mode 100644 local/modules/AdminOrderCreation/Config/schema.xml create mode 100644 local/modules/AdminOrderCreation/Controller/OrderController.php create mode 100644 local/modules/AdminOrderCreation/Form/OrderCreateForm.php create mode 100644 local/modules/AdminOrderCreation/Hook/Back/OrderEditHook.php create mode 100644 local/modules/AdminOrderCreation/Hook/Back/OrderHook.php create mode 100644 local/modules/AdminOrderCreation/I18n/backOffice/default/fr_FR.php create mode 100644 local/modules/AdminOrderCreation/I18n/en_US.php create mode 100644 local/modules/AdminOrderCreation/I18n/fr_FR.php create mode 100644 local/modules/AdminOrderCreation/LICENSE create mode 100644 local/modules/AdminOrderCreation/Model/Order.php create mode 100644 local/modules/AdminOrderCreation/Readme.md create mode 100644 local/modules/AdminOrderCreation/Util/Calc.php create mode 100644 local/modules/AdminOrderCreation/Util/CriteriaSearchTrait.php create mode 100644 local/modules/AdminOrderCreation/composer.json create mode 100644 local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/ajax/order-create-modal-success.html create mode 100644 local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/ajax/order-create-modal.html create mode 100644 local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/assets/js/script.js create mode 100644 local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.edit.js.html create mode 100644 local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.js.html create mode 100644 local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.table-header.html create mode 100644 local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/include/product-line.html create mode 100644 local/modules/PurgeFakeCustomer/Config/config.xml create mode 100644 local/modules/PurgeFakeCustomer/Config/module.xml create mode 100644 local/modules/PurgeFakeCustomer/Config/routing.xml create mode 100644 local/modules/PurgeFakeCustomer/PurgeFakeCustomer.php create mode 100644 local/modules/PurgeFakeCustomer/Readme.md create mode 100644 local/modules/PurgeFakeCustomer/composer.json diff --git a/local/media/documents/folder/80-le-consensus-dexperts-de-grenoble-version-2010-francais-17.html b/local/media/documents/folder/80-le-consensus-dexperts-de-grenoble-version-2010-francais-17.html index 88bf1b3d3..dea545cb5 100644 --- a/local/media/documents/folder/80-le-consensus-dexperts-de-grenoble-version-2010-francais-17.html +++ b/local/media/documents/folder/80-le-consensus-dexperts-de-grenoble-version-2010-francais-17.html @@ -58,21 +58,21 @@ var OWNER_CANT_VOTE = 'OWNER_CANT_VOTE'; - - - + + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + + @@ -117,107 +117,107 @@ _gaq.push(['_trackPageview']); -

fran.gif

- -

-
-

Commentaires

- -
-
-
-
- avatar - lopette -
-
+5
 
 
-
-
-
- ll -
-
- Dimanche 14 Octobre 2012, 18:30 -
-
-
Répondre
-
-
-
-
-
- -
-
- - Nom *
Courriel (pour vérification & réponses)
- URL
- Code -    -
- ChronoComments by Joomla Professional Solutions -
-
- -
-
-
Soumettre ce commentaire
-
-
-
-
-
Annuler
-
-
-
- - - - - -
-
-
-
- -
-
- - -
- -
- - Nom *
Courriel (pour vérification & réponses)
- URL
- Code -    -
- ChronoComments by Joomla Professional Solutions -
-
- -
-
-
Soumettre ce commentaire
-
-
- -
- - - - - -
-
- -
-
-
-
-
-
+

fran.gif

+ +

+
+

Commentaires

+ +
+
+
+
+ avatar + lopette +
+
+5
 
 
+
+
+
+ ll +
+
+ Dimanche 14 Octobre 2012, 18:30 +
+
+
Répondre
+
+
+
+
+
+ +
+
+ + Nom *
Courriel (pour vérification & réponses)
+ URL
+ Code +    +
+ ChronoComments by Joomla Professional Solutions +
+
+ +
+
+
Soumettre ce commentaire
+
+
+
+
+
Annuler
+
+
+
+ + + + + +
+
+
+
+ +
+
+ + +
+ +
+ + Nom *
Courriel (pour vérification & réponses)
+ URL
+ Code +    +
+ ChronoComments by Joomla Professional Solutions +
+
+ +
+
+
Soumettre ce commentaire
+
+
+ +
+ + + + + +
+
+ +
+
+
+
+
+
  diff --git a/local/modules/AdminOrderCreation/AdminOrderCreation.php b/local/modules/AdminOrderCreation/AdminOrderCreation.php new file mode 100644 index 000000000..5aa5f8dcc --- /dev/null +++ b/local/modules/AdminOrderCreation/AdminOrderCreation.php @@ -0,0 +1,68 @@ + + + + + +
+ + + + + + + + + + + + + diff --git a/local/modules/AdminOrderCreation/Config/module.xml b/local/modules/AdminOrderCreation/Config/module.xml new file mode 100644 index 000000000..92ce01bce --- /dev/null +++ b/local/modules/AdminOrderCreation/Config/module.xml @@ -0,0 +1,28 @@ + + + AdminOrderCreation\AdminOrderCreation + + Module for generate an order from the back office + + + Module pour générer des commandes depuis le back office + + + en_US + fr_FR + + 1.3.4 + + + Gilles Bourgeat + gilles.bourgeat@gmail.com + + + classic + 2.3.0 + beta + 0 + 0 + diff --git a/local/modules/AdminOrderCreation/Config/routing.xml b/local/modules/AdminOrderCreation/Config/routing.xml new file mode 100644 index 000000000..d82805c26 --- /dev/null +++ b/local/modules/AdminOrderCreation/Config/routing.xml @@ -0,0 +1,18 @@ + + + + + + AdminOrderCreation:Order:ajaxModalCreate + + + + AdminOrderCreation:Order:ajaxSearchCustomer + + + + AdminOrderCreation:Order:ajaxSearchProduct + + diff --git a/local/modules/AdminOrderCreation/Config/schema.xml b/local/modules/AdminOrderCreation/Config/schema.xml new file mode 100644 index 000000000..3b9818e79 --- /dev/null +++ b/local/modules/AdminOrderCreation/Config/schema.xml @@ -0,0 +1,30 @@ + + + + + diff --git a/local/modules/AdminOrderCreation/Controller/OrderController.php b/local/modules/AdminOrderCreation/Controller/OrderController.php new file mode 100644 index 000000000..b0e776618 --- /dev/null +++ b/local/modules/AdminOrderCreation/Controller/OrderController.php @@ -0,0 +1,803 @@ +checkAuth(AdminResources::ORDER, [], AccessManager::CREATE)) { + return $response; + } + + $order = new Order(); + + $order->setLang($this->getLang()); + + $order->setDispatcher($this->getDispatcher()); + + $form = $this->createForm('admin-order-creation.create', 'form', [], ['csrf_protection' => false]); + + $formValidate = $this->validateForm($form, 'post'); + + $this->performOrder($order, $formValidate); + + $this->getParserContext()->addForm($form); + + $errorMessage = []; + foreach ($formValidate->getErrors() as $error) { + $errorMessage[] = $error->getMessage(); + } + + if (count($errorMessage)) { + $form->setErrorMessage(implode('
', $errorMessage)); + } + + if (!$form->hasError() && 'create' === $formValidate->get('action')->getData()) { + $con = Propel::getServiceContainer()->getWriteConnection(OrderTableMap::DATABASE_NAME); + + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + + try { + $cart = new Cart(); + + $cart->save(); + + $order->setCartId($cart->getId()); + + // on passe par le statut par défault + $order->setOrderStatus( + OrderStatusQuery::create()->findOneById(1) + ); + + $order->save(); + + $this->performCreditNote($order, $formValidate); + + $orderStatusId = $formValidate->get('status_id')->getData(); + + if ((int) $orderStatusId >= 2) { + if ((int) AdminOrderCreation::getConfigValue(AdminOrderCreation::CONFIG_KEY_INVOICE_REF_TYPE) === 0) { + // pour retirer les stocks et générer la référence facture + $order->setOrderStatus( + OrderStatusQuery::create()->findOneById(2) + ); + + $this->getDispatcher()->dispatch( + TheliaEvents::ORDER_UPDATE_STATUS, + (new OrderEvent($order))->setStatus(2) + ); + + $order->save(); + } else { // dans le cas d'une facturation à par + $order->setInvoiceRef((int) AdminOrderCreation::getConfigValue(AdminOrderCreation::CONFIG_KEY_INVOICE_REF_INCREMENT)); + + AdminOrderCreation::setConfigValue( + AdminOrderCreation::CONFIG_KEY_INVOICE_REF_INCREMENT, + (int) AdminOrderCreation::getConfigValue(AdminOrderCreation::CONFIG_KEY_INVOICE_REF_INCREMENT) + 1 + ); + + $order->setOrderStatus( + OrderStatusQuery::create()->findOneById(2) + ); + $order->save(); + } + } + + if ((int) $orderStatusId > 2) { + $order->setOrderStatus( + OrderStatusQuery::create()->findOneById((int) $orderStatusId) + ); + $this->getDispatcher()->dispatch( + TheliaEvents::ORDER_UPDATE_STATUS, + (new OrderEvent($order))->setStatus((int) $orderStatusId) + ); + } + + $order->save(); + + $con->commit(); + } catch (\Exception $e) { + $con->rollBack(); + throw $e; + } + } + + if ($order->getId()) { + return $this->render('admin-order-creation/ajax/order-create-modal-success', [ + 'order' => $order + ]); + } else { + return $this->render('admin-order-creation/ajax/order-create-modal', [ + 'order' => $order, + 'hasCreditNoteModule' => $this->hasCreditNoteModule(), + 'configNewCreditNoteStatusId' => AdminOrderCreation::getConfigValue(AdminOrderCreation::CONFIG_KEY_DEFAULT_NEW_CREDIT_NOTE_STATUS_ID), + 'configNewCreditNoteTypeId' => AdminOrderCreation::getConfigValue(AdminOrderCreation::CONFIG_KEY_DEFAULT_NEW_CREDIT_NOTE_TYPE_ID), + 'configPayedOrderMinimumStatusId' => AdminOrderCreation::getConfigValue(AdminOrderCreation::CONFIG_KEY_PAYED_ORDER_MINIMUM_STATUS_ID) + ]); + } + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \Propel\Runtime\Exception\PropelException + */ + public function ajaxSearchCustomerAction(Request $request) + { + if (null !== $response = $this->checkAuth(AdminResources::ORDER, [], AccessManager::CREATE)) { + return $response; + } + + $customerQuery = CustomerQuery::create() + ->innerJoinAddress() + ->groupById() + ->limit(20); + + $this->whereConcatRegex($customerQuery, [ + 'customer.REF', + 'customer.FIRSTNAME', + 'customer.LASTNAME', + 'customer.EMAIL', + 'address.COMPANY', + 'address.PHONE' + ], $request->get('q')); + + $customerQuery + ->withColumn(AddressTableMap::COMPANY, 'COMPANY') + ->withColumn(AddressTableMap::ADDRESS1, 'ADDRESS') + ->withColumn(AddressTableMap::CITY, 'CITY') + ->withColumn(AddressTableMap::ZIPCODE, 'ZIPCODE') + ->withColumn(AddressTableMap::PHONE, 'PHONE'); + + $customers = $customerQuery->find(); + + $json = [ + 'incomplete_results' => count($customers) ? false : true, + 'items' => [] + ]; + + /** @var Customer $customer */ + foreach ($customers as $customer) { + $json['items'][] = [ + 'id' => $customer->getId(), + 'company' => $customer->getVirtualColumn('COMPANY'), + 'firstname' => $customer->getFirstname(), + 'lastname' => $customer->getLastname(), + 'ref' => $customer->getRef(), + 'address' => $this->formatAddress($customer) + ]; + } + + return new JsonResponse($json); + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \Propel\Runtime\Exception\PropelException + */ + public function ajaxSearchProductAction(Request $request) + { + if (null !== $response = $this->checkAuth(AdminResources::ORDER, [], AccessManager::CREATE)) { + return $response; + } + + $productQuery = ProductQuery::create(); + + $productQuery->useI18nQuery( + $this->getRequest()->getSession()->getAdminEditionLang()->getLocale() + ); + + $productQuery + ->withColumn(ProductI18nTableMap::TITLE, 'TITLE'); + + $this->whereConcatRegex($productQuery, array( + 'product.REF', + 'product_i18n.TITLE' + ), $request->get('q')); + + $productQuery->setLimit(10); + + $products = $productQuery->find(); + + $json = [ + 'incomplete_results' => count($products) ? false : true, + 'items' => [] + ]; + + /** @var Product $product */ + foreach ($products as $product) { + $json['items'][] = [ + 'id' => $product->getId(), + 'ref' => $product->getRef(), + 'title' => $product->getVirtualColumn('TITLE') + ]; + } + + return new JsonResponse($json); + } + + protected function hasCreditNoteModule() + { + return class_exists('\CreditNote\CreditNote'); + } + + protected function performOrder(Order $order, Form $formValidate) + { + $this + ->performCurrency($order, $formValidate) + ->performOrderStatus($order, $formValidate) + ->performCustomer($order, $formValidate) + ->performInvoiceAddress($order, $formValidate) + ->performDeliveryAddress($order, $formValidate) + ->performDeliveryAddress($order, $formValidate) + ->performProducts($order, $formValidate) + ->performShipping($order, $formValidate) + ->performGlobalReduction($order, $formValidate) + ->performPaymentModule($order, $formValidate) + ->performDeliveryModule($order, $formValidate) + ; + + return $this; + } + + protected function performPaymentModule(Order $order, Form $form) + { + $paymentModuleId = (int) $form->get('payment_module_id')->getData(); + + $order->setPaymentModuleId($paymentModuleId); + + return $this; + } + + protected function performDeliveryModule(Order $order, Form $form) + { + $deliveryModuleId = (int) $form->get('delivery_module_id')->getData(); + + $order->setDeliveryModuleId($deliveryModuleId); + + return $this; + } + + protected function performShipping(Order $order, Form $form) + { + $price = (float) $form->get('shipping_price_with_tax')->getData(); + + $priceWithTax = (float) $form->get('shipping_price_with_tax')->getData(); + + $order->setPostage($priceWithTax); + $order->setPostageTax($priceWithTax - $price); + + return $this; + } + + protected function performGlobalReduction(Order $order, Form $form) + { + $reduction = (float) $form->get('reduction')->getData(); + + $reductionType = (int) $form->get('reduction_type')->getData(); + + $total = $order->getTotalAmountWithTax(false); + + $afterDiscount = Calc::reduction( + $reduction, + $reductionType, + $total, + 1 + ); + + $order->setDiscount(-($afterDiscount - $total)); + + return $this; + } + + protected function performCurrency(Order $order, Form $form) + { + /** @var int $currencyId */ + $currencyId = $form->get('currency_id')->getData(); + + if (empty($currencyId) || null === $currency = CurrencyQuery::create()->findPk($currencyId)) { + $currency = CurrencyQuery::create()->findOneByByDefault(true); + } + + $order->setCurrency($currency); + $order->setCurrencyRate($currency->getRate()); + + return $this; + } + + protected function getCountry(Form $form) + { + /** @var int $countryId */ + $countryId = $form->get('country_id')->getData(); + + if (!empty($countryId) && $country = CountryQuery::create()->findPk($countryId)) { + return $country; + } + + return CountryQuery::create()->filterByByDefault(true)->findOne(); + } + + protected function performOrderStatus(Order $order, Form $form) + { + if (null !== $statusId = $form->get('status_id')->getData()) { + $order->setOrderStatus( + OrderStatusQuery::create()->findOneById((int) $statusId) + ); + } else { + $order->setOrderStatus( + OrderStatusQuery::create()->findOneById(1) + ); + } + + return $this; + } + + protected function performCustomer(Order $order, Form $form) + { + if (null !== $customerId = $form->get('customer_id')->getData()) { + $order->setCustomer( + CustomerQuery::create()->findOneById((int) $customerId) + ); + } + + if (null === $customerId && 'create' === $form->get('action')->getData()) { + $form->addError( + new FormError('Please select a customer') + ); + } + + return $this; + } + + protected function performCreditNote(Order $order, Form $form) + { + if (!$this->hasCreditNoteModule()) { + return $this; + } + + $action = $form->get('action')->getData(); + + $creditNoteId = $form->get('credit_note_id')->getData(); + + $creditNoteStatusId = $form->get('credit_note_status_id')->getData(); + + $creditNoteTypeId = $form->get('credit_note_type_id')->getData(); + + if ($creditNoteId && $action === 'create') { + /** @var CreditNote $creditNote */ + $creditNote = CreditNoteQuery::create() + ->filterById($creditNoteId) + ->useCreditNoteStatusQuery() + ->filterByUsed(false) + ->filterByInvoiced(true) + ->endUse() + ->findOne(); + + if (null === $creditNote) { + $form->addError( + new FormError('Please select a valid credit note') + ); + } + + $orderCreditNote = (new OrderCreditNote()) + ->setOrderId($order->getId()) + ->setCreditNoteId($creditNote->getId()); + + if (round($order->getTotalAmountWithTax() - $creditNote->getTotalPriceWithTax(), 2) > 0) { // cas crédit note plus petit + $orderCreditNote->setAmountPrice($creditNote->getTotalPriceWithTax()); + } elseif (round($order->getTotalAmountWithTax() - $creditNote->getTotalPriceWithTax(), 2) < 0) { // cas crédit note plus grand + $orderCreditNote->setAmountPrice($order->getTotalAmountWithTax()); + + // copy address + $lastInvoiceAddress = $creditNote->getCreditNoteAddress(); + $invoiceAddress = (new CreditNoteAddress()) + ->setFirstname($lastInvoiceAddress->getFirstname()) + ->setLastname($lastInvoiceAddress->getLastname()) + ->setCity($lastInvoiceAddress->getCity()) + ->setZipcode($lastInvoiceAddress->getZipcode()) + ->setAddress1($lastInvoiceAddress->getAddress1()) + ->setAddress2($lastInvoiceAddress->getAddress2()) + ->setAddress3($lastInvoiceAddress->getAddress3()) + ->setCustomerTitleId($lastInvoiceAddress->getCustomerTitleId()) + ->setCountryId($lastInvoiceAddress->getCountryId()); + + $invoiceAddress->save(); + + $crediNoteDetail = (new CreditNoteDetail()) + ->setTitle('Remboursement différence') + ->setTaxRuleId(null) + ->setPriceWithTax(-($order->getTotalAmountWithTax() - $creditNote->getTotalPriceWithTax())) + ->setPrice(-($order->getTotalAmountWithTax() - $creditNote->getTotalPriceWithTax())) + ->setType('other'); + + $newCreditNote = (new CreditNote()) + ->setCurrency($creditNote->getCurrency()) + ->setTypeId($creditNoteTypeId) + ->setStatusId($creditNoteStatusId) + ->setCreditNoteAddress($invoiceAddress) + ->addCreditNoteDetail($crediNoteDetail) + ->setTotalPrice(-($order->getTotalAmountWithTax() - $creditNote->getTotalPriceWithTax())) + ->setTotalPriceWithTax(-($order->getTotalAmountWithTax() - $creditNote->getTotalPriceWithTax())) + ->setCustomerId($creditNote->getCustomer()->getId()) + ->setParentId($creditNote->getId()) + ->setOrderId($order->getId()); + + $newCreditNote->setDispatcher($this->getDispatcher()); + + $newCreditNote->save(); + } else { // cas crédit note égale + $orderCreditNote->setAmountPrice($creditNote->getTotalPriceWithTax()); + } + + $orderCreditNote->save(); + + $newStatus = CreditNoteStatusQuery::findNextCreditNoteUsedStatus($creditNote->getCreditNoteStatus()); + + $creditNote->setCreditNoteStatus($newStatus); + $creditNote->save(); + } + } + + protected function performInvoiceAddress(Order $order, Form $form) + { + $action = $form->get('action')->getData(); + + $invoiceAddressId = $form->get('invoice_address_id')->getData(); + + if ($invoiceAddressId) { + $address = AddressQuery::create()->findOneById((int) $invoiceAddressId); + + $orderAddress = (new OrderAddress()) + ->setCustomerTitle($address->getCustomerTitle()) + ->setAddress1($address->getAddress1()) + ->setAddress2($address->getAddress2()) + ->setAddress3($address->getAddress3()) + ->setFirstname($address->getFirstname()) + ->setLastname($address->getLastname()) + ->setCity($address->getCity()) + ->setZipcode($address->getZipcode()) + ->setCompany($address->getCompany()) + ->setCountry($address->getCountry()); + } else { + $invoiceAddressTitle = $form->get('invoice_address_title')->getData(); + $invoiceAddressFirstname = $form->get('invoice_address_firstname')->getData(); + $invoiceAddressLastname = $form->get('invoice_address_lastname')->getData(); + $invoiceAddressCompany = $form->get('invoice_address_company')->getData(); + $invoiceAddressAddress1 = $form->get('invoice_address_address1')->getData(); + $invoiceAddressAddress2 = $form->get('invoice_address_address2')->getData(); + $invoiceAddressZipcode = $form->get('invoice_address_zipcode')->getData(); + $invoiceAddressCity = $form->get('invoice_address_city')->getData(); + $invoiceAddressCountryId = $form->get('invoice_address_country_id')->getData(); + + $orderAddress = (new OrderAddress()) + ->setCustomerTitleId($invoiceAddressTitle) + ->setAddress1($invoiceAddressAddress1) + ->setAddress2($invoiceAddressAddress2) + ->setFirstname($invoiceAddressFirstname) + ->setLastname($invoiceAddressLastname) + ->setCity($invoiceAddressCity) + ->setZipcode($invoiceAddressZipcode) + ->setCompany($invoiceAddressCompany) + ->setCountry( + CountryQuery::create()->findOneById($invoiceAddressCountryId) + ); + } + + if (empty($orderAddress->getLastname()) && 'create' === $form->get('action')->getData()) { + $form->addError( + new FormError('Please select a invoice address') + ); + } + + if ($action === 'create') { + $orderAddress->save(); + + $order->setInvoiceOrderAddressId($orderAddress->getId()); + } + + return $this; + } + + protected function performDeliveryAddress(Order $order, Form $form) + { + $action = $form->get('action')->getData(); + + $deliveryAddressId = $form->get('delivery_address_id')->getData(); + + if ($deliveryAddressId) { + $address = AddressQuery::create()->findOneById((int) $deliveryAddressId); + + $orderAddress = (new OrderAddress()) + ->setCustomerTitle($address->getCustomerTitle()) + ->setAddress1($address->getAddress1()) + ->setAddress2($address->getAddress2()) + ->setAddress3($address->getAddress3()) + ->setFirstname($address->getFirstname()) + ->setLastname($address->getLastname()) + ->setCity($address->getCity()) + ->setZipcode($address->getZipcode()) + ->setCompany($address->getCompany()) + ->setCountry($address->getCountry()); + } else { + $deliveryAddressTitle = $form->get('delivery_address_title')->getData(); + $deliveryAddressFirstname = $form->get('delivery_address_firstname')->getData(); + $deliveryAddressLastname = $form->get('delivery_address_lastname')->getData(); + $deliveryAddressCompany = $form->get('delivery_address_company')->getData(); + $deliveryAddressAddress1 = $form->get('delivery_address_address1')->getData(); + $deliveryAddressAddress2 = $form->get('delivery_address_address2')->getData(); + $deliveryAddressZipcode = $form->get('delivery_address_zipcode')->getData(); + $deliveryAddressCity = $form->get('delivery_address_city')->getData(); + $deliveryAddressCountryId = $form->get('delivery_address_country_id')->getData(); + + $orderAddress = (new OrderAddress()) + ->setCustomerTitleId($deliveryAddressTitle) + ->setAddress1($deliveryAddressAddress1) + ->setAddress2($deliveryAddressAddress2) + ->setFirstname($deliveryAddressFirstname) + ->setLastname($deliveryAddressLastname) + ->setCity($deliveryAddressCity) + ->setZipcode($deliveryAddressZipcode) + ->setCompany($deliveryAddressCompany) + ->setCountry( + CountryQuery::create()->findOneById($deliveryAddressCountryId) + ); + } + + if (empty($orderAddress->getLastname()) && 'create' === $form->get('action')->getData()) { + $form->addError( + new FormError('Please select a delivery address') + ); + } + + if ($action === 'create') { + $orderAddress->save(); + + $order->setDeliveryOrderAddressId($orderAddress->getId()); + } + + return $this; + } + + protected function getLang() + { + return $this->getSession()->getAdminEditionLang(); + } + + protected function performProducts(Order $order, Form $form) + { + $country = $this->getCountry($form); + + $productIds = $form->get('product_id')->getData(); + $quantities = $form->get('product_quantity')->getData(); + $productSaleElementIds = $form->get('product_sale_element_id')->getData(); + $productPriceWithoutTax = $form->get('product_price_without_tax')->getData(); + $refreshPrice = $form->get('refresh_price')->getData(); + + $currency = $this->getCurrency($form); + + foreach ($productIds as $key => $id) { + if (!isset($quantities[$key])) { + $quantities[$key] = 1; + } + + $product = ProductQuery::create()->findOneById($id); + + /** @var ProductI18n $productI18n */ + $productI18n = I18n::forceI18nRetrieving( + $order->getLang()->getLocale(), + 'Product', + $product->getId() + ); + + $productSaleElementsLoop = new ProductSaleElements($this->container); + + if (isset($productSaleElementIds[$key])) { + if (null !== ProductSaleElementsQuery::create() + ->filterByProductId($product->getId()) + ->filterById($productSaleElementIds[$key]) + ->findOne()) { + $productSaleElementsLoop->initializeArgs([ + 'name' => 'product_sale_elements', + 'type' => 'product_sale_elements', + 'id' => $productSaleElementIds[$key], + 'currency' => $currency->getId() + ]); + } else { + $productSaleElementsLoop->initializeArgs([ + 'name' => 'product_sale_elements', + 'type' => 'product_sale_elements', + 'product' => $product->getId(), + 'currency' => $currency->getId() + ]); + } + } else { + $productSaleElementsLoop->initializeArgs([ + 'name' => 'product_sale_elements', + 'type' => 'product_sale_elements', + 'product' => $product->getId(), + 'currency' => $currency->getId() + ]); + } + + $pagination = null; + $results = $productSaleElementsLoop->exec($pagination); + + /** @var \Thelia\Model\ProductSaleElements $productSaleElement */ + $productSaleElement = $results->getResultDataCollection()[0]; + + /** @var TaxRuleI18n $taxRuleI18n */ + $taxRuleI18n = I18n::forceI18nRetrieving( + $order->getLang()->getLocale(), + 'TaxRule', + $product->getTaxRuleId() + ); + + if (isset($refreshPrice[$key]) && (int) $refreshPrice[$key]) { + $price = $productSaleElement->getVirtualColumn('price_PRICE'); + $promoPrice = $productSaleElement->getVirtualColumn('price_PROMO_PRICE'); + } else { + $price = isset($productPriceWithoutTax[$key]) ? (float) $productPriceWithoutTax[$key] : $productSaleElement->getVirtualColumn('price_PRICE'); + $promoPrice = isset($productPriceWithoutTax[$key]) ? (float) $productPriceWithoutTax[$key] : $productSaleElement->getVirtualColumn('price_PROMO_PRICE'); + } + + $taxDetail = $product->getTaxRule()->getTaxDetail( + $product, + $country, + $price, + $promoPrice, + $order->getLang()->getLocale() + ); + + $orderProduct = (new OrderProduct()) + ->setProductRef($product->getRef()) + ->setProductSaleElementsRef($productSaleElement->getRef()) + ->setProductSaleElementsId($productSaleElement->getId()) + ->setTitle($productI18n->getTitle()) + ->setChapo($productI18n->getChapo()) + ->setDescription($productI18n->getDescription()) + ->setPostscriptum($productI18n->getPostscriptum()) + ->setVirtual($product->getVirtual()) + ->setQuantity($quantities[$key]) + ->setWasNew($productSaleElement->getNewness()) + ->setWeight($productSaleElement->getWeight()) + ->setTaxRuleTitle($taxRuleI18n->getTitle()) + ->setTaxRuleDescription($taxRuleI18n->getDescription()) + ->setEanCode($productSaleElement->getEanCode()) + ->setDispatcher($this->getDispatcher()) + ->setPrice($price) + ->setPromoPrice($promoPrice) + ->setWasInPromo($productSaleElement->getPromo()) + ; + + /** @var OrderProductTax $tax */ + foreach ($taxDetail as $tax) { + $orderProduct->addOrderProductTax($tax); + } + + foreach ($productSaleElement->getAttributeCombinations() as $attributeCombination) { + /** @var \Thelia\Model\Attribute $attribute */ + $attribute = I18n::forceI18nRetrieving( + $this->getSession()->getLang()->getLocale(), + 'Attribute', + $attributeCombination->getAttributeId() + ); + + /** @var \Thelia\Model\AttributeAv $attributeAv */ + $attributeAv = I18n::forceI18nRetrieving( + $this->getSession()->getLang()->getLocale(), + 'AttributeAv', + $attributeCombination->getAttributeAvId() + ); + + $orderProduct->addOrderProductAttributeCombination( + (new OrderProductAttributeCombination()) + ->setOrderProductId($orderProduct->getId()) + ->setAttributeTitle($attribute->getTitle()) + ->setAttributeChapo($attribute->getChapo()) + ->setAttributeDescription($attribute->getDescription()) + ->setAttributePostscriptum($attribute->getPostscriptum()) + ->setAttributeAvTitle($attributeAv->getTitle()) + ->setAttributeAvChapo($attributeAv->getChapo()) + ->setAttributeAvDescription($attributeAv->getDescription()) + ->setAttributeAvPostscriptum($attributeAv->getPostscriptum()) + ); + } + + $order->addOrderProduct($orderProduct); + } + + + if (!count($order->getOrderProducts()) && 'create' === $form->get('action')->getData()) { + $form->addError( + new FormError('Please select a product') + ); + } + + return $this; + } + + protected function getCurrency(Form $form) + { + $currencyId = $form->get('currency_id')->getData(); + if (null !== $currencyId) { + $currency = CurrencyQuery::create()->findPk($currencyId); + if (null === $currency) { + throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop'); + } + } else { + $currency = $this->getRequest()->getSession()->getCurrency(); + } + + return $currency; + } + + /** + * @param ActiveRecordInterface $model + * @return string + * @throws \Propel\Runtime\Exception\PropelException + */ + protected function formatAddress(ActiveRecordInterface $model) + { + /** @var Order|Customer $model */ + return implode(' ', [$model->getVirtualColumn('ADDRESS'), $model->getVirtualColumn('ZIPCODE'), $model->getVirtualColumn('CITY')]); + } +} diff --git a/local/modules/AdminOrderCreation/Form/OrderCreateForm.php b/local/modules/AdminOrderCreation/Form/OrderCreateForm.php new file mode 100644 index 000000000..17a2f3eb9 --- /dev/null +++ b/local/modules/AdminOrderCreation/Form/OrderCreateForm.php @@ -0,0 +1,213 @@ + + */ +class OrderCreateForm extends BaseForm +{ + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return 'admin-order-creation-create'; + } + + /** + * + * in this function you add all the fields you need for your Form. + * Form this you have to call add method on $this->formBuilder attribute : + * + */ + protected function buildForm() + { + $this->formBuilder + ->add('currency_id', IntegerType::class, array( + 'required' => false + )) + ->add('country_id', IntegerType::class, array( + 'required' => false + )); + + $this->formBuilder + ->add('action', ChoiceType::class, array( + 'required' => true, + 'choices' => array( + 'open' => 'open', + 'refresh' => 'refresh', + 'create' => 'create', + ), + )) + ->add('status_id', IntegerType::class, array( + 'required' => false + )) + ->add('customer_id', IntegerType::class, array( + 'required' => false + )) + ->add('invoice_address_id', IntegerType::class, array( + 'required' => false + )) + ->add('delivery_address_id', IntegerType::class, array( + 'required' => false + )) + ; + + $this->formBuilder + ->add('invoice_address_id', IntegerType::class, array( + 'required' => false + )) + ->add('invoice_address_title', TextType::class, array( + 'required' => false + )) + ->add('invoice_address_firstname', TextType::class, array( + 'required' => false + )) + ->add('invoice_address_lastname', TextType::class, array( + 'required' => false + )) + ->add('invoice_address_company', TextType::class, array( + 'required' => false + )) + ->add('invoice_address_address1', TextType::class, array( + 'required' => false + )) + ->add('invoice_address_address2', TextType::class, array( + 'required' => false + )) + ->add('invoice_address_zipcode', TextType::class, array( + 'required' => false + )) + ->add('invoice_address_city', TextType::class, array( + 'required' => false + )) + ->add('invoice_address_country_id', IntegerType::class, array( + 'required' => false + )) + ; + + $this->formBuilder + ->add('delivery_address_id', IntegerType::class, array( + 'required' => false + )) + ->add('delivery_address_title', TextType::class, array( + 'required' => false + )) + ->add('delivery_address_firstname', TextType::class, array( + 'required' => false + )) + ->add('delivery_address_lastname', TextType::class, array( + 'required' => false + )) + ->add('delivery_address_company', TextType::class, array( + 'required' => false + )) + ->add('delivery_address_address1', TextType::class, array( + 'required' => false + )) + ->add('delivery_address_address2', TextType::class, array( + 'required' => false + )) + ->add('delivery_address_zipcode', TextType::class, array( + 'required' => false + )) + ->add('delivery_address_city', TextType::class, array( + 'required' => false + )) + ->add('delivery_address_country_id', IntegerType::class, array( + 'required' => false + )) + ; + + $this->formBuilder + ->add('product_id', 'collection', array( + 'required' => false, + 'allow_add' => true, + 'allow_delete' => true + )) + ->add('product_sale_element_id', 'collection', array( + 'required' => false, + 'allow_add' => true, + 'allow_delete' => true + )) + ->add('product_quantity', 'collection', array( + 'required' => false, + 'allow_add' => true, + 'allow_delete' => true + )) + ->add('product_price_with_tax', 'collection', array( + 'required' => false, + 'allow_add' => true, + 'allow_delete' => true + )) + ->add('product_price_without_tax', 'collection', array( + 'required' => false, + 'allow_add' => true, + 'allow_delete' => true + )) + ->add('refresh_price', 'collection', array( + 'required' => false, + 'allow_add' => true, + 'allow_delete' => true + )) + ; + + $this->formBuilder + ->add('reduction', TextType::class, array( + 'required' => false, + 'empty_data' => 0 + )) + ->add('reduction_type', NumberType::class, array( + 'required' => false + )); + + $this->formBuilder + ->add('shipping_price', TextType::class, array( + 'required' => false, + 'empty_data' => 0 + )) + ->add('shipping_tax_rule_id', IntegerType::class, array( + 'required' => false + )) + ->add('shipping_price_with_tax', TextType::class, array( + 'required' => false, + 'empty_data' => 0 + )); + + $this->formBuilder + ->add('payment_module_id', IntegerType::class, array( + 'required' => false + )) + ->add('delivery_module_id', IntegerType::class, array( + 'required' => false + )) + ; + + $this->formBuilder + ->add('credit_note_id', IntegerType::class, array( + 'required' => false + )) + ->add('credit_note_type_id', IntegerType::class, array( + 'required' => false + )) + ->add('credit_note_status_id', IntegerType::class, array( + 'required' => false + )) + ; + } +} diff --git a/local/modules/AdminOrderCreation/Hook/Back/OrderEditHook.php b/local/modules/AdminOrderCreation/Hook/Back/OrderEditHook.php new file mode 100644 index 000000000..3a944b122 --- /dev/null +++ b/local/modules/AdminOrderCreation/Hook/Back/OrderEditHook.php @@ -0,0 +1,22 @@ +add($this->render( + 'admin-order-creation/hook/orders.edit.js.html', + $event->getArguments() + )); + } +} diff --git a/local/modules/AdminOrderCreation/Hook/Back/OrderHook.php b/local/modules/AdminOrderCreation/Hook/Back/OrderHook.php new file mode 100644 index 000000000..f0df2cc10 --- /dev/null +++ b/local/modules/AdminOrderCreation/Hook/Back/OrderHook.php @@ -0,0 +1,35 @@ +add($this->render( + 'admin-order-creation/hook/orders.table-header.html', + $event->getArguments() + )); + } + + public function onOrderJs(HookRenderEvent $event) + { + $event->add($this->render( + 'admin-order-creation/hook/orders.js.html', + array_merge($event->getArguments() + [ + + ]) + )); + } +} diff --git a/local/modules/AdminOrderCreation/I18n/backOffice/default/fr_FR.php b/local/modules/AdminOrderCreation/I18n/backOffice/default/fr_FR.php new file mode 100644 index 000000000..d6036ef50 --- /dev/null +++ b/local/modules/AdminOrderCreation/I18n/backOffice/default/fr_FR.php @@ -0,0 +1,61 @@ + 'Un nouvel avoir d\'un montant de %amount TTC sera créer pour le client.', + 'Add product' => 'Ajouter un produit', + 'Address :' => 'Adresse :', + 'Address complement :' => 'Complément d\'adresse :', + 'An error has occurred !!!' => 'Une erreur est survenue', + 'Cancel' => 'Annuler', + 'City :' => 'Ville :', + 'Close' => 'Fermer', + 'Company :' => 'Société :', + 'Country :' => 'Pays :', + 'Create' => 'Créer', + 'Create new order' => 'Créer une nouvelle commande', + 'Create order' => 'Créer une commande', + 'Credit note :' => 'Avoir :', + 'Customer :' => 'Client :', + 'Default product sale element' => 'Déclinaison par défaut', + 'Delete' => 'Supprimer', + 'Delivery address' => 'Adresse de livraison', + 'Delivery module :' => 'Module de livraison :', + 'Firstname :' => 'Prénom :', + 'Global amount' => 'Montant global', + 'Global reduction' => 'Réduction global', + 'Invoice address' => 'Adresse de facturation', + 'Lastname :' => 'Nom :', + 'Message content :' => 'Message :', + 'Message status :' => 'Statut :', + 'Order Informations :' => 'Informations de la commande', + 'Other' => 'Autre', + 'Payment module :' => 'Module de paiement :', + 'Percentage' => 'Pourcentage', + 'Please wait, loading' => 'Veillez patienter, chargement ...', + 'Price' => 'Prix', + 'Price with tax :' => 'Prix TTC :', + 'Price without tax :' => 'Prix HT :', + 'Product' => 'Produit', + 'Product sale element' => 'Déclinaison', + 'Products' => 'Produits', + 'Quantity' => 'Quantité', + 'Search...' => 'Rechercher ...', + 'Shipping' => 'Frais de livraison', + 'Status :' => 'Statut :', + 'Status of new credit note :' => 'Statut du nouvel avoir :', + 'Total tax :' => 'Total taxe :', + 'Tax rule :' => 'Règle de taxe :', + 'This command uses the credit note ref %ref for the amount of %amount with tax.' => 'Cette commande utilise l\'avoir %ref avec un montant de %amount TTC.', + 'This order use the country : %country' => 'Cette commande utilise le pays : %country', + 'This order use the currency : %currency' => 'Cette commande utilise le devise : %currency', + 'Title :' => 'Titre :', + 'Total with tax :' => 'Total TTC :', + 'Total without tax :' => 'Total HT :', + 'Type :' => 'Type :', + 'Type of new credit note :' => 'Type du nouvel avoir :', + 'Unit price with tax' => 'Prix unitaire TTC', + 'Use Credit Note :' => 'Utiliser un avoir :', + 'Value :' => 'Value :', + 'Your customer will have to pay the difference of %amount with tax' => 'Votre client devra payer la différence d\'un montant de %amount TTC', + 'Zipcode :' => 'Code postal :', +); diff --git a/local/modules/AdminOrderCreation/I18n/en_US.php b/local/modules/AdminOrderCreation/I18n/en_US.php new file mode 100644 index 000000000..0b4fa142b --- /dev/null +++ b/local/modules/AdminOrderCreation/I18n/en_US.php @@ -0,0 +1,4 @@ + 'The displayed english string', +); diff --git a/local/modules/AdminOrderCreation/I18n/fr_FR.php b/local/modules/AdminOrderCreation/I18n/fr_FR.php new file mode 100644 index 000000000..370862450 --- /dev/null +++ b/local/modules/AdminOrderCreation/I18n/fr_FR.php @@ -0,0 +1,4 @@ + 'La traduction française de la chaine', +); diff --git a/local/modules/AdminOrderCreation/LICENSE b/local/modules/AdminOrderCreation/LICENSE new file mode 100644 index 000000000..16e6d881e --- /dev/null +++ b/local/modules/AdminOrderCreation/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 thelia-modules + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/local/modules/AdminOrderCreation/Model/Order.php b/local/modules/AdminOrderCreation/Model/Order.php new file mode 100644 index 000000000..fa22a4150 --- /dev/null +++ b/local/modules/AdminOrderCreation/Model/Order.php @@ -0,0 +1,63 @@ +getOrderProducts() as $orderProduct) { + if ($orderProduct->getWasInPromo()) { + $total += $orderProduct->getPromoPrice() * $orderProduct->getQuantity(); + } else { + $total += $orderProduct->getPrice() * $orderProduct->getQuantity(); + } + + foreach ($orderProduct->getOrderProductTaxes() as $orderProductTax) { + if ($orderProduct->getWasInPromo()) { + $total += $orderProductTax->getPromoAmount() * $orderProduct->getQuantity(); + } else { + $total += $orderProductTax->getAmount() * $orderProduct->getQuantity(); + } + } + } + + $total += $this->getPostage(); + + + if ($withDiscount) { + $total -= $this->getDiscount(); + } + + return $total; + } + + public function getTotalAmountWithoutTax($withDiscount = true) + { + $total = 0; + + foreach ($this->getOrderProducts() as $orderProduct) { + if ($orderProduct->getWasInPromo()) { + $total += $orderProduct->getPromoPrice() * $orderProduct->getQuantity(); + } else { + $total += $orderProduct->getPrice() * $orderProduct->getQuantity(); + } + } + + $total += $this->getPostage() - $this->getPostageTax(); + + if ($withDiscount) { + $total -= $this->getDiscount(); + } + + return $total; + } +} \ No newline at end of file diff --git a/local/modules/AdminOrderCreation/Readme.md b/local/modules/AdminOrderCreation/Readme.md new file mode 100644 index 000000000..a4c9a24c4 --- /dev/null +++ b/local/modules/AdminOrderCreation/Readme.md @@ -0,0 +1,24 @@ +# Admin Order Creation + +Author: Gilles Bourgeat + +A module to create orders from the Thelia back-office. + +## Compatibility + +Thelia >= 2.3 + +## Installation + +### Manually + +* Copy the module into ```/local/modules/``` directory and be sure that the name of the module is ```AdminOrderCreation```. +* Activate it in your thelia administration panel + +### Composer + +Add it in your main thelia composer.json file + +``` +composer require thelia/admin-order-creation ~1.3.3 +``` diff --git a/local/modules/AdminOrderCreation/Util/Calc.php b/local/modules/AdminOrderCreation/Util/Calc.php new file mode 100644 index 000000000..d326c5a77 --- /dev/null +++ b/local/modules/AdminOrderCreation/Util/Calc.php @@ -0,0 +1,39 @@ + 100) { + throw new \Exception('Invalid arg reduction'); + } + + return (($price / 100) * (100 - $value)); + } elseif ($type === 2) { + if ($value < 0 || $value > $price * $quantity) { + throw new \Exception('Invalid arg reduction'); + } + + return ($price * $quantity - $value) / $quantity; + } elseif ($type === 3) { + if ($value < 0 || $value > $price) { + throw new \Exception('Invalid arg reduction'); + } + + return ($price - $value); + } + } +} diff --git a/local/modules/AdminOrderCreation/Util/CriteriaSearchTrait.php b/local/modules/AdminOrderCreation/Util/CriteriaSearchTrait.php new file mode 100644 index 000000000..a67e719c3 --- /dev/null +++ b/local/modules/AdminOrderCreation/Util/CriteriaSearchTrait.php @@ -0,0 +1,54 @@ + 2 && preg_match('/^[a-z0-9]+$/i', $v)) { + $words[] = $v; + } + } + + if (!count($words)) { + return null; + } + + $regex = array(); + $regex[] = '.*' . implode('.+', $words) . '.*'; + if (count($words) > 1) { + $regex[] = '.*' . implode('.+', array_reverse($words)) . '.*'; + } + + return implode('|', $regex); + } + + /** + * @param ModelCriteria $query + * @param array $columns + * @param string $q + */ + public function whereConcatRegex(ModelCriteria $query, array $columns, $q) + { + $query->where("CONCAT_WS(' ', " . implode(',', $columns). ") REGEXP ?", self::getRegex($q), \PDO::PARAM_STR); + } +} diff --git a/local/modules/AdminOrderCreation/composer.json b/local/modules/AdminOrderCreation/composer.json new file mode 100644 index 000000000..56b7a4c7c --- /dev/null +++ b/local/modules/AdminOrderCreation/composer.json @@ -0,0 +1,13 @@ +{ + "name": "thelia/admin-order-creation", + "description": "A module to create orders from the Thelia back-office.", + "license": "MIT", + "type": "thelia-module", + "require": { + "thelia/installer": "~1.1", + "thelia/credit-note-module": "~2.3.0" + }, + "extra": { + "installer-name": "AdminOrderCreation" + } +} diff --git a/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/ajax/order-create-modal-success.html b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/ajax/order-create-modal-success.html new file mode 100644 index 000000000..c3d41eea1 --- /dev/null +++ b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/ajax/order-create-modal-success.html @@ -0,0 +1,5 @@ +{check_auth role="ADMIN" resource="order" access="create"} + + \ No newline at end of file diff --git a/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/ajax/order-create-modal.html b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/ajax/order-create-modal.html new file mode 100644 index 000000000..958916f40 --- /dev/null +++ b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/ajax/order-create-modal.html @@ -0,0 +1,592 @@ +{form name="admin-order-creation.create"} + + + {form_field field='action'} + + {/form_field} + + {if $form_error}
{$form_error_message nofilter}
{/if} + +
+
+
+ {$currency_id = 0} + {form_field field='currency_id'} + {capture name="currency"} + + {/capture} + {intl l="This order use the currency : %currency" d="adminordercreation.bo.default" currency=$smarty.capture.currency} + {/form_field} +
+
+ +
+
+ {$country_id = 0} + {form_field field='country_id'} + {capture name="country"} + + {/capture} + {intl l="This order use the country : %country" d="adminordercreation.bo.default" country=$smarty.capture.country} + {/form_field} +
+
+ + {* status select *} +
+
+ + {$ignoreStatus = false} + {form_field field='credit_note_id'} + {if $data} + {$ignoreStatus = true} + {/if} + {/form_field} + + {form_field field='status_id'} + + {/form_field} +
+
+ + {* customer select *} +
+
+ + {form_field field='customer_id'} + + {/form_field} +
+
+ + {* delivery module *} +
+
+ + {form_field field='delivery_module_id'} + + {/form_field} +
+
+ + {* payment module *} +
+
+ + {form_field field='payment_module_id'} + + {/form_field} +
+
+ + {* address invoice *} +
+
+
{intl l="Invoice address" d="adminordercreation.bo.default"}
+
+ + {$other = false} +
+ {form_field field='invoice_address_id'} + {if !$data} + {$other = true} + {/if} + + {/form_field} +
+ +
+ {form_field field='invoice_address_title'} +
+ + +
+ {/form_field} + {form_field field='invoice_address_firstname'} +
+ + +
+ {/form_field} + {form_field field='invoice_address_lastname'} +
+ + +
+ {/form_field} + {form_field field='invoice_address_address1'} +
+ + +
+ {/form_field} + {form_field field='invoice_address_address2'} +
+ + +
+ {/form_field} + {form_field field='invoice_address_city'} +
+ + +
+ {/form_field} + {form_field field='invoice_address_zipcode'} +
+ + +
+ {/form_field} + {form_field field='invoice_address_country_id'} +
+ + +
+ {/form_field} + {form_field field='invoice_address_company'} +
+ + +
+ {/form_field} +
+ +
+
+
+ + {* delivery invoice *} +
+
+
{intl l="Delivery address" d="adminordercreation.bo.default"}
+
+ + {$other = false} +
+ {form_field field='delivery_address_id'} + {if !$data} + {$other = true} + {/if} + + {/form_field} +
+ +
+ {form_field field='delivery_address_title'} +
+ + +
+ {/form_field} + {form_field field='delivery_address_firstname'} +
+ + +
+ {/form_field} + {form_field field='delivery_address_lastname'} +
+ + +
+ {/form_field} + {form_field field='delivery_address_address1'} +
+ + +
+ {/form_field} + {form_field field='delivery_address_address2'} +
+ + +
+ {/form_field} + {form_field field='delivery_address_city'} +
+ + +
+ {/form_field} + {form_field field='delivery_address_zipcode'} +
+ + +
+ {/form_field} + {form_field field='delivery_address_country_id'} +
+ + +
+ {/form_field} + {form_field field='delivery_address_company'} +
+ + +
+ {/form_field} +
+
+
+
+ + {* Product *} +
+
+
{intl l="Products" d="adminordercreation.bo.default"}
+
+ {$count = 0} + {form_field field='product_id'} + {foreach from=$data item=item key=key} + {if $key > $count} + {$count = $key} + {/if} + {/foreach} + {/form_field} + + + + + + + + + + + + + {form_field field='product_id'} + {foreach from=$order->getOrderProducts() item=orderProduct key=key} + {include file="admin-order-creation/include/product-line.html" orderProduct=$orderProduct} + {/foreach} + {/form_field} + +
+ {intl l="Product" d="adminordercreation.bo.default"} / {intl l="Product sale element" d="adminordercreation.bo.default"} + + {intl l="Unit price with tax" d="adminordercreation.bo.default"} + + {intl l="Quantity" d="adminordercreation.bo.default"} + + {intl l="Price" d="adminordercreation.bo.default"} + + +
+ +
+
+
+ + {* Shipping *} +
+
+
{intl l="Shipping" d="adminordercreation.bo.default"}
+
+
+
+ {form_field field='shipping_price'} +
+ + +
+ {/form_field} +
+ +
+ {form_field field='shipping_tax_rule_id'} +
+ + +
+ {/form_field} +
+ +
+ {form_field field='shipping_price_with_tax'} +
+ + +
+ {/form_field} +
+
+
+
+
+ + {* Global reduction *} +
+
+
{intl l="Global reduction" d="adminordercreation.bo.default"}
+
+
+
+
+ {form_field field='reduction_type'} +
+ + +
+ {/form_field} +
+
+
+ {form_field field='reduction'} +
+ + +
+ {/form_field} +
+
+
+
+
+ + {if $hasCreditNoteModule} +
+
+
{intl l="Use Credit Note :" d="adminordercreation.bo.default"}
+
+
+ {* customer select *} +
+
+ + {$credit_note_id = null} + {form_field field='credit_note_id'} + + {/form_field} +
+
+
+ {if $credit_note_id} + {loop type="credit-note" name="credit-note" backend_context=true id=$credit_note_id} +
+ {intl l="This command uses the credit note ref %ref for the amount of %amount with tax." d="adminordercreation.bo.default" + ref=$REF + amount={format_money number=$TOTAL_PRICE_WITH_TAX currency_id=$CURRENCY_ID} + } +
+ {$diffAmount = ($order->getTotalAmountWithTax() - $TOTAL_PRICE_WITH_TAX)|round:2} + {if $diffAmount == 0} + + {elseif $diffAmount > 0} +
+ {intl l="Your customer will have to pay the difference of %amount with tax" d="adminordercreation.bo.default" + amount={format_money number={$order->getTotalAmountWithTax() - $TOTAL_PRICE_WITH_TAX} currency_id=$CURRENCY_ID} + } +
+ {else} +
+ {intl l="A new credit note of %amount with tax will be issued for this customer." d="adminordercreation.bo.default" + amount={format_money number=-{$order->getTotalAmountWithTax() - $TOTAL_PRICE_WITH_TAX} currency_id=$CURRENCY_ID} + } +
+
+
+
+ + {form_field field='credit_note_status_id'} + {if !$data} + {$data = $configNewCreditNoteStatusId} + {/if} + + {/form_field} +
+
+
+
+ + {form_field field='credit_note_type_id'} + {if !$data} + {$data = $configNewCreditNoteTypeId} + {/if} + + {/form_field} +
+
+
+ {/if} + {/loop} + {/if} +
+
+ +
+
+
+ {/if} + +
+
+
{intl l="Order Informations :" d="adminordercreation.bo.default"}
+
+
+
+

+ {intl l="Total without tax :" d="adminordercreation.bo.default"} + {format_money number=$order->getTotalAmountWithoutTax() currency_id=$order->getCurrency()->getId()} HT + +

+
+
+

+ {intl l="Total tax :" d="adminordercreation.bo.default"} + {format_money number={$order->getTotalAmountWithTax()-$order->getTotalAmountWithoutTax()} currency_id=$order->getCurrency()->getId()} + +

+
+
+

+ {intl l="Total with tax :" d="adminordercreation.bo.default"} + {format_money number=$order->getTotalAmountWithTax() currency_id=$order->getCurrency()->getId()} TTC + +

+
+
+
+
+
+ + + + +
+ +{/form} \ No newline at end of file diff --git a/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/assets/js/script.js b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/assets/js/script.js new file mode 100644 index 000000000..5f67d817e --- /dev/null +++ b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/assets/js/script.js @@ -0,0 +1,465 @@ +(function(){ + var $modal = $('#modal-order-creation'); + var currentRequest; + + // fix bug bootstrap 3 and select2 + $.fn.modal.Constructor.prototype.enforceFocus = function() {}; + + var timer = null; + function refreshWithTimer($form, event) { + if (timer !== null) { + clearTimeout(timer); + timer = null; + } + timer = setTimeout(function($form){ + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }, 700, $form); + } + + function initSelect($target, allowClear){ + + if (typeof allowClear === "undefined") { + allowClear = false; + } + return $target.select2({ + allowClear: allowClear, + templateResult: function(data){ + if (!data.id) return data.text; + var prefix = data.element.dataset.color ? ' ' : ''; + prefix += (data.element.dataset.ref ? ' ' + data.element.dataset.ref + '' : ''); + return $(prefix + ' ' + data.text + ''); + }, + templateSelection: function(data){ + if (!data.id) return data.text; + var prefix = data.element.dataset.color ? ' ' : ''; + prefix += (data.element.dataset.ref ? ' ' + data.element.dataset.ref + '' : ''); + return $(prefix + ' ' + data.text + ''); + } + }); + } + + function getFormData($form, data){ + var formData = $form.serializeArray(); + + for (var i in formData) { + for (var e in data) { + if (formData[i].name === e) { + formData[i].value = data[e]; + delete data[e]; + } + } + } + + for (var e in data) { + formData.push({ + name: i, + value: data[i] + } + ); + } + + return formData + } + + function initAjaxSelectCustomer($target){ + return $target.select2({ + ajax: { + url: $target.data('url'), + dataType: 'json', + delay: 250, + data: function (params){ + return { + q: params.term, + customerId: $target.data('customer-id') + }; + }, + processResults: function (data){ + return {results: data.items}; + }, + error: function(jqXHR, textStatus){ + if (jqXHR.statusText === 'abort') return; + $target.select2('destroy'); + $modal.displayError(jqXHR, textStatus); + }, + cache: false + }, + minimumInputLength: 3, + placeholder: $target.data('placeholder'), + templateResult: function(data){ + if (data.loading) return data.text; + + var markup = "
"; + markup += data.ref + ' : (' + data.firstname + ' ' + data.lastname + ')' + '
' + data.address + ''; + markup += "
"; + + return $(markup); + }, + templateSelection: function(data){ + if (data.text) { + return data.text; + } + + return data.ref + ' : (' + data.firstname + ' ' + data.lastname + ')'; + } + }); + } + + function initAjaxSelectProduct($target){ + return $target.select2({ + ajax: { + url: $target.data('url'), + dataType: 'json', + delay: 250, + data: function (params){ + return { + q: params.term + }; + }, + processResults: function (data){ + return {results: data.items}; + }, + error: function(jqXHR, textStatus){ + if (jqXHR.statusText === 'abort') return; + $target.select2('destroy'); + $modal.displayError(jqXHR, textStatus); + }, + cache: false + }, + minimumInputLength: 3, + placeholder: $target.data('placeholder'), + templateResult: function(data){ + if (data.loading) return data.text; + + var markup = "
"; + markup += data.ref + ' : ' + data.title; + markup += "
"; + + return $(markup); + }, + templateSelection: function(data){ + if (data.text) { + return data.text; + } + + return data.ref + ' : ' + data.title; + } + }); + } + + /****** Modal methods ******/ + $modal.loaderOff = function(){ + $modal.find('.modal-loader').addClass('hidden'); + $modal.find('.modal-body').removeClass('hidden'); + }; + + $modal.loaderOn = function(){ + $modal.find('.modal-loader').removeClass('hidden'); + $modal.find('.modal-body').addClass('hidden'); + }; + + $modal.reset = function(){ + $modal.hideError(); + $modal.loaderOn(); + }; + + $modal.hideError = function(){ + $modal.find('.modal-error').addClass('hidden').find('iframe').contents().find('html').empty(); + }; + + $modal.displayError = function(jqXHR, textStatus){ + if (jqXHR.statusText === 'abort') return; + $modal.loaderOff(); + $modal.find('.modal-body').addClass('hidden'); + var $error = $modal.find('.modal-error').removeClass('hidden'); + $error.find('.textStatus').html(textStatus); + $error.find('iframe').contents().find('html').html(jqXHR.responseText); + }; + + $modal.modalReady = function(){ + var $form = $modal.find('.modal-body form'); + + var $selectStatus = initSelect($form.find('.js-select-status')); + var $selectCustomer = initAjaxSelectCustomer($form.find('.js-select-customer')); + var $selectProduct = initAjaxSelectProduct($form.find('.js-select-product')); + var $selectProductSaleElement = initSelect($form.find('.js-select-product-sale-element')); + var $selectInvoiceAddress = initSelect($form.find('.js-select-invoice-address')); + var $selectDeliveryAddress = initSelect($form.find('.js-select-delivery-address')); + var $selectCreditNote = initSelect($form.find('.js-select-credit-note'), true); + var $selectCreditNoteStatus = initSelect($form.find('.js-select-credit-note-status')); + var $selectCreditNoteType = initSelect($form.find('.js-select-credit-note-type')); + + $form.on('submit', function(event){ + event.preventDefault(); + + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'create' + })); + }); + + $selectStatus.on('select2:select', function(event){ + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + $selectCustomer.on('select2:select', function(event){ + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[customer_id]': event.params.data.id, + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + $selectInvoiceAddress.on('select2:select', function(event){ + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + $selectDeliveryAddress.on('select2:select', function(event){ + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + $selectProduct.on('select2:select', function(event){ + $(event.target).parents('tr').find('.js-refresh-price').val('1'); + + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + $selectProductSaleElement.on('select2:select', function(event){ + $(event.target).parents('tr').find('.js-refresh-price').val('1'); + + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + $selectCreditNote.on('select2:select', function(event){ + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + $form.on('change', '.js-field-currency', function(event){ + $modal.loadAjax(event, getFormData($form, { + 'credit-note-create[action]': 'refresh' + })); + }); + + $form.on('change', '.js-action-refresh', function(event){ + if ($(this).val().length) { + refreshWithTimer($form, event); + } + }); + + var currentProductRequestTax; + $form.on('change', '.js-product-price-with-tax, .js-product-price-without-tax', function(event){ + if (currentProductRequestTax) currentProductRequestTax.abort(); + + var $th = $(this), $thr = $(this).parents('tr'); + + var val = parseFloat($(this).val()); + + if (!val) { + val = 0; + } + + currentProductRequestTax = $.ajax({ + url: $(this).data('url'), + dataType: 'json', + data: { + price: val, + tax_rule: this.dataset.taxRuleId + } + }); + + // ajax success + currentProductRequestTax.done(function(data){ + if ($th.hasClass('js-product-price-without-tax')) { + $thr.find('.js-product-price-with-tax').val(data.result); + } else { + $thr.find('.js-product-price-without-tax').val(data.result); + } + + refreshWithTimer($form, event); + }); + + // ajax error + currentProductRequestTax.fail(function(jqXHR, textStatus){ + if (jqXHR.statusText === 'abort') return; + $modal.displayError(jqXHR, textStatus); + }); + }); + + + /***** Product line *****/ + var $tableProductLine = $form.find('.js-table-product-line'); + var templateProductLine = $('#template-order-creation-product-line').html(); + + $tableProductLine.on('click', '.js-action-add', function(event){ + event.preventDefault(); + $(this).data('key', parseInt($(this).data('key')) + 1); + + var templateProductLineKey = templateProductLine.replace(/\[\]/g, '[' + $(this).data('key') + ']'); + $tableProductLine.find('tbody').append(templateProductLineKey); + + var $selectProduct = initAjaxSelectProduct($form.find('.js-table-product-line tbody .js-select-product').last()); + + $selectProduct.on('select2:select', function(event){ + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + /*if ($tableProductLine.find('tbody tr').not('.js-no-free-amount').length) { + $tableProductLine.find('.js-no-free-amount').addClass('hidden'); + } else { + $tableProductLine.find('.js-no-free-amount').removeClass('hidden'); + }*/ + }); + + $tableProductLine.on('click', '.js-action-delete', function(event){ + event.preventDefault(); + $(this).parents('tr').remove(); + + $modal.loadAjax(event, getFormData($form, { + 'admin-order-creation-create[action]': 'refresh' + })); + }); + + var $shippingArea = $form.find('.js-shipping-area'); + + var currentRequestTax; + $shippingArea.on('change', '.js-field-amount-without-tax, .js-field-amount-with-tax', function(event){ + if (currentRequestTax) currentRequestTax.abort(); + + var $th = $(this), $thr = $shippingArea; + + var val = parseFloat($(this).val()); + + if (!val) { + val = 0; + } + + currentRequestTax = $.ajax({ + url: $(this).data('url'), + dataType: 'json', + data: { + price: val, + tax_rule: parseInt($thr.find('.js-field-tax-rule').val()) + } + }); + + // ajax success + currentRequestTax.done(function(data){ + if ($th.hasClass('js-field-amount-without-tax')) { + $thr.find('.js-field-amount-with-tax').val(data.result); + } else { + $thr.find('.js-field-amount-without-tax').val(data.result); + } + + refreshWithTimer($form, event); + }); + + // ajax error + currentRequestTax.fail(function(jqXHR, textStatus){ + if (jqXHR.statusText === 'abort') return; + $modal.displayError(jqXHR, textStatus); + }); + }); + + $shippingArea.on('change', '.js-field-tax-rule', function(event){ + if (currentRequestTax) currentRequestTax.abort(); + + var $th = $(this), $thr = $shippingArea; + + var val = parseFloat($thr.find('.js-field-amount-with-tax').val()); + + if (!val) { + val = 0; + } + + currentRequestTax = $.ajax({ + url: $(this).data('url'), + dataType: 'json', + data: { + price: val, + tax_rule: parseInt($thr.find('.js-field-tax-rule').val()) + } + }); + + // ajax success + currentRequestTax.done(function(data){ + if ($th.hasClass('js-field-amount-without-tax')) { + $thr.find('.js-field-amount-with-tax').val(data.result); + } else { + $thr.find('.js-field-amount-without-tax').val(data.result); + } + + refreshWithTimer($form, event); + }); + + // ajax error + currentRequestTax.fail(function(jqXHR, textStatus){ + if (jqXHR.statusText === 'abort') return; + $modal.displayError(jqXHR, textStatus); + }); + }); + + + + }; + + $modal.loadAjax = function(event, data){ + if (typeof data === 'undefined') { + data = {}; + } + + // kill last ajax request if not if it's not finished + if (currentRequest) currentRequest.abort(); + + // to avoid a display bug with select2 + setTimeout(function(data){ + // ajax start + currentRequest = $.ajax({ + url: $modal.data('ajaxUrl'), + data: data, + method: 'POST' + }); + + // ajax success + currentRequest.done(function(data, textStatus, xhr){ + $modal.loaderOff(); + $modal.find('.modal-body').html(data); + $modal.modalReady(); + }); + + // ajax error + currentRequest.fail(function(jqXHR, textStatus){ + $modal.displayError(jqXHR, textStatus); + }); + }, 100, data); + }; + + $('body').on('click', '#btn-create-order', function(event){ + $modal.modal('show'); + var customerId = $(this).data('customerId'); + var creditNoteId = $(this).data('creditNoteId'); + + $modal.loadAjax(event, { + 'admin-order-creation-create[action]': 'open', + 'admin-order-creation-create[customer_id]': customerId, + 'admin-order-creation-create[credit_note_id]': creditNoteId + }); + }); + + $modal.on('hidden.bs.modal', function(){ + $modal.reset(); + }); + +}()); \ No newline at end of file diff --git a/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.edit.js.html b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.edit.js.html new file mode 100644 index 000000000..ee37f7f3f --- /dev/null +++ b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.edit.js.html @@ -0,0 +1,17 @@ + + \ No newline at end of file diff --git a/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.js.html b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.js.html new file mode 100644 index 000000000..571c53c00 --- /dev/null +++ b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.js.html @@ -0,0 +1,56 @@ + + + + + +{javascripts file='admin-order-creation/assets/js/script.js' source="AdminOrderCreation"} + +{/javascripts} + \ No newline at end of file diff --git a/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.table-header.html b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.table-header.html new file mode 100644 index 000000000..70a3027a4 --- /dev/null +++ b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/hook/orders.table-header.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/include/product-line.html b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/include/product-line.html new file mode 100644 index 000000000..0fd5b3dba --- /dev/null +++ b/local/modules/AdminOrderCreation/templates/backOffice/default/admin-order-creation/include/product-line.html @@ -0,0 +1,152 @@ + + + {form_field field='product_id' value_key=$key} + {if $orderProduct} + {loop type="product_sale_elements" order="id" name="product-sale-element-price-$key" id=$orderProduct->getProductSaleElementsId() currency=$currency_id backend_context=true} + {$product_id = $PRODUCT_ID} + {/loop} + {/if} + {$taxRuleId = null} +
+ +
+ {/form_field} + {form_field field='product_sale_element_id' value_key=$key} +
+ {if $product_id} + {$attributeCombinations = []} + {$PSE_first = null} + {loop type="product_sale_elements" order="id" name="product-sale-element-$key" product=$product_id currency=$currency_id backend_context=true} + {$PSE_id = $ID} + {if !$PSE_first} + {$PSE_first = $ID} + {/if} + {loop type="attribute_combination" name="attribute-combination-$key" product_sale_elements=$ID backend_context=true} + {$attributeCombinations[$PSE_id][] = $ATTRIBUTE_TITLE|cat:' : '|cat:$ATTRIBUTE_AVAILABILITY_TITLE} + {/loop} + {/loop} + + {if $attributeCombinations|count} + + {else} + {intl l="Default product sale element" d="adminordercreation.bo.default"} + + {loop type="product_sale_elements" order="id" name="product-sale-element-$key" product=$product_id limit=1 currency=$currency_id backend_context=true} + {$productSaleEmenetIdSelected = $ID} + + {/loop} + {/if} + {/if} +
+ {/form_field} + + + {if $product_id} + {if $productSaleEmenetIdSelected} + + {loop type="product_sale_elements" order="id" name="product-sale-element-price-$key" id=$productSaleEmenetIdSelected currency=$currency_id backend_context=true} + {form_field field='refresh_price' value_key=$key} + + {/form_field} + + {if $orderProduct->getWasInPromo()} + {$priceWithoutTax = $orderProduct->getPromoPrice()} + {else} + {$priceWithoutTax = $orderProduct->getPrice()} + {/if} + + {$taxes = 0} + {foreach from=$orderProduct->getOrderProductTaxes() item=orderProductTax} + {if $orderProduct->getWasInPromo()} + {$taxes = $taxes + $orderProductTax->getPromoAmount()} + {else} + {$taxes = $taxes + $orderProductTax->getAmount()} + {/if} + {/foreach} + + {form_field field='product_price_without_tax' value_key=$key} +
+
+ +
HT
+
+
+ {/form_field} + + {form_field field='product_price_with_tax' value_key=$key} +
+
+ +
TTC
+
+
+ {/form_field} + {/loop} + {/if} + {/if} + + + {form_field field='product_quantity' value_key=$key} +
+ {if $product_id} + {loop type="product_sale_elements" order="id" name="product-sale-element-quanaity-$key" id=$productSaleEmenetIdSelected currency=$currency_id backend_context=true} + + {/loop} + {/if} +
+ {/form_field} + + + {if $productSaleEmenetIdSelected} + {loop type="product_sale_elements" order="id" name="product-sale-element-price-$key" id=$productSaleEmenetIdSelected currency=$currency_id backend_context=true} +
+
+ +
HT
+
+
+ +
+
+ +
TTC
+
+
+ {/loop} + {/if} + + + + + \ No newline at end of file diff --git a/local/modules/Atos/Config/certif.fr.031203376400035 b/local/modules/Atos/Config/certif.fr.031203376400035 index 38c405372..eff9b9e2a 100644 --- a/local/modules/Atos/Config/certif.fr.031203376400035 +++ b/local/modules/Atos/Config/certif.fr.031203376400035 @@ -1,44 +1,44 @@ -GE7vlAm9WMSVdL1BBXmeD2P1ZEWn6muDOdGYOaey91vi8104USqy5IrH4EmBVpbmFA -dY2sm0spP7rjwm2YU97L6etVXtmidboXK2uyDGKo3tq1ruDId1vNY5dUPqpT8R1y3L -LBa3ujKfrobNukNlLmi614ZqZ95IAg4wLhoAa9eTx7tMHdECYJwaMQdUkpevoFKoQy -S3WFBwoltAHgQd3pEjOraOiKS5ZcqCdDtXLOCta3hcRt2JgLFIEhJvcXECIzCqiVhl -eJr7kjuACxt8p3OTe8RjOTVLTRbvJiv1VPYRsvAWXggIXEfm75tv1CcaMy2K0GAqoa -x92iBrg6fFJlTUIP3vjil7CnjDPo0pgxEaMpOjadKDsmsmsP4eeJEsc1jlVgZ7hP6U -EN9PGjuwegkfuvxCKHifmWVhufEunk62uclrUT1ux0XkmNWFm5VxXs6dapzFHgmHnY -lxckSHxSRqPLabW8ll1jn0BnH8x4PItAsXQe93YDPK552FsdKuVucDduMdNU9oI2pI -bssDMRNkKD7gds6LrBAPNCpmp84mtIyvOqthjgKjH57fLqZ17my03C92ANaOVck1un -BwcqZyOwYhxwwmAymGvBLYHYhXc6kyafOrPBpdcnUQ8MmYaBPan8lv6lyLZtWlz7cr -HyE9s8dx8NN4RCUrer976qfdzfCTJO4QImKiAWrzKGmQB22YZYuaCnbIAm7EvaPUMc -Nsyt1YcUT6RyzLBS2EBkl6jn7l2RTKB6qrWSGTgOfJozF1853AoBXnZN2iZ32fp95b -bP0pAKYMptkmXjGIEDdCjvHfoCd1TLb1onywU7H3Xl0M0RAKsKpVw2UZ59MvfzwygA -2JZBegSHydBvAA6f7Y7eUJxeEPdR58XTaQljHBA3znO5tl4XAs3bJwvWxxH55ZUOSt -uWWJUIxTobE82LNQTxBUiBB6jPIPZNndV0swUHxF0IalwodLYn0EVgKeevzBdectCO -EDCxoMxNtwiEHNvEOtlG8HRltxG44jLL4k2bxyJvvs1XV5OlNgwJO4FQftt0wlTYY9 -xdM9OJ3svb9FzHL9PBDGShOv6ZhxOrMhNxTNf7vK5gtUL1tPvcjzeSbyIWxXNhou15 -q4o5ZxmqcDJWeblzefVUjtzrMs5PnA5QoMuU7siDnXmh1GbDQsEEW9CIbDXSepHxIZ -HC48dhjbmkdlPMorjCBLbHNUJf7eSMxKPyPrOFAhZai0w68AIc9D7ptZJoPEqms64O -9lJbdo5ZG0PopS7dmEpcSWWpDFV3jhyJTYCpVCwwaSe4JoxoqcPCMCatFnti7kq5rN -4MDogPwrgOVSrjjf3n64uvPPoZFdBqlRJX9GEBslEE6nfPT4jKWhwji2BXifKwWwAG -7g6skqXHXcYfJJ876oijteOXINUCUJDMZxdqahTzJMnu0C9FskoOC2lTnZw0zsJ5DF -ElXEALjZezEWQu4LkuJXXd2IThyEKLfth1doUHcWN6HJ4UUBR5d0w02IQ6Mxdt3LjB -5Ldqqsab7WCwPWKEY6jmFEtscM0GVLXHuQk6jqiKod90ZaQKk5FT7y36a01ES18mB4 -BycGRfNXDWoqlYGsRCc1XhD8YNMfn8kEVmxyqZyfoKwXoUVAeAAooKAC4HHK7fRKDM -144242079835C20C45E69EB347ABBCF77F04B23BF39629A8891035423E3CC386A0 -7B3C5701C4AD69E9553B26CC0BF5EECFF5870551C600B8F730F5D254BF74A565C6 -6B4579C390A8DC6qQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 -qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG -112A59107EB88144C8A7336C5487503B02EF1E0937AB588DC4E42D35BC8567C0EA -181F19D1F3D8D3C19626080F3D3DA7901B63475590DD907AE1eFcB1ZxNnOK4rRiC -YhZYW3QiL6OW9eXqQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 -qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG -144242079835C20C45E69EB347ABBCF77F04B23BF39629A8891035423E3CC386A0 -7B3C5701C4AD69E9553B26CC0BF5EECFF5870551C600B8F730F5D254BF74A565C6 -6B4579C390A8DC6qQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 -qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG -1127349E4948198B92E77303D3BF9D9E7C0D37B60245BB789F425406ED1ADC2EA7 -BAED72A82D8300C138275636798737F202F376F40453FA7B01eFcB1ZxNnOK4rRiC -YhZYW3QiL6OW9eXqQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 -qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -SIPSATIS_SCLERIVEINSTERIVEIN,26/08/2014,V4,MERCANET,PROD++++++++++ +GE7vlAm9WMSVdL1BBXmeD2P1ZEWn6muDOdGYOaey91vi8104USqy5IrH4EmBVpbmFA +dY2sm0spP7rjwm2YU97L6etVXtmidboXK2uyDGKo3tq1ruDId1vNY5dUPqpT8R1y3L +LBa3ujKfrobNukNlLmi614ZqZ95IAg4wLhoAa9eTx7tMHdECYJwaMQdUkpevoFKoQy +S3WFBwoltAHgQd3pEjOraOiKS5ZcqCdDtXLOCta3hcRt2JgLFIEhJvcXECIzCqiVhl +eJr7kjuACxt8p3OTe8RjOTVLTRbvJiv1VPYRsvAWXggIXEfm75tv1CcaMy2K0GAqoa +x92iBrg6fFJlTUIP3vjil7CnjDPo0pgxEaMpOjadKDsmsmsP4eeJEsc1jlVgZ7hP6U +EN9PGjuwegkfuvxCKHifmWVhufEunk62uclrUT1ux0XkmNWFm5VxXs6dapzFHgmHnY +lxckSHxSRqPLabW8ll1jn0BnH8x4PItAsXQe93YDPK552FsdKuVucDduMdNU9oI2pI +bssDMRNkKD7gds6LrBAPNCpmp84mtIyvOqthjgKjH57fLqZ17my03C92ANaOVck1un +BwcqZyOwYhxwwmAymGvBLYHYhXc6kyafOrPBpdcnUQ8MmYaBPan8lv6lyLZtWlz7cr +HyE9s8dx8NN4RCUrer976qfdzfCTJO4QImKiAWrzKGmQB22YZYuaCnbIAm7EvaPUMc +Nsyt1YcUT6RyzLBS2EBkl6jn7l2RTKB6qrWSGTgOfJozF1853AoBXnZN2iZ32fp95b +bP0pAKYMptkmXjGIEDdCjvHfoCd1TLb1onywU7H3Xl0M0RAKsKpVw2UZ59MvfzwygA +2JZBegSHydBvAA6f7Y7eUJxeEPdR58XTaQljHBA3znO5tl4XAs3bJwvWxxH55ZUOSt +uWWJUIxTobE82LNQTxBUiBB6jPIPZNndV0swUHxF0IalwodLYn0EVgKeevzBdectCO +EDCxoMxNtwiEHNvEOtlG8HRltxG44jLL4k2bxyJvvs1XV5OlNgwJO4FQftt0wlTYY9 +xdM9OJ3svb9FzHL9PBDGShOv6ZhxOrMhNxTNf7vK5gtUL1tPvcjzeSbyIWxXNhou15 +q4o5ZxmqcDJWeblzefVUjtzrMs5PnA5QoMuU7siDnXmh1GbDQsEEW9CIbDXSepHxIZ +HC48dhjbmkdlPMorjCBLbHNUJf7eSMxKPyPrOFAhZai0w68AIc9D7ptZJoPEqms64O +9lJbdo5ZG0PopS7dmEpcSWWpDFV3jhyJTYCpVCwwaSe4JoxoqcPCMCatFnti7kq5rN +4MDogPwrgOVSrjjf3n64uvPPoZFdBqlRJX9GEBslEE6nfPT4jKWhwji2BXifKwWwAG +7g6skqXHXcYfJJ876oijteOXINUCUJDMZxdqahTzJMnu0C9FskoOC2lTnZw0zsJ5DF +ElXEALjZezEWQu4LkuJXXd2IThyEKLfth1doUHcWN6HJ4UUBR5d0w02IQ6Mxdt3LjB +5Ldqqsab7WCwPWKEY6jmFEtscM0GVLXHuQk6jqiKod90ZaQKk5FT7y36a01ES18mB4 +BycGRfNXDWoqlYGsRCc1XhD8YNMfn8kEVmxyqZyfoKwXoUVAeAAooKAC4HHK7fRKDM +144242079835C20C45E69EB347ABBCF77F04B23BF39629A8891035423E3CC386A0 +7B3C5701C4AD69E9553B26CC0BF5EECFF5870551C600B8F730F5D254BF74A565C6 +6B4579C390A8DC6qQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 +qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG +112A59107EB88144C8A7336C5487503B02EF1E0937AB588DC4E42D35BC8567C0EA +181F19D1F3D8D3C19626080F3D3DA7901B63475590DD907AE1eFcB1ZxNnOK4rRiC +YhZYW3QiL6OW9eXqQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 +qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG +144242079835C20C45E69EB347ABBCF77F04B23BF39629A8891035423E3CC386A0 +7B3C5701C4AD69E9553B26CC0BF5EECFF5870551C600B8F730F5D254BF74A565C6 +6B4579C390A8DC6qQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 +qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG +1127349E4948198B92E77303D3BF9D9E7C0D37B60245BB789F425406ED1ADC2EA7 +BAED72A82D8300C138275636798737F202F376F40453FA7B01eFcB1ZxNnOK4rRiC +YhZYW3QiL6OW9eXqQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 +qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +SIPSATIS_SCLERIVEINSTERIVEIN,26/08/2014,V4,MERCANET,PROD++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++END \ No newline at end of file diff --git a/local/modules/Atos/I18n/email-templates/en.html b/local/modules/Atos/I18n/email-templates/en.html index 7cfb98763..08d8bf36f 100644 --- a/local/modules/Atos/I18n/email-templates/en.html +++ b/local/modules/Atos/I18n/email-templates/en.html @@ -1,60 +1,60 @@ - - - - - courriel de confirmation de commande de {config key="url_site"} - - - -
-
-

{config key="store_name"}

- -

The payment of your order is confirmed

- -

Reference {$order_ref}

-
- -

- Your invoice is now available in your customer account on - {config key="store_name"}. -

- -

Thank you for your order !

- -

The {config key="store_name"} team.

-
- + + + + + courriel de confirmation de commande de {config key="url_site"} + + + +
+
+

{config key="store_name"}

+ +

The payment of your order is confirmed

+ +

Reference {$order_ref}

+
+ +

+ Your invoice is now available in your customer account on + {config key="store_name"}. +

+ +

Thank you for your order !

+ +

The {config key="store_name"} team.

+
+ \ No newline at end of file diff --git a/local/modules/Atos/I18n/email-templates/en.txt b/local/modules/Atos/I18n/email-templates/en.txt index 38e9864b8..5f569e894 100644 --- a/local/modules/Atos/I18n/email-templates/en.txt +++ b/local/modules/Atos/I18n/email-templates/en.txt @@ -1,9 +1,9 @@ -Dear customer, - -This is a confirmation of the payment of your order {$order_ref} via Payzen on our shop. - -Your invoice is now available in your customer account at {config key="url_site"} - -Thank you again for your purchase. - +Dear customer, + +This is a confirmation of the payment of your order {$order_ref} via Payzen on our shop. + +Your invoice is now available in your customer account at {config key="url_site"} + +Thank you again for your purchase. + The {config key="store_name"} team. \ No newline at end of file diff --git a/local/modules/Atos/I18n/email-templates/fr.html b/local/modules/Atos/I18n/email-templates/fr.html index 94376b1a8..ba3109574 100644 --- a/local/modules/Atos/I18n/email-templates/fr.html +++ b/local/modules/Atos/I18n/email-templates/fr.html @@ -1,62 +1,62 @@ - - - - - - Confirmation du paiement de votre commande sur {config key="url_site"} - - - - -
-
-

{config key="store_name"}

- -

Confirmation du paiement de votre commande

- -

N° {$order_ref}

-
- -

- Le suivi de votre commande est disponible dans la rubrique mon compte sur - {config key="url_site"} -

- -

Merci pour votre achat !

- -

L'équipe {config key="store_name"}

-
- + + + + + + Confirmation du paiement de votre commande sur {config key="url_site"} + + + + +
+
+

{config key="store_name"}

+ +

Confirmation du paiement de votre commande

+ +

N° {$order_ref}

+
+ +

+ Le suivi de votre commande est disponible dans la rubrique mon compte sur + {config key="url_site"} +

+ +

Merci pour votre achat !

+ +

L'équipe {config key="store_name"}

+
+ \ No newline at end of file diff --git a/local/modules/Atos/I18n/email-templates/fr.txt b/local/modules/Atos/I18n/email-templates/fr.txt index 8c3c83321..91bd4956f 100644 --- a/local/modules/Atos/I18n/email-templates/fr.txt +++ b/local/modules/Atos/I18n/email-templates/fr.txt @@ -1,9 +1,9 @@ -Cher client, - -Ce message confirme le paiement de votre commande numero {$order_ref} via Payzen sur notre boutique. - -Votre facture est maintenant disponible dans votre compte client à l'adresse {config key="url_site"} - -Merci encore pour votre achat ! - +Cher client, + +Ce message confirme le paiement de votre commande numero {$order_ref} via Payzen sur notre boutique. + +Votre facture est maintenant disponible dans votre compte client à l'adresse {config key="url_site"} + +Merci encore pour votre achat ! + L'équipe {config key="store_name"} \ No newline at end of file diff --git a/local/modules/FlatFeeDelivery/I18n/email-templates/en.html b/local/modules/FlatFeeDelivery/I18n/email-templates/en.html index ef01d7f9c..7dada5189 100644 --- a/local/modules/FlatFeeDelivery/I18n/email-templates/en.html +++ b/local/modules/FlatFeeDelivery/I18n/email-templates/en.html @@ -1,55 +1,55 @@ - - - - - Order {config key="url_site"} - - - -
-
-

{config key="store_name"}

- -

Your order has been shipped.

-
- -

Dear customer,

-

Your order {$order_ref} in {config key="store_name"} has been shipped.

-

Thank you for your order !

- -

The {config key="store_name"} team.

-
- + + + + + Order {config key="url_site"} + + + +
+
+

{config key="store_name"}

+ +

Your order has been shipped.

+
+ +

Dear customer,

+

Your order {$order_ref} in {config key="store_name"} has been shipped.

+

Thank you for your order !

+ +

The {config key="store_name"} team.

+
+ \ No newline at end of file diff --git a/local/modules/FlatFeeDelivery/I18n/email-templates/en.txt b/local/modules/FlatFeeDelivery/I18n/email-templates/en.txt index 17666fd8b..08a73e978 100644 --- a/local/modules/FlatFeeDelivery/I18n/email-templates/en.txt +++ b/local/modules/FlatFeeDelivery/I18n/email-templates/en.txt @@ -1,7 +1,7 @@ -Dear customer, - -Your order {$order_ref} in {config key="store_name"} has been shipped. - -Thank you again for your purchase. - +Dear customer, + +Your order {$order_ref} in {config key="store_name"} has been shipped. + +Thank you again for your purchase. + The {config key="store_name"} team. \ No newline at end of file diff --git a/local/modules/FlatFeeDelivery/I18n/email-templates/fr.html b/local/modules/FlatFeeDelivery/I18n/email-templates/fr.html index e7d034e49..1b4a666d1 100644 --- a/local/modules/FlatFeeDelivery/I18n/email-templates/fr.html +++ b/local/modules/FlatFeeDelivery/I18n/email-templates/fr.html @@ -1,57 +1,57 @@ - - - - - - Confirmation de l'expédition de votre commande sur {config key="url_site"} - - - - -
-
-

{config key="store_name"}

- -

Votre commande a été expédiée.

-
- -

Cher client,

-

Votre commande {$order_ref} sur {config key="store_name"} a été expédiée.

-

Merci pour votre achat !

- -

L'équipe {config key="store_name"}

-
- + + + + + + Confirmation de l'expédition de votre commande sur {config key="url_site"} + + + + +
+
+

{config key="store_name"}

+ +

Votre commande a été expédiée.

+
+ +

Cher client,

+

Votre commande {$order_ref} sur {config key="store_name"} a été expédiée.

+

Merci pour votre achat !

+ +

L'équipe {config key="store_name"}

+
+ \ No newline at end of file diff --git a/local/modules/FlatFeeDelivery/I18n/email-templates/fr.txt b/local/modules/FlatFeeDelivery/I18n/email-templates/fr.txt index 81f4a8e45..42ccee79d 100644 --- a/local/modules/FlatFeeDelivery/I18n/email-templates/fr.txt +++ b/local/modules/FlatFeeDelivery/I18n/email-templates/fr.txt @@ -1,7 +1,7 @@ -Cher client, - -Ce message confirme que votre commande {$order_ref} sur {config key="store_name"} a été expédiée. - -Merci encore pour votre achat ! - +Cher client, + +Ce message confirme que votre commande {$order_ref} sur {config key="store_name"} a été expédiée. + +Merci encore pour votre achat ! + L'équipe {config key="store_name"} \ No newline at end of file diff --git a/local/modules/PurgeFakeCustomer/Config/config.xml b/local/modules/PurgeFakeCustomer/Config/config.xml new file mode 100644 index 000000000..ce51a4811 --- /dev/null +++ b/local/modules/PurgeFakeCustomer/Config/config.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/local/modules/PurgeFakeCustomer/Config/module.xml b/local/modules/PurgeFakeCustomer/Config/module.xml new file mode 100644 index 000000000..5af8bae5a --- /dev/null +++ b/local/modules/PurgeFakeCustomer/Config/module.xml @@ -0,0 +1,28 @@ + + + PurgeFakeCustomer\PurgeFakeCustomer + + Delete fake customers + + + Supprime des faux comptes clients + + + en_US + fr_FR + + 1.0 + + + Laurent LE CORRE + laurent@thecoredev.fr + + + classic + 2.3.0 + beta + 0 + 0 + diff --git a/local/modules/PurgeFakeCustomer/Config/routing.xml b/local/modules/PurgeFakeCustomer/Config/routing.xml new file mode 100644 index 000000000..4dcd7379d --- /dev/null +++ b/local/modules/PurgeFakeCustomer/Config/routing.xml @@ -0,0 +1,12 @@ + + + + + + PurgeFakeCustomer\Controller\PurgeController::purge + .+ + + + diff --git a/local/modules/PurgeFakeCustomer/PurgeFakeCustomer.php b/local/modules/PurgeFakeCustomer/PurgeFakeCustomer.php new file mode 100644 index 000000000..3f80e8c4f --- /dev/null +++ b/local/modules/PurgeFakeCustomer/PurgeFakeCustomer.php @@ -0,0 +1,11 @@ +/local/modules/``` directory and be sure that the name of the module is PurgeFakeCustomer. +* Activate it in your thelia administration panel + +### Composer + +Add it in your main thelia composer.json file + +``` +composer require your-vendor/purge-fake-customer-module:~1.0 +``` + +## Usage + +Explain here how to use your module, how to configure it, etc. + +## Hook + +If your module use one or more hook, fill this part. Explain which hooks are used. + + +## Loop + +If your module declare one or more loop, describe them here like this : + +[loop name] + +### Input arguments + +|Argument |Description | +|--- |--- | +|**arg1** | describe arg1 with an exemple. | +|**arg2** | describe arg2 with an exemple. | + +### Output arguments + +|Variable |Description | +|--- |--- | +|$VAR1 | describe $VAR1 variable | +|$VAR2 | describe $VAR2 variable | + +### Exemple + +Add a complete exemple of your loop + +## Other ? + +If you have other think to put, feel free to complete your readme as you want. diff --git a/local/modules/PurgeFakeCustomer/composer.json b/local/modules/PurgeFakeCustomer/composer.json new file mode 100644 index 000000000..f6f7e614e --- /dev/null +++ b/local/modules/PurgeFakeCustomer/composer.json @@ -0,0 +1,11 @@ +{ + "name": "your-vendor/purge-fake-customer-module", + "license": "LGPL-3.0+", + "type": "thelia-module", + "require": { + "thelia/installer": "~1.1" + }, + "extra": { + "installer-name": "PurgeFakeCustomer" + } +} \ No newline at end of file diff --git a/templates/frontOffice/sterivein/assets/less/styles.less b/templates/frontOffice/sterivein/assets/less/styles.less index 36c4b6097..be1ed75f6 100644 --- a/templates/frontOffice/sterivein/assets/less/styles.less +++ b/templates/frontOffice/sterivein/assets/less/styles.less @@ -1,11 +1,11 @@ -/* Bootstrap */ -@import "bootstrap/bootstrap"; - -/* FontAwesome */ -@import "fontawesome/font-awesome"; - -/* Thelia */ -@import "thelia/import"; - -/* Theme */ -@import "../themes/default/less/import"; +/* Bootstrap */ +@import "bootstrap/bootstrap"; + +/* FontAwesome */ +@import "fontawesome/font-awesome"; + +/* Thelia */ +@import "thelia/import"; + +/* Theme */ +@import "../themes/default/less/import"; diff --git a/templates/frontOffice/sterivein/assets/themes/default/less/variables.less b/templates/frontOffice/sterivein/assets/themes/default/less/variables.less index 7057b5dd0..d47c905eb 100644 --- a/templates/frontOffice/sterivein/assets/themes/default/less/variables.less +++ b/templates/frontOffice/sterivein/assets/themes/default/less/variables.less @@ -1,115 +1,115 @@ -// Import Google Font -@import url(//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800); - -// Theme colors -@gray-darker: #222; -@gray-dark: #444; -@gray: #555; -@gray-light: #e5e5e5; -@gray-lighter: #eee; - -@brand-primary: #2a98d1; -@brand-success: #5cb85c; -@brand-warning: #f0ad4e; -@brand-danger: #d9534f; -@brand-info: #5bc0de; - -@body-bg: #EDF7FF; -@text-color: @gray-dark; - -@link-color: #0985C8; -@link-hover-color: #056192; - -@font-family-sans-serif: 'Open Sans', sans-serif; -@font-family-serif: Georgia, "Times New Roman", Times, serif; -@font-family-monospace: Monaco, Menlo, Consolas, "Courier New", monospace; -@font-family-base: @font-family-sans-serif; - -// Border Radius -@border-radius-base: 3px; - -// Forms -@input-border: @gray-light; -@input-color-placeholder: lighten(@text-color, 30%); - - -// Breadcrumbs -@breadcrumb-bg: @body-bg; -@breadcrumb-color: @text-color; -@breadcrumb-active-color: @text-color; -@breadcrumb-padding: 0; - - -// Pagination -@pagination-bg: #f9f9f9; -@pagination-border: #ddd; -@pagination-hover-bg: transparent;//darken(@pagination-bg, 10%); -@pagination-active-bg: @brand-primary; -@pagination-active-color: #fff; -@pagination-disabled-color: @gray-light; - - -// Pager -@pager-border-radius: 0; -@pager-disabled-color: @gray-light; - - -// Navbar -@navbar-default-color: darken(@navbar-default-bg, 52%); //#707070; -@navbar-default-bg: darken(@body-bg, 4%); -@navbar-default-border: @body-bg; - -// Navbar links -@navbar-default-link-color: @navbar-default-color; -@navbar-default-link-hover-color: #fff; -@navbar-default-link-hover-bg: @link-color; -@navbar-default-link-active-color: @link-color; -@navbar-default-link-active-bg: transparent; - - -// Thelia : Sub Navigation -@navbar-subnav-bg: @navbar-default-link-hover-bg; -@navbar-subnav-link-padding: 3px 12px; -@navbar-subnav-link-color: @navbar-default-link-hover-color; -@navbar-subnav-link-hover-bg: @navbar-subnav-link-color; -@navbar-subnav-link-hover-color: @navbar-subnav-bg; -@navbar-subnav-border: @navbar-subnav-bg; -@navbar-subnav-border-radius: 0; -@navbar-subnav-divider-bg: #fff; -@navbar-subnav-shadow: none; //0 6px 12px rgba(0,0,0,.175); - - -// Thelia : Toolbar -@toolbar-sorter-bg: @body-bg; -@toolbar-sorter-border-radius: 0; -@toolbar-sorter-padding: 0; - - -// Carousel -@carousel-text-shadow: none; -@carousel-control-color: #ccc; -@carousel-control-width: 10%; -@carousel-control-opacity: .5; -@carousel-control-font-size: 30px; - - -// Thelia : Products Filter -@filter-border: @filter-bg; -@filter-border-radius: 0; -@filter-padding: 0 15px; - - -// Thelia : Product Option -@option-bg: #fff; -@option-border: 0; -@option-border-radius: 0; -@option-padding: 0; -@option-heading-border: transparent; -@option-heading-color: @text-color; -@option-heading-font-size: @font-size-base; - - -// Panels -@panel-border-radius: 0; -@panel-default-border: @panel-default-heading-bg; - +// Import Google Font +@import url(//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800); + +// Theme colors +@gray-darker: #222; +@gray-dark: #444; +@gray: #555; +@gray-light: #e5e5e5; +@gray-lighter: #eee; + +@brand-primary: #2a98d1; +@brand-success: #5cb85c; +@brand-warning: #f0ad4e; +@brand-danger: #d9534f; +@brand-info: #5bc0de; + +@body-bg: #EDF7FF; +@text-color: @gray-dark; + +@link-color: #0985C8; +@link-hover-color: #056192; + +@font-family-sans-serif: 'Open Sans', sans-serif; +@font-family-serif: Georgia, "Times New Roman", Times, serif; +@font-family-monospace: Monaco, Menlo, Consolas, "Courier New", monospace; +@font-family-base: @font-family-sans-serif; + +// Border Radius +@border-radius-base: 3px; + +// Forms +@input-border: @gray-light; +@input-color-placeholder: lighten(@text-color, 30%); + + +// Breadcrumbs +@breadcrumb-bg: @body-bg; +@breadcrumb-color: @text-color; +@breadcrumb-active-color: @text-color; +@breadcrumb-padding: 0; + + +// Pagination +@pagination-bg: #f9f9f9; +@pagination-border: #ddd; +@pagination-hover-bg: transparent;//darken(@pagination-bg, 10%); +@pagination-active-bg: @brand-primary; +@pagination-active-color: #fff; +@pagination-disabled-color: @gray-light; + + +// Pager +@pager-border-radius: 0; +@pager-disabled-color: @gray-light; + + +// Navbar +@navbar-default-color: darken(@navbar-default-bg, 52%); //#707070; +@navbar-default-bg: darken(@body-bg, 4%); +@navbar-default-border: @body-bg; + +// Navbar links +@navbar-default-link-color: @navbar-default-color; +@navbar-default-link-hover-color: #fff; +@navbar-default-link-hover-bg: @link-color; +@navbar-default-link-active-color: @link-color; +@navbar-default-link-active-bg: transparent; + + +// Thelia : Sub Navigation +@navbar-subnav-bg: @navbar-default-link-hover-bg; +@navbar-subnav-link-padding: 3px 12px; +@navbar-subnav-link-color: @navbar-default-link-hover-color; +@navbar-subnav-link-hover-bg: @navbar-subnav-link-color; +@navbar-subnav-link-hover-color: @navbar-subnav-bg; +@navbar-subnav-border: @navbar-subnav-bg; +@navbar-subnav-border-radius: 0; +@navbar-subnav-divider-bg: #fff; +@navbar-subnav-shadow: none; //0 6px 12px rgba(0,0,0,.175); + + +// Thelia : Toolbar +@toolbar-sorter-bg: @body-bg; +@toolbar-sorter-border-radius: 0; +@toolbar-sorter-padding: 0; + + +// Carousel +@carousel-text-shadow: none; +@carousel-control-color: #ccc; +@carousel-control-width: 10%; +@carousel-control-opacity: .5; +@carousel-control-font-size: 30px; + + +// Thelia : Products Filter +@filter-border: @filter-bg; +@filter-border-radius: 0; +@filter-padding: 0 15px; + + +// Thelia : Product Option +@option-bg: #fff; +@option-border: 0; +@option-border-radius: 0; +@option-padding: 0; +@option-heading-border: transparent; +@option-heading-color: @text-color; +@option-heading-font-size: @font-size-base; + + +// Panels +@panel-border-radius: 0; +@panel-default-border: @panel-default-heading-bg; + diff --git a/templates/frontOffice/sterivein/includes/brand-menu.html b/templates/frontOffice/sterivein/includes/brand-menu.html index f775ada15..7d4b11884 100644 --- a/templates/frontOffice/sterivein/includes/brand-menu.html +++ b/templates/frontOffice/sterivein/includes/brand-menu.html @@ -1,12 +1,12 @@ - + diff --git a/templates/frontOffice/sterivein/layout.tpl b/templates/frontOffice/sterivein/layout.tpl index 592fda5d0..cc5b702ea 100644 --- a/templates/frontOffice/sterivein/layout.tpl +++ b/templates/frontOffice/sterivein/layout.tpl @@ -1,395 +1,395 @@ - - - -{* Declare assets directory, relative to template base directory *} -{declare_assets directory='assets'} -{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *} -{default_translation_domain domain='fo.sterivein'} - -{* -- Define some stuff for Smarty ------------------------------------------ *} -{config_load file='variables.conf'} -{block name="init"}{/block} -{block name="no-return-functions"}{/block} -{assign var="store_name" value="{config key="store_name"}"} -{assign var="store_description" value="{config key="store_description"}"} -{if not $store_name}{assign var="store_name" value="{intl l='Thelia V2'}"}{/if} -{if not $store_description}{assign var="store_description" value="$store_name"}{/if} - -{* paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither *} - - - - - - - {* Test if javascript is enabled *} - - - - - {* Page Title *} - {block name="page-title"}{strip}{if $page_title}{$page_title}{elseif $breadcrumbs}{foreach from=$breadcrumbs|array_reverse item=breadcrumb}{$breadcrumb.title|unescape} - {/foreach}{$store_name}{/if}{/strip}{/block} - - {* Meta Tags *} - - - - {block name="meta"} - - {/block} - - {* Stylesheets *} - {* - {stylesheets file='assets/css/styles.css'} - - {/stylesheets} - *} - {stylesheets file='assets/less/styles.less' filters="less"} - - {/stylesheets} - - {block name="stylesheet"}{/block} - - {* Favicon *} - {images file='assets/img/favicon.ico'}{/images} - {images file='assets/img/favicon.png'}{/images} - - {* Feeds *} - - - - {block name="feeds"}{/block} - - {* HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries *} - - {hook name="recaptcha.js"} - - - - - -{intl l="Skip to content"} - -
- -
- - - - - - - -
- -
-
- {block name="breadcrumb"}{/block} -
{block name="main-content"}{/block}
-
-
- - - -
- -{block name="before-javascript-include"}{/block} - - - - - - - - -{javascripts file='assets/js/bootstrap/bootstrap.js'} - -{/javascripts} - -{javascripts file='assets/js/plugins/bootbox/bootbox.js'} - -{/javascripts} - -{block name="after-javascript-include"}{/block} - -{block name="javascript-initialization"}{/block} - - -{javascripts file='assets/js/script.js'} - -{/javascripts} -{literal} - -{/literal} - - + + + +{* Declare assets directory, relative to template base directory *} +{declare_assets directory='assets'} +{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *} +{default_translation_domain domain='fo.sterivein'} + +{* -- Define some stuff for Smarty ------------------------------------------ *} +{config_load file='variables.conf'} +{block name="init"}{/block} +{block name="no-return-functions"}{/block} +{assign var="store_name" value="{config key="store_name"}"} +{assign var="store_description" value="{config key="store_description"}"} +{if not $store_name}{assign var="store_name" value="{intl l='Thelia V2'}"}{/if} +{if not $store_description}{assign var="store_description" value="$store_name"}{/if} + +{* paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither *} + + + + + + + {* Test if javascript is enabled *} + + + + + {* Page Title *} + {block name="page-title"}{strip}{if $page_title}{$page_title}{elseif $breadcrumbs}{foreach from=$breadcrumbs|array_reverse item=breadcrumb}{$breadcrumb.title|unescape} - {/foreach}{$store_name}{/if}{/strip}{/block} + + {* Meta Tags *} + + + + {block name="meta"} + + {/block} + + {* Stylesheets *} + {* + {stylesheets file='assets/css/styles.css'} + + {/stylesheets} + *} + {stylesheets file='assets/less/styles.less' filters="less"} + + {/stylesheets} + + {block name="stylesheet"}{/block} + + {* Favicon *} + {images file='assets/img/favicon.ico'}{/images} + {images file='assets/img/favicon.png'}{/images} + + {* Feeds *} + + + + {block name="feeds"}{/block} + + {* HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries *} + + {hook name="recaptcha.js"} + + + + + +{intl l="Skip to content"} + +
+ +
+ + + + + + + +
+ +
+
+ {block name="breadcrumb"}{/block} +
{block name="main-content"}{/block}
+
+
+ + + +
+ +{block name="before-javascript-include"}{/block} + + + + + + + + +{javascripts file='assets/js/bootstrap/bootstrap.js'} + +{/javascripts} + +{javascripts file='assets/js/plugins/bootbox/bootbox.js'} + +{/javascripts} + +{block name="after-javascript-include"}{/block} + +{block name="javascript-initialization"}{/block} + + +{javascripts file='assets/js/script.js'} + +{/javascripts} +{literal} + +{/literal} + + diff --git a/templates/frontOffice/sterivein/password.html b/templates/frontOffice/sterivein/password.html index 2e66a0ba7..065655517 100644 --- a/templates/frontOffice/sterivein/password.html +++ b/templates/frontOffice/sterivein/password.html @@ -1,44 +1,44 @@ -{extends file="layout.tpl"} - -{* Body Class *} -{block name="body-class"}page-password{/block} - -{* Breadcrumb *} -{block name='no-return-functions' append} - {$breadcrumbs = [ - ['title' => {intl l="Password"}, 'url'=>{url path="/password"}] - ]} -{/block} - - -{block name="main-content"} -
-
-

{intl l="Password Forgotten"}

- {form name="thelia.front.customer.lostpassword"} -
- {form_hidden_fields form=$form} -

{intl l="Please enter your email address below."} {intl l="You will receive a link to reset your password."}

- {if $form_error}
{$form_error_message}
{/if} - {form_field form=$form field="email"} -
- -
- - {if $error} - {$message} - {elseif !$error && $value != ""} - {intl l="You will receive a link to reset your password."} - {/if} -
-
- {/form_field} -
- {intl l="Cancel"} - -
-
- {/form} -
-
-{/block} +{extends file="layout.tpl"} + +{* Body Class *} +{block name="body-class"}page-password{/block} + +{* Breadcrumb *} +{block name='no-return-functions' append} + {$breadcrumbs = [ + ['title' => {intl l="Password"}, 'url'=>{url path="/password"}] + ]} +{/block} + + +{block name="main-content"} +
+
+

{intl l="Password Forgotten"}

+ {form name="thelia.front.customer.lostpassword"} +
+ {form_hidden_fields form=$form} +

{intl l="Please enter your email address below."} {intl l="You will receive a link to reset your password."}

+ {if $form_error}
{$form_error_message}
{/if} + {form_field form=$form field="email"} +
+ +
+ + {if $error} + {$message} + {elseif !$error && $value != ""} + {intl l="You will receive a link to reset your password."} + {/if} +
+
+ {/form_field} +
+ {intl l="Cancel"} + +
+
+ {/form} +
+
+{/block}