app/models/adherent/query_member.rb in adherent-0.3.3 vs app/models/adherent/query_member.rb in adherent-0.3.4
- old
+ new
@@ -24,10 +24,15 @@
column :organism_id, :integer
column :number, :string
column :name, :string
column :mail, :string
column :tel, :string
+ column :gsm, :string
+ column :office, :string
+ column :address, :string
+ column :zip, :string
+ column :city, :string
column :forname, :string
column :birthdate, :date
column :m_to_date, :date
column :t_adhesions, :decimal
column :t_reglements, :decimal
@@ -42,11 +47,17 @@
montant_du <= 0.001
end
def self.query_sql(organism)
%Q(SELECT adherent_members.id, organism_id, number, name, forname, birthdate,
- adherent_coords.mail AS mail, adherent_coords.tel AS tel,
+ adherent_coords.mail AS mail,
+ adherent_coords.tel AS tel,
+ adherent_coords.gsm AS gsm,
+ adherent_coords.office AS office,
+ adherent_coords.address AS address,
+ adherent_coords.zip AS zip,
+ adherent_coords.city AS city,
(SELECT to_date FROM adherent_adhesions
WHERE adherent_adhesions.member_id = adherent_members.id
ORDER BY to_date DESC LIMIT 1 ) AS m_to_date,
(SELECT SUM(adherent_reglements.amount) FROM adherent_reglements,
adherent_adhesions
@@ -84,12 +95,13 @@
# transmis en argument
def self.to_csv(organism, options = {col_sep:"\t"})
ms = query_members(organism)
CSV.generate(options) do |csv|
csv << ['Numero', 'Nom', 'Prénom', 'Date de naissance',
- 'Mail', 'Tél', 'Doit', 'Fin Adh.']
- ms.each do |m|
+ 'Mail', 'Tél', 'Gsm', 'Bureau', 'Adresse', 'Code Postal', 'Ville', 'Doit', 'Fin Adh.']
+ ms.each do |m|
csv << [m.number, m.name, m.forname, m.birthdate, m.mail, m.tel,
+ m.gsm, m.office, m.address, m.zip, m.city,
ActiveSupport::NumberHelper.number_to_rounded(m.montant_du, precision:2),
m.m_to_date]
end
end
end
\ No newline at end of file