Procházet zdrojové kódy

ajout des status de commande ds param #155

dev
Fab před 4 roky
rodič
revize
faa7768ef4
14 změnil soubory, kde provedl 276 přidání a 254 odebrání
  1. +0
    -1
      backend/views/layouts/left.php
  2. +0
    -89
      backend/views/tax-rate-admin/billing.php
  3. +53
    -1
      common/config/params.php
  4. +3
    -8
      common/models/Order.php
  5. +0
    -58
      common/models/OrderStatus.php
  6. +84
    -0
      common/models/OrderStatusHistory.php
  7. +8
    -8
      console/migrations/m200106_143017_module_devis_bl_factures_modification_champs_id_status_order.php
  8. +4
    -4
      console/migrations/m200107_095559_module_bl_devis_factures_modification_champs_delivery_note.php
  9. +10
    -10
      console/migrations/m200107_101930_module_devis_bl_facture_suppression_champs_delivery_note.php
  10. +9
    -9
      console/migrations/m200107_140622_module_bl_devis_factures_modification_champ_taxrate.php
  11. +18
    -18
      console/migrations/m200108_091551_module_bl_devis_factures_suppression_champs_documents.php
  12. +20
    -20
      console/migrations/m200108_101042_module_bl_devis_factures_modification_champs_documents.php
  13. +28
    -28
      console/migrations/m200108_145508_module_bl_devis_factures_suppression_price_unit_step_product_subscription.php
  14. +39
    -0
      console/migrations/m200108_195657_module_bl_devis_factures_order_status_history.php

+ 0
- 1
backend/views/layouts/left.php Zobrazit soubor

@@ -81,7 +81,6 @@ termes.
['label' => 'Administration', 'options' => ['class' => 'header'], 'visible' => User::isCurrentAdmin()],
['label' => 'Producteurs','icon' => 'th-list','url' => ['/producer-admin/index'], 'visible' => User::isCurrentAdmin()],
['label' => 'Taxes','icon' => 'eur','url' => ['/tax-rate-admin/index'], 'visible' => User::isCurrentAdmin()],
['label' => 'Statuts commande','icon' => 'tags','url' => ['/order-status-admin/index'], 'visible' => User::isCurrentAdmin()],
['label' => 'Communiquer','icon' => 'bullhorn','url' => ['/communicate-admin/index'], 'visible' => User::isCurrentAdmin()],
['label' => 'Outils', 'options' => ['class' => 'header'], 'visible' => User::isCurrentAdmin()],

+ 0
- 89
backend/views/tax-rate-admin/billing.php Zobrazit soubor

@@ -1,89 +0,0 @@
<?php

/**
Copyright distrib (2018)

contact@opendistrib.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\User ;
use common\models\Etablissement ;

$this->title = 'Facturation';
$this->params['breadcrumbs'][] = 'Administration' ;
$this->params['breadcrumbs'][] = $this->title;

?>

<h1>Facturation</h1>

<?= GridView::widget([
'dataProvider' => $datas_factures,
'columns' => [
[
'attribute' => 'reference',
'label' => 'Référence',
],
[
'attribute' => 'id_producer',
'label' => 'Producteur',
'value' => function($model) {
return Html::encode($model->producer->name) ;
}
],
'libelle',
[
'attribute' => 'amount_ht',
'label' => 'Montant',
'value' => function($model) {
return number_format($model->amount_ht,2).' €' ;
}
],
[
'attribute' => 'paid',
'label' => 'Payé',
'format' => 'raw',
'value' => function($model) {
if($model->paid)
{
return '<span class="label label-success">Oui</span>' ;
}
else {
return '<span class="label label-danger">Non</span>' ;
}
}
]
],
]); ?>

+ 53
- 1
common/config/params.php Zobrazit soubor

@@ -40,5 +40,57 @@ return [
'adminEmail' => 'contact@opendistrib.net',
'supportEmail' => 'contact@opendistrib.net',
'user.passwordResetTokenExpire' => 3600,
'producer' => false
'producer' => false,
'orderStatus' => [
'new-order' => [
'name' => 'Nouvelle commande',
'color' => '#14c40e',
'nextStatusAllow' => ['waiting-paiement-on-delivery', 'waiting-paiement-by-credit', 'canceled'],
'slug' => 'new-order'
],
'waiting-paiement-on-delivery' => [
'name' => 'En attente de paiement à la livraison',
'color' => '#e19a4d',
'nextStatusAllow' => ['delivered', 'canceled'],
'slug' => 'waiting-paiement-on-delivery'
],
'waiting-paiement-by-credit' => [
'name' => 'En attente de paiement par crédit',
'color' => '#e19a4d',
'nextStatusAllow' => ['paid-by-credit', 'canceled'],
'slug' => 'waiting-paiement-by-credit'
],
'paid-by-credit' => [
'name' => 'Payé par crédit',
'color' => '#3180d5',
'nextStatusAllow' => ['waiting-delivery'],
'slug' => 'paid-by-credit'
],
'waiting-delevery'=>[
'name' => 'En attente de livraison',
'color' => '#d5bb31',
'nextStatusAllow' => ['delivered', 'refunded'],
'slug' => 'new-order'
],
'delivered' => [
'name' => 'Livré',
'color' => '#36d531',
'nextStatusAllow' => [],
'slug' => 'new-order'
],
'refunded' => [
'name' => 'Remboursé',
'color' => '#d01d14',
'nextStatusAllow' => ['canceled'],
'slug' => 'refunded'
],
'cancel' => [
'name' => 'Commande annulée',
'color' => '#d01d14',
'nextStatusAllow' => [],
'slug' => 'cancel'
]

]

];

+ 3
- 8
common/models/Order.php Zobrazit soubor

@@ -92,8 +92,8 @@ class Order extends ActiveRecordCommon
public function rules()
{
return [
[['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''],
[['id_user', 'id_point_sale', 'id_distribution', 'id_subscription', 'id_order_status', 'id_invoice', 'id_quotation', 'id_delivery_note'], 'integer'],
[['id_user', 'date', 'id_point_sale', 'id_distribution', 'status'], 'required', 'message' => ''],
[['id_user', 'id_point_sale', 'id_distribution', 'id_subscription', 'id_invoice', 'id_quotation', 'id_delivery_note'], 'integer'],
[['auto_payment', 'tiller_synchronization'], 'boolean'],
[['date', 'date_update', 'comment', 'comment_point_sale', 'mean_payment'], 'safe']
];
@@ -112,7 +112,7 @@ class Order extends ActiveRecordCommon
'id_point_sale' => 'Point de vente',
'id_distribution' => 'Date de distribution',
'id_subscription' => 'Abonnement',
'id_order_status' => 'Statut',
'status' => 'Statut',
'id_invoice' => 'Facture',
'id_quotation' => 'Devis',
'id_delivery_note' => 'Bon de livraison'
@@ -157,11 +157,6 @@ class Order extends ActiveRecordCommon
->with('productSubscription');
}

public function getOrderOrderStatus()
{
return $this->hasMany(OrderOrderStatus::className(), ['id_order' => 'id'])->with('orderStatus');
}

public function getInvoice()
{
return $this->hasOne(Invoice::className(), ['id' => 'id_invoice']);

+ 0
- 58
common/models/OrderStatus.php Zobrazit soubor

@@ -1,58 +0,0 @@
<?php

namespace common\models;

use common\components\ActiveRecordCommon;
use Yii;

/**
* This is the model class for table "order_status".
*
* @property integer $id
* @property string $name
*/
class OrderStatus extends ActiveRecordCommon
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'order_status';
}

/**
* @inheritdoc
*/
public function rules()
{
return [
[['name'], 'string', 'max' => 255],
];
}

