This commit is contained in:
Nicolas Bally 2020-06-25 15:59:02 +02:00
parent c9dd9d8501
commit 2f57a75117
5 changed files with 34 additions and 10 deletions

View File

@ -80,10 +80,15 @@ class PCustomer < ApplicationRecord
self.m_odr_rep_ribs.create(:bic => self.imp_bic, :iban => self.imp_iban, :admin_ok => true) self.m_odr_rep_ribs.create(:bic => self.imp_bic, :iban => self.imp_iban, :admin_ok => true)
end end
if self.imp_test == "oui"
self.test_user = true
end
if self.particular if self.particular
part = self.particular part = self.particular
else else
part = Particular.new part = Particular.new
part.owner = self
end end
part.name = self.imp_name part.name = self.imp_name
part.firstname = self.imp_firstname part.firstname = self.imp_firstname
@ -129,7 +134,9 @@ class PCustomer < ApplicationRecord
end end
#after_create :do_import after_create do
do_import() if self.imp_email?
end
after_update do after_update do
#self.do_import if self.refresh_import #self.do_import if self.refresh_import

View File

@ -20,18 +20,27 @@
.row.qi_cancel_margins .row.qi_cancel_margins
.col-sm-4 .col-sm-2
= form.input :parent_id, :label => "Ambassadeur :", :include_blank => true, :collection => PCustomer.where(:ambassadeur => true).all, :as => :select, :member_label => :member_label = form.input :parent_id, :label => "Ambassadeur :", :include_blank => true, :collection => PCustomer.where(:ambassadeur => true).all, :as => :select, :member_label => :member_label
.col-sm-4 .col-sm-2
%br %br
= form.input :enabled, :label => "Utilisateur actif ?", :as => :boolean, :input_html => {:id => ""} = form.input :enabled, :label => "Utilisateur actif ?", :as => :boolean
.col-sm-4 .col-sm-2
%br %br
= form.input :ambassadeur, :label => "Ambassadeur ?", :as => :boolean, :input_html => {:id => ""} = form.input :ambassadeur, :label => "Ambassadeur ?", :as => :boolean
.col-sm-2
%br
= form.input :sticker, :label => "Sticker envoyés ?"
.col-sm-2
%br
= form.input :test_user, :label => "Client test ?", :as => :boolean
= form.input :tel, :label => "Tel :" = form.input :tel, :label => "Tel :"
= form.input :email, :label => "Email (login) :" = form.input :email, :label => "Email (login) :"
@ -66,7 +75,7 @@
= form.input :nbr_roulages, :label => "Nombre de roulage :", :include_blank => true, :collection => PCustomer::NBR_ROULAGES, :as => :select = form.input :nbr_roulages, :label => "Nombre de roulage :", :include_blank => true, :collection => PCustomer::NBR_ROULAGES, :as => :select
.col-sm-2 .col-sm-2
= form.input :sticker, :label => "Sticker envoyés ?"

View File

@ -39,7 +39,7 @@
.center_programme .center_programme
.block_num .block_num
%span.chiffre %span.chiffre
=PCustomer.where(:enabled => true).count =PCustomer.where(:enabled => true, :test_user => false).count
%span.label-chiffre Membres %span.label-chiffre Membres
.block_num .block_num
%span.chiffre %span.chiffre

View File

@ -0,0 +1,7 @@
class AddTestUserToPCustomers < ActiveRecord::Migration[6.0]
def change
add_column :p_customers, :test_user, :boolean, :default => false
PCustomer.where(:imp_test => "oui").update_all :test_user => true
end
end

View File

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_06_24_140026) do ActiveRecord::Schema.define(version: 2020_06_25_135439) do
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "name" t.string "name"
@ -1722,6 +1722,7 @@ ActiveRecord::Schema.define(version: 2020_06_24_140026) do
t.string "imp_demande_info" t.string "imp_demande_info"
t.date "imp_creation" t.date "imp_creation"
t.date "imp_modification" t.date "imp_modification"
t.boolean "test_user", default: false
t.index ["market_discount_id"], name: "index_p_customers_on_market_discount_id" t.index ["market_discount_id"], name: "index_p_customers_on_market_discount_id"
t.index ["p_customer_cat_id"], name: "index_p_customers_on_p_customer_cat_id" t.index ["p_customer_cat_id"], name: "index_p_customers_on_p_customer_cat_id"
t.index ["particular_id"], name: "index_p_customers_on_particular_id" t.index ["particular_id"], name: "index_p_customers_on_particular_id"