Ajout des modules ColissimoWs et ColissimoLabel.php

Ne pas oublier de vérifier si les tables nécessaires sont bien créées en BDD.
This commit is contained in:
2020-05-07 11:45:31 +02:00
parent 28b21af6c8
commit 649c92e52f
114 changed files with 21550 additions and 8312 deletions

View File

@@ -0,0 +1,182 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
/**
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
* Date: 17/08/2019 12:26
*/
namespace ColissimoWs\Form;
use ColissimoWs\ColissimoWs;
use SimpleDhl\SimpleDhl;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm;
class ConfigurationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
ColissimoWs::COLISSIMO_USERNAME,
'text',
[
'constraints' => [
new NotBlank(),
],
'label' => $this->translator->trans('Colissimo username', [], ColissimoWs::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans(
'Nom d\'utilisateur Colissimo. C\'est l\'identifiants qui vous permet daccéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise',
[],
ColissimoWs::DOMAIN_NAME
)
]
]
)
->add(
ColissimoWs::COLISSIMO_PASSWORD,
'text',
[
'constraints' => [
new NotBlank(),
],
'label' => $this->translator->trans('Colissimo password', [], ColissimoWs::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans(
'Le mot de passe qui vous permet daccéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise',
[],
ColissimoWs::DOMAIN_NAME
)
]
]
)->add(
ColissimoWs::AFFRANCHISSEMENT_ENDPOINT_URL,
'url',
[
'constraints' => [
new NotBlank(),
],
'label' => $this->translator->trans('Endpoint du web service d\'affranchissement', [], ColissimoWs::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans(
'Indiquez le endpoint de base à utiliser, par exemple https://domain.tld/transactionaldata/api/v1',
[],
ColissimoWs::DOMAIN_NAME
)
]
]
)->add(
ColissimoWs::FORMAT_ETIQUETTE,
'choice',
[
'constraints' => [
new NotBlank(),
],
'choices' => [
'PDF_A4_300dpi' => 'Bureautique PDF, A4, résolution 300dpi',
'PDF_10x15_300dpi' => 'Bureautique PDF, 10cm par 15cm, résolution 300dpi',
'ZPL_10x15_203dpi' => 'Thermique en ZPL, de dimension 10cm par 15cm, et de résolution 203dpi',
'ZPL_10x15_300dpi' => 'Thermique ZPL, 10cm par 15cm, résolution 300dpi',
'DPL_10x15_203dpi' => 'Thermique DPL, 10cm par 15cm, résolution 203dpi',
'DPL_10x15_300dpi' => 'Thermique DPL, 10cm par 15cm, résolution 300dpi',
],
'label' => $this->translator->trans('Format des étiquettes', [], ColissimoWs::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans(
'Indiquez le format des étiquettes à générer, en fonction de l\'imprimante dont vous disposez.',
[],
ColissimoWs::DOMAIN_NAME
)
]
]
)->add(
ColissimoWs::ACTIVATE_DETAILED_DEBUG,
'checkbox',
[
'required' => false,
'label' => $this->translator->trans('Activer les logs détaillés', [], ColissimoWs::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans(
'Si cette case est cochée, le texte complet des requêtes et des réponses figurera dans le log Thelia',
[],
ColissimoWs::DOMAIN_NAME
)
]
]
)
->add(
ColissimoWs::FROM_NAME,
'text',
[
'constraints' => [
new NotBlank(),
],
'label' => $this->translator->trans('Nom de société', [], ColissimoWs::DOMAIN_NAME),
]
)
->add(
ColissimoWs::FROM_ADDRESS_1,
'text',
[
'constraints' => [ new NotBlank() ],
'label' => $this->translator->trans('Adresse', [], ColissimoWs::DOMAIN_NAME)
]
)
->add(
ColissimoWs::FROM_ADDRESS_2,
'text',
[
'constraints' => [ ],
'required' => false,
'label' => $this->translator->trans('Adresse (suite)', [], ColissimoWs::DOMAIN_NAME)
]
)
->add(
ColissimoWs::FROM_CITY,
'text',
[
'constraints' => [ new NotBlank() ],
'label' => $this->translator->trans('Ville', [], ColissimoWs::DOMAIN_NAME)
]
)
->add(
ColissimoWs::FROM_ZIPCODE,
'text',
[
'constraints' => [ new NotBlank() ],
'label' => $this->translator->trans('Code postal', [], ColissimoWs::DOMAIN_NAME)
]
)
->add(
ColissimoWs::FROM_COUNTRY,
'text',
[
'constraints' => [ new NotBlank() ],
'label' => $this->translator->trans('Pays', [], ColissimoWs::DOMAIN_NAME)
]
)->add(
ColissimoWs::FROM_CONTACT_EMAIL,
'email',
[
'constraints' => [ new NotBlank() ],
'label' => $this->translator->trans('Adresse e-mail de contact pour les expéditions', [], ColissimoWs::DOMAIN_NAME)
]
)->add(
ColissimoWs::FROM_PHONE,
'text',
[
'constraints' => [ new NotBlank() ],
'label' => $this->translator->trans('Téléphone', [], ColissimoWs::DOMAIN_NAME)
]
)
;
}
}

View File

@@ -0,0 +1,69 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace ColissimoWs\Form;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
class FreeShippingForm extends BaseForm
{
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->formBuilder attribute :
*
* $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new \Symfony\Component\Validator\Constraints\NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
$this->formBuilder
->add("delivery_mode", "integer")
->add("freeshipping", "checkbox", array(
'label'=>Translator::getInstance()->trans("Activate free shipping: ")
))
;
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "colissimowsfreeshipping";
}
}

View File

@@ -0,0 +1,71 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
/**
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
* Date: 17/08/2019 12:26
*/
namespace ColissimoWs\Form;
use ColissimoWs\ColissimoWs;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
class LabelGenerationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
'new_status',
'choice', [
'label' => Translator::getInstance()->trans('Order status after export'),
'choices' => [
"nochange" => Translator::getInstance()->trans("Do not change", [], ColissimoWs::DOMAIN_NAME),
"processing" => Translator::getInstance()->trans("Set orders status as processing", [], ColissimoWs::DOMAIN_NAME),
"sent" => Translator::getInstance()->trans("Set orders status as sent", [], ColissimoWs::DOMAIN_NAME)
],
'required' => 'true',
'expanded' => true,
'multiple' => false,
'data' => ColissimoWs::getConfigValue("new_status", 'nochange')
]
)
->add(
'order_id',
'collection',
[
'type' => 'integer',
'allow_add' => true,
'allow_delete' => true,
]
)
->add(
"weight",
'collection',
[
'type' => 'number',
'allow_add' => true,
'allow_delete' => true,
]
)
->add(
"signed",
"collection",
[
'type' => 'checkbox',
'label' => 'Signature',
'allow_add' => true,
'allow_delete' => true,
]);
;
}
}