/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Nom',
];
}
/**
* Retourne les options de base nécessaires à la fonction de recherche.
*
* @return array
*/
public static function defaultOptionsSearch() {
return [
'with' => [],
'join_with' => ['user', 'order'],
'orderby' => 'id ASC',
'attribute_id_producer' => ''
] ;
}
}

+ 84
- 0
common/models/OrderStatusHistory.php Zobrazit soubor

@@ -0,0 +1,84 @@
<?php

namespace common\models;

use common\components\ActiveRecordCommon;
use Yii;

/**
* This is the model class for table "order_order_status".
*
* @property integer $id
* @property integer $id_order
* @property integer $id_order_status
* @property string $date
*/
class OrderStatusHistory extends ActiveRecordCommon
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'order_status_history';
}

/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_order', 'status', 'id_user',], 'integer'],
[['date'], 'safe'],
];
}

/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'id_order' => 'Commande',
'id_user' => 'Utilisateur',
'status' => 'Statut',
'date' => 'Date',
];
}

/*
* Relations
*/

public function getOrder()
{
return $this->hasOne(User::className(), ['id' => 'id_order']);
}

public function getOrderStatus()
{
return $this->hasOne(OrderStatus::className(), ['id' => 'id_order_status']);
}

public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'id_user']);
}

/**
* Retourne les options de base nécessaires à la fonction de recherche.
*
* @return array
*/
public static function defaultOptionsSearch()
{
return [
'with' => [],
'join_with' => ['order', 'orderStatus'],
'orderby' => 'date ASC',
'attribute_id_producer' => ''
];
}
}

+ 8
- 8
console/migrations/m200106_143017_module_devis_bl_factures_modification_champs_id_status_order.php Zobrazit soubor

@@ -5,13 +5,13 @@ use yii\db\Schema;

class m200106_143017_module_devis_bl_factures_modification_champs_id_status_order extends Migration
{
public function safeUp()
{
$this->dropColumn('order', 'id_status') ;
}
public function safeUp()
{
$this->dropColumn('order', 'id_status');
}

public function safeDown()
{
$this->addColumn('order', 'id_status', Schema::TYPE_INTEGER) ;
}
public function safeDown()
{
$this->addColumn('order', 'id_status', Schema::TYPE_INTEGER);
}
}

+ 4
- 4
console/migrations/m200107_095559_module_bl_devis_factures_modification_champs_delivery_note.php Zobrazit soubor

@@ -9,15 +9,15 @@ class m200107_095559_module_bl_devis_factures_modification_champs_delivery_note
public function safeUp()
{
$this->dropColumn('delivery_note', 'id_point_sale_distribution');
$this->addColumn('delivery_note', 'id_point_sale', Schema::TYPE_INTEGER) ;
$this->addColumn('delivery_note', 'id_distribution', Schema::TYPE_INTEGER) ;
$this->addColumn('delivery_note', 'id_point_sale', Schema::TYPE_INTEGER);
$this->addColumn('delivery_note', 'id_distribution', Schema::TYPE_INTEGER);
}

public function safeDown()
{
$this->addColumn('delivery_note', 'id_point_sale_distribution', Schema::TYPE_INTEGER);
$this->dropColumn('delivery_note', 'id_point_sale') ;
$this->dropColumn('delivery_note', 'id_distribution') ;
$this->dropColumn('delivery_note', 'id_point_sale');
$this->dropColumn('delivery_note', 'id_distribution');
}

}

+ 10
- 10
console/migrations/m200107_101930_module_devis_bl_facture_suppression_champs_delivery_note.php Zobrazit soubor

@@ -5,15 +5,15 @@ use yii\db\Schema;

