-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #10079 [Channel] Shop billing data (Zales0123)
This PR was merged into the 1.4-dev branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Related tickets | associated with Sylius/RefundPlugin#106, Sylius/InvoicingPlugin#52 | License | MIT During the development of `InvoicingPlugin`, we introduced a concept of shop billing data (set per channel) that is required to be displayed on an invoice. On the other hand, we also should have it in a `RefundPlugin` to generate a credit memo properly. We considered a few options, but in the end, it's quite a common use case to have such a bunch of data manageable in Admin panel. <img width="563" alt="zrzut ekranu 2019-01-9 o 11 04 31" src="https://user-images.githubusercontent.com/6212718/50892815-a35ed480-13ff-11e9-81e7-d5a96c6f8e28.png"> Commits ------- f7cdb5522feec956a5964dbd97b444e89ea11448 Shop billing data on channel tests ea37635e60d9ff0bd47273978bbc6a3f3652cc75 ShopBillingData entity and Channel relation 1185ef8657c327190004e297be93e52c1ca05235 Shop billing data in channel form 0848c16074c707e57fa981fe7ae838c820e0f731 Tests fixes and nullable fields 801247abb80c5feaa357073987beb770a9a6eada PR review changes cfdca1e8363abf739f2a601021171d6f6a1d7dd1 Change column names to fulfill conventions
- Loading branch information
Showing
6 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Bundle\CoreBundle\Form\Type; | ||
|
||
use Sylius\Bundle\AddressingBundle\Form\Type\CountryCodeChoiceType; | ||
use Sylius\Component\Core\Model\ShopBillingData; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
final class ShopBillingDataType extends AbstractType | ||
{ | ||
/** @var string */ | ||
private $dataClass; | ||
|
||
public function __construct(string $dataClass) | ||
{ | ||
$this->dataClass = $dataClass; | ||
} | ||
|
||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder | ||
->add('taxId', TextType::class, [ | ||
'label' => 'sylius.form.channel.billing_data.tax_id', | ||
'required' => false, | ||
]) | ||
->add('company', TextType::class, [ | ||
'required' => false, | ||
'label' => 'sylius.form.channel.billing_data.company', | ||
]) | ||
->add('countryCode', CountryCodeChoiceType::class, [ | ||
'label' => 'sylius.form.channel.billing_data.country', | ||
'enabled' => true, | ||
'required' => false, | ||
]) | ||
->add('street', TextType::class, [ | ||
'label' => 'sylius.form.channel.billing_data.street', | ||
'required' => false, | ||
]) | ||
->add('city', TextType::class, [ | ||
'label' => 'sylius.form.channel.billing_data.city', | ||
'required' => false, | ||
]) | ||
->add('postcode', TextType::class, [ | ||
'label' => 'sylius.form.channel.billing_data.postcode', | ||
'required' => false, | ||
]) | ||
; | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver) | ||
{ | ||
$resolver->setDefault('data_class', $this->dataClass); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
This file is part of the Sylius package. | ||
(c) Paweł Jędrzejewski | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
--> | ||
|
||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
|
||
<entity name="Sylius\Component\Core\Model\ShopBillingData" table="sylius_shop_billing_data"> | ||
<id name="id" column="id" type="integer"> | ||
<generator/> | ||
</id> | ||
|
||
<field name="company" nullable="true" /> | ||
<field name="taxId" column="tax_id" nullable="true" /> | ||
<field name="countryCode" column="country_code" nullable="true" /> | ||
<field name="street" nullable="true" /> | ||
<field name="city" nullable="true" /> | ||
<field name="postcode" nullable="true" /> | ||
</entity> | ||
</doctrine-mapping> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters