suite
This commit is contained in:
parent
e6260010a4
commit
f4ccdc82dc
@ -72,11 +72,20 @@ class Admin::MOdrRepRibsController < ApplicationController
|
||||
|
||||
def send_mail
|
||||
@m_odr_rep_rib = MOdrRepRib.find(params[:id])
|
||||
@m_odr_rep = @m_odr_rep_rib.m_odr_rep
|
||||
|
||||
@m_odr_rep.send_mail_type("erreur-coordonnees-bancaire", @m_odr_rep_rib)
|
||||
@m_odr_rep_rib.mail_sended = true
|
||||
@m_odr_rep_rib.save
|
||||
|
||||
redirect_to [:admin, @m_odr_rep]
|
||||
@p_customer = @m_odr_rep_rib.p_customer
|
||||
|
||||
|
||||
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, params[:slug].to_s, @p_customer.email, {:arguments => {}, :p_customer => @p_customer, :element => @m_odr_rep_rib})
|
||||
|
||||
|
||||
|
||||
#redirect_to [:admin, @m_odr_rep]
|
||||
|
||||
|
||||
end
|
||||
|
@ -7,11 +7,32 @@ class Admin::PCustomersController < ApplicationController
|
||||
before_action :admin_space
|
||||
|
||||
|
||||
|
||||
def send_mail
|
||||
@p_customer = PCustomer.find(params[:id])
|
||||
|
||||
if params[:slug] == "stickers-manque-adresse"
|
||||
@p_customer.particular_mail_sended = true
|
||||
|
||||
@p_customer.save
|
||||
|
||||
end
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, params[:slug].to_s, @p_customer.email, {:arguments => {}, :p_customer => @p_customer, :element => @p_customer})
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def archive_import
|
||||
@p_customer = PCustomer.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def import3
|
||||
if false #params[:force]
|
||||
require "csv"
|
||||
@ -449,10 +470,17 @@ class Admin::PCustomersController < ApplicationController
|
||||
if @p_customer.npai
|
||||
@p_customer.npai = false
|
||||
message = "NPAI levé"
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "stickers-npai-a-jour", @p_customer.email, {:arguments => {}, :p_customer => @p_customer, :element => @p_customer})
|
||||
|
||||
|
||||
else
|
||||
@p_customer.npai = true
|
||||
message = "NPAI signalé"
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "stickers-npai", @p_customer.email, {:arguments => {}, :p_customer => @p_customer, :element => @p_customer})
|
||||
|
||||
|
||||
end
|
||||
|
||||
@p_customer.save
|
||||
|
@ -56,7 +56,7 @@ class Public::MOdrRepRibsController < ApplicationController
|
||||
|
||||
if @m_odr_rep_rib.update_attributes(params.require(:m_odr_rep_rib).permit!)
|
||||
@m_odr_rep_rib.admin_ok = nil
|
||||
|
||||
@m_odr_rep_rib.mail_sended = false
|
||||
@m_odr_rep_rib.save
|
||||
redirect_to public_my_account_path, :notice => "Votre RIB a bien été modifié"
|
||||
else
|
||||
|
@ -48,11 +48,26 @@ class Public::ParticularsController < ApplicationController
|
||||
|
||||
|
||||
def update
|
||||
|
||||
allready_fill = current_p_customer.particular_fill?
|
||||
|
||||
|
||||
|
||||
|
||||
@particular = current_p_customer.particulars.find(params[:id])
|
||||
|
||||
|
||||
if @particular.update_attributes(params.require(:particular).permit!)
|
||||
|
||||
|
||||
if !allready_fill and pc = PCustomer.find(current_p_customer.id) and pc.particular_fill? and !pc.particular_thankable
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "utilisateur-remerciement-infos", current_p_customer.email, {:arguments => {}, :p_customer => current_p_customer, :element => current_p_customer})
|
||||
|
||||
current_p_customer.particular_thankable = true
|
||||
current_p_customer.save
|
||||
end
|
||||
|
||||
redirect_to public_my_account_path
|
||||
|
||||
|
||||
|
@ -261,6 +261,7 @@ class PCustomer < ApplicationRecord
|
||||
:test_user => "Utilisateur test ?",
|
||||
:npai => "NPAI ?",
|
||||
:sticker => "Stickers envoyés ?",
|
||||
:particular_fill => "Adresse remplie ?",
|
||||
:parent => "Ambassadeur",
|
||||
|
||||
|
||||
@ -269,6 +270,8 @@ class PCustomer < ApplicationRecord
|
||||
:particular_city => "Ville",
|
||||
:particular_country => "Pays",
|
||||
|
||||
|
||||
|
||||
:email => "Email",
|
||||
:tel => "Téléphone",
|
||||
:actions => "Actions"
|
||||
@ -285,7 +288,7 @@ class PCustomer < ApplicationRecord
|
||||
|
||||
|
||||
def particular_fill?
|
||||
true if self.particular.firstname? and self.particular.name? and self.particular.address2? and self.particular.cp? and self.particular.city?
|
||||
true if self.particular.firstname? and self.particular.name? and self.particular.address_2? and self.particular.cp? and self.particular.city?
|
||||
end
|
||||
|
||||
before_destroy do
|
||||
|
@ -65,8 +65,16 @@
|
||||
|
||||
%td
|
||||
=m_odr_file_roulage.m_event.title if m_odr_file_roulage.m_event
|
||||
-if @m_odr_file.m_odr_file_type_id == 2
|
||||
=link_to ic(:envelope)+"Envoyer un mail demandant la facture de roulage", send_mail_admin_m_odr_file_path(@m_odr_file, :slug => "achat-manque-roulage"), :remote => false, :class => "btn btn-primary", :style => "margin-bottom:4px;"
|
||||
-if @m_odr_file.admin_ok == true
|
||||
-if @m_odr_file.m_odr_file_type_id == 2
|
||||
=link_to ic(:envelope)+"Envoyer un mail demandant la facture de roulage", send_mail_admin_m_odr_file_path(@m_odr_file, :slug => "achat-manque-roulage"), :remote => false, :class => "btn btn-primary", :style => "margin-bottom:4px;"
|
||||
|
||||
-else
|
||||
-slugs = MailType.where(:mail_type_cat_id => 4).map{|m| m.slug}
|
||||
|
||||
-slugs.each do |slug|
|
||||
%br
|
||||
=link_to ic(:envelope)+" #{slug}", send_mail_admin_m_odr_file_path(@m_odr_file, :slug => slug), :remote => false, :class => "btn btn-primary", :style => "margin-bottom:4px;"
|
||||
|
||||
|
||||
-if @m_odr_file.admin_ok == false
|
||||
@ -85,6 +93,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#show{:style => "margin-left:31%;"}
|
||||
=link_to ic(:download)+" Télécharger le document", download_admin_m_odr_file_path(@m_odr_file, :disposition => "attachment")
|
||||
|
||||
|
@ -18,6 +18,13 @@
|
||||
=state_helper("Refusé")
|
||||
|
||||
|
||||
-if !m_odr_rep_rib.mail_sended
|
||||
|
||||
-slug = "erreur-coordonnees-bancaire"
|
||||
=link_to ic(:envelope)+" #{slug}", send_mail_admin_m_odr_rep_rib_path(m_odr_rep_rib, :slug => slug), :remote => true, :class => "btn btn-primary"
|
||||
|
||||
|
||||
|
||||
-tr[:actions] = capture do
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), [:admin, m_odr_rep_rib], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
|
2
app/views/admin/m_odr_rep_ribs/send_mail.js.erb
Normal file
2
app/views/admin/m_odr_rep_ribs/send_mail.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#m_odr_rep_rib_row_<%= @m_odr_rep_rib.id %>').replaceWith("<%= escape_javascript(render(@m_odr_rep_rib))%>");
|
||||
close_pane_hover();
|
@ -67,6 +67,17 @@
|
||||
-if p_customer.particular
|
||||
= p_customer.particular.firstname
|
||||
|
||||
-tr[:particular_fill] = capture do
|
||||
%td
|
||||
-if p_customer.particular_fill?
|
||||
Oui
|
||||
-elsif p_customer.particular_mail_sended == false
|
||||
-slug = "stickers-manque-adresse"
|
||||
=link_to ic(:envelope)+" #{slug}", send_mail_admin_p_customer_path(p_customer, :slug => slug), :remote => true, :class => "btn btn-primary"
|
||||
|
||||
-else
|
||||
Non (mail déjà envoyé)
|
||||
|
||||
|
||||
|
||||
|
||||
|
2
app/views/admin/p_customers/send_mail.js.erb
Normal file
2
app/views/admin/p_customers/send_mail.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#p_customer_<%= @p_customer.id %>').replaceWith("<%= escape_javascript(render(@p_customer))%>");
|
||||
close_pane_hover();
|
@ -863,6 +863,7 @@ Rails.application.routes.draw do
|
||||
get :npai
|
||||
get :toggle_npai
|
||||
get :ask_particular
|
||||
get :send_mail
|
||||
end
|
||||
|
||||
collection do
|
||||
|
@ -0,0 +1,5 @@
|
||||
class AddErrorMailSendedToMOdrRepRibs < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :m_odr_rep_ribs, :mail_sended, :boolean, :default => false
|
||||
end
|
||||
end
|
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_07_22_123358) do
|
||||
ActiveRecord::Schema.define(version: 2020_07_23_090815) do
|
||||
|
||||
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||
t.string "name"
|
||||
@ -919,6 +919,7 @@ ActiveRecord::Schema.define(version: 2020_07_22_123358) do
|
||||
t.string "reject_reason"
|
||||
t.text "reject_reason_description"
|
||||
t.integer "p_customer_id"
|
||||
t.boolean "mail_sended", default: false
|
||||
t.index ["admin_id"], name: "index_m_odr_rep_ribs_on_admin_id"
|
||||
end
|
||||
|
||||
|
1224
import_csv/stickers.csv
Normal file
1224
import_csv/stickers.csv
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,33 @@
|
||||
namespace :qi do
|
||||
desc "TODO"
|
||||
|
||||
task import_stickers: :environment do
|
||||
@file = "#{Rails.root}/import_csv/stickers.csv"
|
||||
|
||||
require 'csv'
|
||||
|
||||
csv_text = File.read(@file, :encoding => 'UTF-8')
|
||||
@csv = CSV.parse(csv_text, :headers => true, :col_sep => ";")
|
||||
|
||||
@csv.each do |csv|
|
||||
|
||||
|
||||
if p_customer = PCustomer.joins(:particular).where("particulars.name = ? and particulars.firstname = ?", csv[0], csv["prenom"]).first
|
||||
p_customer.sticker = true
|
||||
p_customer.save
|
||||
else
|
||||
|
||||
puts csv[0].to_s+ " "+csv["prenom"]
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
puts "Fin de l'import"
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
task migrate_all: :environment do
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user