class m200107_101930_module_devis_bl_facture_suppression_champs_delivery_note extends Migration
{
public function safeUp()
{
$this->dropColumn('delivery_note', 'id_point_sale') ;
$this->dropColumn('delivery_note', 'id_distribution') ;
}
public function safeUp()
{
$this->dropColumn('delivery_note', 'id_point_sale');
$this->dropColumn('delivery_note', 'id_distribution');
}

public function safeDown()
{
$this->addColumn('delivery_note', 'id_point_sale', Schema::TYPE_INTEGER) ;
$this->addColumn('delivery_note', 'id_distribution', Schema::TYPE_INTEGER) ;
}
public function safeDown()
{
$this->addColumn('delivery_note', 'id_point_sale', Schema::TYPE_INTEGER);
$this->addColumn('delivery_note', 'id_distribution', Schema::TYPE_INTEGER);
}
}

+ 9
- 9
console/migrations/m200107_140622_module_bl_devis_factures_modification_champ_taxrate.php Zobrazit soubor

@@ -5,16 +5,16 @@ use yii\db\Schema;

class m200107_140622_module_bl_devis_factures_modification_champ_taxrate extends Migration
{
public function safeUp()
{
$this->renameColumn('tax_rate', 'pourcent', 'value');
public function safeUp()
{
$this->renameColumn('tax_rate', 'pourcent', 'value');

}
}

public function safeDown()
{
$this->renameColumn('tax_rate', 'value', 'pourcent');
public function safeDown()
{
$this->renameColumn('tax_rate', 'value', 'pourcent');

}

}
}

+ 18
- 18
console/migrations/m200108_091551_module_bl_devis_factures_suppression_champs_documents.php Zobrazit soubor

@@ -5,23 +5,23 @@ use yii\db\Schema;

class m200108_091551_module_bl_devis_factures_suppression_champs_documents extends Migration
{
public function safeUp()
{
$this->dropColumn('invoice', 'city') ;
$this->dropColumn('invoice', 'postcode') ;
$this->dropColumn('quotation', 'city') ;
$this->dropColumn('quotation', 'postcode') ;
$this->dropColumn('delivery_note', 'city') ;
$this->dropColumn('delivery_note', 'postcode') ;
}
public function safeUp()
{
$this->dropColumn('invoice', 'city');
$this->dropColumn('invoice', 'postcode');
$this->dropColumn('quotation', 'city');
$this->dropColumn('quotation', 'postcode');
$this->dropColumn('delivery_note', 'city');
$this->dropColumn('delivery_note', 'postcode');
}

public function safeDown()
{
$this->addColumn('invoice', 'city', Schema::TYPE_STRING) ;
$this->addColumn('invoice', 'postcode', Schema::TYPE_STRING) ;
$this->addColumn('quotation', 'city', Schema::TYPE_STRING) ;
$this->addColumn('quotation', 'postcode', Schema::TYPE_STRING) ;
$this->addColumn('delivery_note', 'city', Schema::TYPE_STRING) ;
$this->addColumn('delivery_note', 'postcode', Schema::TYPE_STRING) ;
}
public function safeDown()
{
$this->addColumn('invoice', 'city', Schema::TYPE_STRING);
$this->addColumn('invoice', 'postcode', Schema::TYPE_STRING);
$this->addColumn('quotation', 'city', Schema::TYPE_STRING);
$this->addColumn('quotation', 'postcode', Schema::TYPE_STRING);
$this->addColumn('delivery_note', 'city', Schema::TYPE_STRING);
$this->addColumn('delivery_note', 'postcode', Schema::TYPE_STRING);
}
}

+ 20
- 20
console/migrations/m200108_101042_module_bl_devis_factures_modification_champs_documents.php Zobrazit soubor

@@ -5,26 +5,26 @@ use yii\db\Schema;

