var $restaurantToken; | var $restaurantToken; | ||||
var $urlApi = 'https://app.tillersystems.com/api/'; | var $urlApi = 'https://app.tillersystems.com/api/'; | ||||
public function __construct(string $providerToken, string $restaurantToken) | |||||
public function __construct(string $providerToken = null, string $restaurantToken = null) | |||||
{ | { | ||||
$this->curl = new curl\Curl(); | $this->curl = new curl\Curl(); | ||||
$this->providerToken = $providerToken; | $this->providerToken = $providerToken; |
class TillerManager extends AbstractManager | class TillerManager extends AbstractManager | ||||
{ | { | ||||
protected bool $tillerActivated; | |||||
protected ?bool $tillerActivated; | |||||
protected ProducerSolver $producerSolver; | protected ProducerSolver $producerSolver; | ||||
protected TillerClient $tillerClient; | protected TillerClient $tillerClient; | ||||
protected OrderSolver $orderSolver; | protected OrderSolver $orderSolver; |
{ | { | ||||
public function up() | public function up() | ||||
{ | { | ||||
$this->addColumn('user', 'id_etablissement', Schema::TYPE_INTEGER) ; | |||||
//$this->addColumn('user', 'id_etablissement', Schema::TYPE_INTEGER) ; | |||||
//$this->addColumn('user', 'nom_magasin', Schema::TYPE_STRING) ; | //$this->addColumn('user', 'nom_magasin', Schema::TYPE_STRING) ; | ||||
//$this->addColumn('user', 'siret', Schema::TYPE_STRING) ; | //$this->addColumn('user', 'siret', Schema::TYPE_STRING) ; | ||||
} | } | ||||
public function down() | public function down() | ||||
{ | { | ||||
$this->dropColumn('user', 'id_etablissement') ; | |||||
//$this->dropColumn('user', 'id_etablissement') ; | |||||
//$this->dropColumn('user', 'nom_magasin') ; | //$this->dropColumn('user', 'nom_magasin') ; | ||||
//$this->dropColumn('user', 'siret') ; | //$this->dropColumn('user', 'siret') ; | ||||
} | } |
class m171227_090138_champs_priorite_developpement extends Migration { | class m171227_090138_champs_priorite_developpement extends Migration { | ||||
public function up() { | public function up() { | ||||
$this->addColumn('developpement_priorite','priorite',Schema::TYPE_STRING.' DEFAULT \''.DeveloppementPriorite::PRIORITE_NORMALE.'\''); | |||||
$this->addColumn('developpement_priorite','priorite',Schema::TYPE_STRING); | |||||
} | } | ||||
public function down() { | public function down() { |
*/ | */ | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m181107_104051_add_champs_commande_deleted extends Migration | class m181107_104051_add_champs_commande_deleted extends Migration | ||||
{ | { |
<?php | <?php | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m181220_080234_translate_database extends Migration | class m181220_080234_translate_database extends Migration | ||||
{ | { |
<?php | <?php | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m190109_080828_add_field_subscription_order extends Migration { | class m190109_080828_add_field_subscription_order extends Migration { | ||||
class m190205_164612_ajout_produit_don_aux_distributions_existantes extends Migration { | class m190205_164612_ajout_produit_don_aux_distributions_existantes extends Migration { | ||||
public function up() { | public function up() { | ||||
$distributionsArray = common\logic\Distribution\Distribution\Distribution::find()->all() ; | |||||
foreach($distributionsArray as $distribution) { | |||||
} | |||||
} | } | ||||
public function down() { | public function down() { |
{ | { | ||||
public function up() | public function up() | ||||
{ | { | ||||
$producersArray = Producer::find()->all() ; | |||||
foreach($producersArray as $producer) { | |||||
$pointsSaleArray = PointSale::find() | |||||
->where([ | |||||
'id_producer' => $producer->id | |||||
]) | |||||
->all(); | |||||
foreach($pointsSaleArray as $pointSale) { | |||||
$usersArray = UserModel::find()->innerJoin( | |||||
'order', | |||||
'user.id = order.id_user AND order.id_point_sale = :id_point_sale', | |||||
[':id_point_sale' => $pointSale->id] | |||||
) | |||||
->groupBy('user.id') | |||||
->all(); | |||||
foreach($usersArray as $user) { | |||||
$userPointSale = UserPointSale::find() | |||||
->where([ | |||||
'id_user' => $user->id, | |||||
'id_point_sale' => $pointSale->id | |||||
])->one() ; | |||||
if(!$userPointSale) { | |||||
$userPointSale = new UserPointSale() ; | |||||
$userPointSale->id_user = $user->id ; | |||||
$userPointSale->id_point_sale = $pointSale->id ; | |||||
$userPointSale->save() ; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
public function down() | public function down() |
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\mysql\Schema; | use yii\db\mysql\Schema; | ||||
use common\logic\Subscription\ProductSubscription\ProductSubscription; | |||||
use common\logic\Product\Product\Product; | |||||
class m190515_122438_ajout_champs_price_product_subscription extends Migration { | class m190515_122438_ajout_champs_price_product_subscription extends Migration { | ||||
public function up() { | public function up() { | ||||
$this->addColumn('product_subscription', 'price', Schema::TYPE_FLOAT. ' DEFAULT 0') ; | $this->addColumn('product_subscription', 'price', Schema::TYPE_FLOAT. ' DEFAULT 0') ; | ||||
$productsSubscriptionsArray = ProductSubscription::find()->all() ; | |||||
$productsArray = Product::find()->all() ; | |||||
foreach($productsSubscriptionsArray as $productSubscription) { | |||||
foreach($productsArray as $product) { | |||||
if($productSubscription->id_product == $product->id) { | |||||
$productSubscription->price = $product->price ; | |||||
$productSubscription->save() ; | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
public function down() { | public function down() { |
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\mysql\Schema; | use yii\db\mysql\Schema; | ||||
use common\logic\Producer\Producer\Producer; | |||||
use common\logic\Producer\Producer\Model\Producer; | |||||
class m190522_091006_option_comportement_annulation_commande extends Migration { | class m190522_091006_option_comportement_annulation_commande extends Migration { | ||||
return false; | return false; | ||||
} | } | ||||
/* | |||||
// Use up()/down() to run migration code without a transaction. | |||||
public function up() | |||||
{ | |||||
} | |||||
public function down() | |||||
{ | |||||
echo "m200108_145508_module_bl_devis_factures_suppression_price_unit_step_product_subscription cannot be reverted.\n"; | |||||
return false; | |||||
} | |||||
*/ | |||||
} | } |
return 'false'; | return 'false'; | ||||
} | } | ||||
/* | |||||
// Use up()/down() to run migration code without a transaction. | |||||
public function up() | |||||
{ | |||||
} | |||||
public function down() | |||||
{ | |||||
echo "m200108_195657_module_bl_devis_factures_order_status_history cannot be reverted.\n"; | |||||
return false; | |||||
} | |||||
*/ | |||||
} | } |
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | use yii\db\Schema; | ||||
use common\logic\Document\Document\Document | |||||
use common\logic\Document\Document\Model\Document; | |||||
class m200109_092028_module_bl_devis_factures_champs_status_document extends Migration | class m200109_092028_module_bl_devis_factures_champs_status_document extends Migration | ||||
{ | { |
public function safeUp() | public function safeUp() | ||||
{ | { | ||||
$this->addColumn('order_status_history', 'origin', Schema::TYPE_STRING); | $this->addColumn('order_status_history', 'origin', Schema::TYPE_STRING); | ||||
} | } | ||||
public function safeDown() | public function safeDown() |
<?php | <?php | ||||
use common\logic\User\User\Model\User; | |||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | use yii\db\Schema; | ||||
{ | { | ||||
public function safeUp() | public function safeUp() | ||||
{ | { | ||||
$this->addColumn('user', 'type', Schema::TYPE_STRING.' DEFAULT \''.UserModel::TYPE_INDIVIDUAL.'\''); | |||||
$this->addColumn('user', 'type', Schema::TYPE_STRING.' DEFAULT \''.User::TYPE_INDIVIDUAL.'\''); | |||||
$this->addColumn('user', 'name_legal_person', Schema::TYPE_STRING) ; | $this->addColumn('user', 'name_legal_person', Schema::TYPE_STRING) ; | ||||
} | } | ||||
{ | { | ||||
public function safeUp() | public function safeUp() | ||||
{ | { | ||||
Order::updateAll([ | |||||
'status' => 'tmp-order' | |||||
]) ; | |||||
} | } | ||||
public function safeDown() | public function safeDown() |
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | use yii\db\Schema; | ||||
use common\logic\Producer\Producer\Producer; | |||||
use common\logic\Producer\Producer\Model\Producer; | |||||
class m200601_073309_add_producer_options extends Migration | class m200601_073309_add_producer_options extends Migration | ||||
{ | { |
return false; | return false; | ||||
} | } | ||||
/* | |||||
// Use up()/down() to run migration code without a transaction. | |||||
public function up() | |||||
{ | |||||
} | |||||
public function down() | |||||
{ | |||||
echo "m200624_083903_product_distribution_change_column_quantity_max cannot be reverted.\n"; | |||||
return false; | |||||
} | |||||
*/ | |||||
} | } |
<?php | <?php | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m201026_074711_option_email_confirm_producer extends Migration | class m201026_074711_option_email_confirm_producer extends Migration | ||||
{ | { |
<?php | <?php | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m201218_071628_add_option_export_csv extends Migration | class m201218_071628_add_option_export_csv extends Migration | ||||
{ | { |
<?php | <?php | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m201230_102708_add_option_export_csv extends Migration | class m201230_102708_add_option_export_csv extends Migration | ||||
{ | { |
<?php | <?php | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m210303_090805_add_group_user_specific_prices extends Migration | class m210303_090805_add_group_user_specific_prices extends Migration | ||||
{ | { |
<?php | <?php | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m210317_122616_option_order_reference_type extends Migration | class m210317_122616_option_order_reference_type extends Migration | ||||
{ | { |
<?php | <?php | ||||
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | |||||
class m210318_102840_add_option_allow_order_guest extends Migration | class m210318_102840_add_option_allow_order_guest extends Migration | ||||
{ | { |
$this->dropColumn('producer', 'option_stripe_public_key'); | $this->dropColumn('producer', 'option_stripe_public_key'); | ||||
$this->dropColumn('producer', 'option_stripe_private_key'); | $this->dropColumn('producer', 'option_stripe_private_key'); | ||||
} | } | ||||
/* | |||||
// Use up()/down() to run migration code without a transaction. | |||||
public function up() | |||||
{ | |||||
} | |||||
public function down() | |||||
{ | |||||
echo "m210914_132350_add_options_online_payment cannot be reverted.\n"; | |||||
return false; | |||||
} | |||||
*/ | |||||
} | } |
{ | { | ||||
$this->dropColumn('producer', 'option_stripe_endpoint_secret'); | $this->dropColumn('producer', 'option_stripe_endpoint_secret'); | ||||
} | } | ||||
/* | |||||
// Use up()/down() to run migration code without a transaction. | |||||
public function up() | |||||
{ | |||||
} | |||||
public function down() | |||||
{ | |||||
echo "m210915_064446_add_option_stripe_endpoint cannot be reverted.\n"; | |||||
return false; | |||||
} | |||||
*/ | |||||
} | } |
{ | { | ||||
$this->dropColumn('producer', 'option_stripe_mode_test'); | $this->dropColumn('producer', 'option_stripe_mode_test'); | ||||
} | } | ||||
/* | |||||
// Use up()/down() to run migration code without a transaction. | |||||
public function up() | |||||
{ | |||||
} | |||||
public function down() | |||||
{ | |||||
echo "m210915_083421_add_option_stripe_mode_test cannot be reverted.\n"; | |||||
return false; | |||||
} | |||||
*/ | |||||
} | } |
return false; | return false; | ||||
} | } | ||||
/* | |||||
// Use up()/down() to run migration code without a transaction. | |||||
public function up() | |||||
{ | |||||
} | |||||
public function down() | |||||
{ | |||||
echo "m220823_084928_add_option_notify_producer_order_summary cannot be reverted.\n"; | |||||
return false; | |||||
} | |||||
*/ | |||||
} | } |
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | use yii\db\Schema; | ||||
use common\logic\Producer\Producer\Producer; | |||||
use common\logic\Producer\Producer\Model\Producer; | |||||
/** | /** | ||||
* Class m220915_072309_producer_add_option_billing_frequency | * Class m220915_072309_producer_add_option_billing_frequency |
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | use yii\db\Schema; | ||||
use common\logic\Producer\Producer\Producer; | |||||
use common\logic\Producer\Producer\Model\Producer; | |||||
/** | /** | ||||
* Class m220915_083713_producer_add_options_billing | * Class m220915_083713_producer_add_options_billing |
use yii\db\Migration; | use yii\db\Migration; | ||||
use yii\db\Schema; | use yii\db\Schema; | ||||
use common\logic\Document\Document\Document; | |||||
use common\logic\Document\Document\Model\Document; | |||||
/** | /** | ||||
* Class m220916_062206_add_column_document_tax_calculation_method | * Class m220916_062206_add_column_document_tax_calculation_method |
{ | { | ||||
$this->dropColumn('producer', 'option_display_message_new_opendistrib_version'); | $this->dropColumn('producer', 'option_display_message_new_opendistrib_version'); | ||||
} | } | ||||
/* | |||||
// Use up()/down() to run migration code without a transaction. | |||||
public function up() | |||||
{ | |||||
} | |||||
public function down() | |||||
{ | |||||
echo "m221109_100033_producer_add_option_display_message_new_opendistrib_version cannot be reverted.\n"; | |||||
return false; | |||||
} | |||||
*/ | |||||
} | } |