-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1948 from dpfaffenbauer/features/quote-state-machine
[Quotes] introduce simple state machine
- Loading branch information
Showing
30 changed files
with
540 additions
and
14 deletions.
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
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
27 changes: 27 additions & 0 deletions
27
...reShop/Bundle/CoreBundle/Form/Type/Notification/Condition/QuoteStateConfigurationType.php
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,27 @@ | ||
<?php | ||
/** | ||
* CoreShop. | ||
* | ||
* This source file is subject to the GNU General Public License version 3 (GPLv3) | ||
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt | ||
* files that are distributed with this source code. | ||
* | ||
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) | ||
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreShop\Bundle\CoreBundle\Form\Type\Notification\Condition; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
final class QuoteStateConfigurationType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder->add('quoteState', TextType::class); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/CoreShop/Bundle/CoreBundle/Migrations/Version20220330151612.php
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,65 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreShop\Bundle\CoreBundle\Migrations; | ||
|
||
use CoreShop\Component\Pimcore\DataObject\ClassUpdate; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
use Symfony\Component\DependencyInjection\ContainerAwareTrait; | ||
|
||
final class Version20220330151612 extends AbstractMigration implements ContainerAwareInterface | ||
{ | ||
use ContainerAwareTrait; | ||
|
||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$orderClassName = $this->container->getParameter('coreshop.model.order.pimcore_class_name'); | ||
$classUpdater = new ClassUpdate($orderClassName); | ||
|
||
$fieldQuoteStatus = [ | ||
"fieldtype" => "input", | ||
"width" => null, | ||
"queryColumnType" => "varchar", | ||
"columnType" => "varchar", | ||
"columnLength" => 190, | ||
"phpdocType" => "string", | ||
"regex" => "", | ||
"unique" => false, | ||
"showCharCount" => null, | ||
"name" => "quoteState", | ||
"title" => "coreshop.order.quote_state", | ||
"tooltip" => "", | ||
"mandatory" => false, | ||
"noteditable" => true, | ||
"index" => false, | ||
"locked" => false, | ||
"style" => "", | ||
"permissions" => null, | ||
"datatype" => "data", | ||
"relationType" => false, | ||
"invisible" => false, | ||
"visibleGridView" => false, | ||
"visibleSearch" => false, | ||
]; | ||
|
||
if (!$classUpdater->hasField('quoteState')) { | ||
$classUpdater->insertFieldBefore('orderState', $fieldQuoteStatus); | ||
} | ||
|
||
$classUpdater->save(); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
|
||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/CoreShop/Bundle/CoreBundle/Migrations/Version20220330153600.php
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,65 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreShop\Bundle\CoreBundle\Migrations; | ||
|
||
use CoreShop\Component\Pimcore\DataObject\ClassUpdate; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
use Symfony\Component\DependencyInjection\ContainerAwareTrait; | ||
|
||
final class Version20220330153600 extends AbstractMigration implements ContainerAwareInterface | ||
{ | ||
use ContainerAwareTrait; | ||
|
||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$orderClassName = $this->container->getParameter('coreshop.model.order.pimcore_class_name'); | ||
$classUpdater = new ClassUpdate($orderClassName); | ||
|
||
$fieldQuoteNumber = [ | ||
"fieldtype" => "input", | ||
"width" => null, | ||
"queryColumnType" => "varchar", | ||
"columnType" => "varchar", | ||
"columnLength" => 190, | ||
"phpdocType" => "string", | ||
"regex" => "", | ||
"unique" => false, | ||
"showCharCount" => null, | ||
"name" => "quoteNumber", | ||
"title" => "coreshop.order.quote_number", | ||
"tooltip" => "", | ||
"mandatory" => false, | ||
"noteditable" => true, | ||
"index" => false, | ||
"locked" => false, | ||
"style" => "", | ||
"permissions" => null, | ||
"datatype" => "data", | ||
"relationType" => false, | ||
"invisible" => false, | ||
"visibleGridView" => false, | ||
"visibleSearch" => false, | ||
]; | ||
|
||
if (!$classUpdater->hasField('quoteNumber')) { | ||
$classUpdater->insertFieldBefore('orderNumber', $fieldQuoteNumber); | ||
} | ||
|
||
$classUpdater->save(); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
|
||
} | ||
} |
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
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
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
25 changes: 25 additions & 0 deletions
25
src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/img/quotes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
...Bundle/CoreBundle/Resources/public/pimcore/js/notification/conditions/quote/quoteState.js
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,41 @@ | ||
/* | ||
* CoreShop. | ||
* | ||
* This source file is subject to the GNU General Public License version 3 (GPLv3) | ||
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt | ||
* files that are distributed with this source code. | ||
* | ||
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) | ||
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3) | ||
* | ||
*/ | ||
|
||
pimcore.registerNS('coreshop.notification.rule.conditions.quoteState'); | ||
|
||
coreshop.notification.rule.conditions.quoteState = Class.create(coreshop.rules.conditions.abstract, { | ||
type: 'orderStaquoteStatete', | ||
|
||
getForm: function () { | ||
this.form = Ext.create('Ext.form.FieldSet', { | ||
items: [ | ||
{ | ||
xtype: 'combo', | ||
fieldLabel: t('coreshop_transition_direction_state'), | ||
name: 'quoteState', | ||
value: this.data ? this.data.quoteState : [], | ||
width: 250, | ||
store: pimcore.globalmanager.get('coreshop_states_quote'), | ||
triggerAction: 'all', | ||
typeAhead: false, | ||
editable: false, | ||
forceSelection: true, | ||
queryMode: 'local', | ||
displayField: 'label', | ||
valueField: 'state' | ||
} | ||
] | ||
}); | ||
|
||
return this.form; | ||
} | ||
}); |
Oops, something went wrong.