class m200108_101042_module_bl_devis_factures_modification_champs_documents extends Migration
{
public function safeUp()
{
$this->addColumn('invoice', 'id_producer', Schema::TYPE_INTEGER) ;
$this->addColumn('quotation', 'id_producer', Schema::TYPE_INTEGER) ;
$this->addColumn('delivery_note', 'id_producer', Schema::TYPE_INTEGER) ;
$this->alterColumn('invoice', 'date', Schema::TYPE_DATETIME.' DEFAULT CURRENT_TIMESTAMP') ;
$this->alterColumn('delivery_note', 'date', Schema::TYPE_DATETIME.' DEFAULT CURRENT_TIMESTAMP') ;
$this->alterColumn('quotation', 'date', Schema::TYPE_DATETIME.' DEFAULT CURRENT_TIMESTAMP') ;
}
public function safeUp()
{
$this->addColumn('invoice', 'id_producer', Schema::TYPE_INTEGER);
$this->addColumn('quotation', 'id_producer', Schema::TYPE_INTEGER);
$this->addColumn('delivery_note', 'id_producer', Schema::TYPE_INTEGER);

public function safeDown()
{
$this->dropColumn('invoice', 'id_producer') ;
$this->dropColumn('delivery_note', 'id_producer') ;
$this->dropColumn('quotation', 'id_producer') ;
$this->alterColumn('invoice', 'date', Schema::TYPE_DATETIME) ;
$this->alterColumn('delivery_note', 'date', Schema::TYPE_DATETIME) ;
$this->alterColumn('quotation', 'date', Schema::TYPE_DATETIME) ;
}
$this->alterColumn('invoice', 'date', Schema::TYPE_DATETIME . ' DEFAULT CURRENT_TIMESTAMP');
$this->alterColumn('delivery_note', 'date', Schema::TYPE_DATETIME . ' DEFAULT CURRENT_TIMESTAMP');
$this->alterColumn('quotation', 'date', Schema::TYPE_DATETIME . ' DEFAULT CURRENT_TIMESTAMP');
}

public function safeDown()
{
$this->dropColumn('invoice', 'id_producer');
$this->dropColumn('delivery_note', 'id_producer');
$this->dropColumn('quotation', 'id_producer');

$this->alterColumn('invoice', 'date', Schema::TYPE_DATETIME);
$this->alterColumn('delivery_note', 'date', Schema::TYPE_DATETIME);
$this->alterColumn('quotation', 'date', Schema::TYPE_DATETIME);
}

}

+ 28
- 28
console/migrations/m200108_145508_module_bl_devis_factures_suppression_price_unit_step_product_subscription.php Zobrazit soubor

@@ -4,32 +4,32 @@ use yii\db\Migration;

class m200108_145508_module_bl_devis_factures_suppression_price_unit_step_product_subscription extends Migration
{
public function safeUp()
{
$this->dropColumn('product_subscription', 'unit') ;
$this->dropColumn('product_subscription', 'step') ;
$this->dropColumn('product_subscription', 'price') ;
}
public function safeDown()
{
echo "m200108_145508_module_bl_devis_factures_suppression_price_unit_step_product_subscription cannot be reverted.\n";
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;
}
*/
public function safeUp()
{
$this->dropColumn('product_subscription', 'unit');
$this->dropColumn('product_subscription', 'step');
$this->dropColumn('product_subscription', 'price');
}
public function safeDown()
{
echo "m200108_145508_module_bl_devis_factures_suppression_price_unit_step_product_subscription cannot be reverted.\n";
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;
}
*/
}

+ 39
- 0
console/migrations/m200108_195657_module_bl_devis_factures_order_status_history.php Zobrazit soubor

@@ -0,0 +1,39 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

class m200108_195657_module_bl_devis_factures_order_status_history extends Migration
{
public function safeUp()
{
$this->delete('order_status');
$this->renameTable('order_order_status', 'order_status_history');
$this->addColumn('order_status_history', 'id_user', Schema::TYPE_INTEGER);
$this->addColumn('order', 'status', Schema::TYPE_STRING);
$this->renameColumn('order_status_history', 'id_order_status', 'status');
$this->alterColumn('order_status_history', 'status', Schema::TYPE_STRING);
}

public function safeDown()
{
echo "m200108_195657_module_bl_devis_factures_order_status_history cannot be reverted.\n";

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;
}
*/
}

Načítá se…
Zrušit
Uložit