adherent 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/adherent/application_helper.rb +4 -1
- data/app/helpers/adherent/payments_helper.rb +21 -6
- data/app/models/adherent/payment.rb +3 -5
- data/lib/adherent/version.rb +2 -1
- data/spec/dummy/log/development.log +20 -0
- data/spec/dummy/log/test.log +95991 -0
- data/spec/features/adhesions_spec.rb +1 -1
- data/spec/features/payments_spec.rb +1 -1
- data/spec/features/reglements_spec.rb +12 -24
- data/spec/models/adherent/adhesion_spec.rb +2 -1
- data/spec/models/adherent/member_spec.rb +6 -11
- data/spec/models/adherent/payment_spec.rb +16 -17
- data/spec/models/adherent/reglement_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcb31a14740d77a176e63a7f0d07182c1084cf77
|
4
|
+
data.tar.gz: 9554bf9e5da5cf3dff4a991fb18065f663dd7e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46a4a5da98bac79da37c61fac452c73c15e7b98a9903cd776fe6112fd0ee33fd88bfc570a63924ca31dfc05e33f4041f9045f7a1710e8e4b61aae9c26a8c4766
|
7
|
+
data.tar.gz: 0ff293aa381e091f8e7f59660c7d397ba6e4dd2f08d06c7a44c9de6044a1a3b7aa4ee7e4e4bbb12dbe6aed39bb6b163d78cd690f1db2c524baf1eefcc1baaca1
|
@@ -38,8 +38,11 @@ module Adherent
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def imputation_with_actions(pay, r)
|
41
|
+
# on gère le cas où l'adhésion a disparu (car le membre a disparu)
|
42
|
+
a = r.adhesion
|
43
|
+
mem = a ? a.member : 'supprimée'
|
41
44
|
html = ''
|
42
|
-
html << "Adhésion #{
|
45
|
+
html << "Adhésion #{mem} pour #{number_to_currency(r.amount, locale: :fr)}"
|
43
46
|
html << " "
|
44
47
|
html << "#{icon_to 'detail.png', payment_reglement_path(pay.id, r.id)}"
|
45
48
|
html.html_safe
|
@@ -14,23 +14,22 @@ module Adherent
|
|
14
14
|
# TODO A voir, il peut y avoir des paiements partiels ou total
|
15
15
|
def recu_cotisation(payment, member)
|
16
16
|
rs = payment.reglements
|
17
|
-
if rs.count == 1 && rs.first.adhesion.member == member
|
17
|
+
if rs.count == 1 && rs.first.try(:adhesion).try(:member) == member
|
18
18
|
adh = rs.first.adhesion
|
19
|
-
"
|
19
|
+
"Adhésion pour la période #{du_au(adh.from_date, adh.to_date)}"
|
20
20
|
|
21
21
|
elsif rs.size == 1
|
22
22
|
# une seule adhésion mais pas pour lui
|
23
23
|
adh = rs.first.adhesion
|
24
|
-
|
25
|
-
"l'adhésion de #{m.forname} #{m.name} pour la période #{du_au(adh.from_date, adh.to_date)}"
|
24
|
+
"l'adhésion de #{coords(adh)} pour la période #{pour(adh)}"
|
26
25
|
else
|
27
26
|
# plusieurs adhésions
|
28
27
|
str = "les adhésions de <ul>"
|
29
28
|
rs.each do |r|
|
30
29
|
str+='<li>'
|
31
30
|
adh = r.adhesion
|
32
|
-
|
33
|
-
str += "#{
|
31
|
+
|
32
|
+
str += "#{coords(adh)} pour la période #{pour(adh)}"
|
34
33
|
str += '</li>'
|
35
34
|
end
|
36
35
|
str += '</ul>'
|
@@ -44,5 +43,21 @@ module Adherent
|
|
44
43
|
def du_au(from_date, to_date)
|
45
44
|
"du #{from_date} au #{to_date}"
|
46
45
|
end
|
46
|
+
|
47
|
+
def coords(adh)
|
48
|
+
if adh && m = adh.member
|
49
|
+
"#{m.name} #{m.forname}"
|
50
|
+
else
|
51
|
+
'Effacé'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def pour(adh)
|
56
|
+
if adh
|
57
|
+
"#{du_au(adh.from_date, adh.to_date)}"
|
58
|
+
else
|
59
|
+
'du ??? au ???'
|
60
|
+
end
|
61
|
+
end
|
47
62
|
end
|
48
63
|
end
|
@@ -19,12 +19,10 @@ module Adherent
|
|
19
19
|
|
20
20
|
has_many :reglements, :dependent=>:destroy
|
21
21
|
belongs_to :member
|
22
|
-
|
23
|
-
|
24
|
-
# attr_accessible :amount, :date, :mode
|
25
|
-
|
22
|
+
|
26
23
|
validates :amount, :date, :mode, :member_id, presence:true
|
27
|
-
|
24
|
+
# le validator over_imputations est défini dans config/initializers/validators.rb
|
25
|
+
validates :amount, :over_imputations=>true, :if=>'amount'
|
28
26
|
validates :comment, :format=>{with:NAME_REGEX},
|
29
27
|
:length=>{:maximum=>LONG_NAME_LENGTH_MAX}, allow_blank: true
|
30
28
|
|
data/lib/adherent/version.rb
CHANGED
@@ -21,5 +21,6 @@ module Adherent
|
|
21
21
|
# VERSION = '0.3.2' # find_member est maintenant défini dans ApplicationController
|
22
22
|
# VERSION = '0.3.3' # retour en arrière car find_member(id) et find_member(member_id)
|
23
23
|
# VERSION = '0.3.4' # les règlements sans adhésion s'affichent
|
24
|
-
VERSION = '0.3.5' # Affichage plus rapide des paiements
|
24
|
+
# VERSION = '0.3.5' # Affichage plus rapide des paiements
|
25
|
+
VERSION = '0.3.6' # Affichage plus rapide des paiements
|
25
26
|
end
|
@@ -118252,3 +118252,23 @@ Started GET "/assets/adherent/reglements.js?body=1" for 127.0.0.1 at 2015-10-12
|
|
118252
118252
|
|
118253
118253
|
|
118254
118254
|
Started GET "/assets/adherent/icones/supprimer.png" for 127.0.0.1 at 2015-10-12 19:37:10 +0200
|
118255
|
+
[1m[36mAdherent::Reglement Load (163.4ms)[0m [1mSELECT "adherent_reglements".* FROM "adherent_reglements" WHERE (amount = 10)[0m
|
118256
|
+
[1m[35mAdherent::Reglement Load (2.4ms)[0m SELECT "adherent_reglements".* FROM "adherent_reglements" WHERE (amount = 26.66)
|
118257
|
+
[1m[36mAdherent::Reglement Load (2.1ms)[0m [1mSELECT "adherent_reglements".* FROM "adherent_reglements" WHERE (amount = 10.0)[0m
|
118258
|
+
[1m[36m (432.0ms)[0m [1mDROP DATABASE IF EXISTS "adh_test"[0m
|
118259
|
+
[1m[35m (5625.3ms)[0m CREATE DATABASE "adh_test" ENCODING = 'unicode'
|
118260
|
+
[1m[36mSQL (4.0ms)[0m [1mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
118261
|
+
[1m[35m (130.3ms)[0m CREATE TABLE "adherent_adhesions" ("id" serial primary key, "from_date" date, "to_date" date, "amount" decimal(10,2), "member_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
118262
|
+
[1m[36m (38.9ms)[0m [1mCREATE INDEX "index_adherent_adhesions_on_member_id" ON "adherent_adhesions" USING btree ("member_id")[0m
|
118263
|
+
[1m[35m (55.9ms)[0m CREATE TABLE "adherent_coords" ("id" serial primary key, "mail" character varying(255), "tel" character varying(255), "gsm" character varying(255), "office" character varying(255), "address" text, "zip" character varying(255), "city" character varying(255), "member_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
118264
|
+
[1m[36m (49.4ms)[0m [1mCREATE TABLE "adherent_members" ("id" serial primary key, "number" character varying(255), "name" character varying(255), "forname" character varying(255), "birthdate" date, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "organism_id" integer) [0m
|
118265
|
+
[1m[35m (175.8ms)[0m CREATE TABLE "adherent_payments" ("id" serial primary key, "date" date, "amount" decimal(10,2), "mode" character varying(255), "member_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "comment" character varying(255))
|
118266
|
+
[1m[36m (9.2ms)[0m [1mCREATE INDEX "index_adherent_payments_on_member_id" ON "adherent_payments" USING btree ("member_id")[0m
|
118267
|
+
[1m[35m (32.3ms)[0m CREATE TABLE "adherent_reglements" ("id" serial primary key, "amount" decimal(10,2), "adhesion_id" integer, "payment_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
118268
|
+
[1m[36m (22.0ms)[0m [1mCREATE INDEX "index_adherent_reglements_on_adhesion_id" ON "adherent_reglements" USING btree ("adhesion_id")[0m
|
118269
|
+
[1m[35m (4.9ms)[0m CREATE INDEX "index_adherent_reglements_on_payment_id" ON "adherent_reglements" USING btree ("payment_id")
|
118270
|
+
[1m[36m (13.6ms)[0m [1mCREATE TABLE "organisms" ("id" serial primary key, "title" character varying(255), "status" character varying(255), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) [0m
|
118271
|
+
[1m[35m (2.6ms)[0m CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL)
|
118272
|
+
[1m[36m (5.6ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
118273
|
+
[1m[35m (0.6ms)[0m SELECT version FROM "schema_migrations"
|
118274
|
+
[1m[36m (1.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20130810074112')[0m
|