dorsale 3.7.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 523d3264e16c525112422f6ec7beb74c0c28a2e8
4
- data.tar.gz: 5018061784efc57024e7787e055bb8f64ed6be2c
3
+ metadata.gz: cf48ad101657528cc823ff034689b86429052dd2
4
+ data.tar.gz: cadb1010f520ae56b346f951772e46cc0f87670c
5
5
  SHA512:
6
- metadata.gz: 9497cb875ece483c790e5aae3a5c1661b3e9fade30246d9c9a269ea1239f642056c6898ba981197829eca38263cc9eb9452723a3e849c391e44e0983da0810bb
7
- data.tar.gz: 16ecb86b3ad8dd7df1992bc507b091c479657dd4a3172a5ced80e1434051bbadb5b3656f4c3453f38a4ac36894ff488e7c7e34abbe1dfb628f21863bf1b4f8eb
6
+ metadata.gz: 8d45e6c14fb4c2192e1c77b8d12061e7a5834a23a439577892122f5f05a524b855b61475c2fe40e30e457442211a52f491bb72f7092d450280f29ac5afe2bee5
7
+ data.tar.gz: 34e5c7642da701322077d221fb263ebc671243ddf16b1acf388648f6c25203b0fb70f9fa96bf37b6b77d67dbe2dde79bbabe2a66eb365802cbac6093b200152a
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.7.1
4
+ - Add activity type and origin filters for people
5
+ - Add activity type and origin in people export
6
+
3
7
  ## 3.7.0
4
8
 
5
9
  - Remove some useless "polymorphic" belongs_to
@@ -4,9 +4,11 @@ class Dorsale::CustomerVault::PeopleController < ::Dorsale::CustomerVault::Appli
4
4
  def index
5
5
  authorize model, :list?
6
6
 
7
- @filters ||= ::Dorsale::CustomerVault::SmallData::FilterForPeople.new(cookies)
8
- @tags ||= customer_vault_tag_list
9
- @people ||= policy_scope(model)
7
+ @filters ||= ::Dorsale::CustomerVault::SmallData::FilterForPeople.new(cookies)
8
+ @tags ||= customer_vault_tag_list
9
+ @origins ||= policy_scope(Dorsale::CustomerVault::Origin)
10
+ @activity_types ||= policy_scope(Dorsale::CustomerVault::ActivityType)
11
+ @people ||= policy_scope(model)
10
12
  .search(params[:q])
11
13
  .preload(:taggings)
12
14
 
@@ -1,6 +1,8 @@
1
1
  class Dorsale::CustomerVault::SmallData::FilterForPeople < ::Agilibox::SmallData::Filter
2
2
  STRATEGIES = {
3
- "person_type" => ::Agilibox::SmallData::FilterStrategyByKeyValue.new(:type),
4
- "person_tags" => ::Agilibox::SmallData::FilterStrategyByTags.new,
3
+ "person_type" => ::Agilibox::SmallData::FilterStrategyByKeyValue.new(:type),
4
+ "person_tags" => ::Agilibox::SmallData::FilterStrategyByTags.new,
5
+ "person_origin" => ::Agilibox::SmallData::FilterStrategyByKeyValue.new("origin_id"),
6
+ "person_activity" => ::Dorsale::CustomerVault::SmallData::FilterStrategyByActivityType.new,
5
7
  }
6
8
  end
@@ -0,0 +1,7 @@
1
+ class Dorsale::CustomerVault::SmallData::FilterStrategyByActivityType < ::Agilibox::SmallData::FilterStrategy
2
+ def apply(query, value)
3
+ corporations_id = query.where(activity_type_id: value).pluck(:id)
4
+ individuals_id = query.where(corporation_id: corporations_id).pluck(:id)
5
+ query.where(id: (corporations_id + individuals_id))
6
+ end
7
+ end
@@ -7,3 +7,11 @@
7
7
  :collection => @tags,
8
8
  :input_html => {multiple: true},
9
9
  :placeholder => ::Dorsale::CustomerVault::Person.t(:all_tags)
10
+
11
+ = f.input :person_origin,
12
+ :collection => @origins,
13
+ :include_blank => ::Dorsale::CustomerVault::Person.t(:all_origins)
14
+
15
+ = f.input :person_activity,
16
+ :collection => @activity_types,
17
+ :include_blank => ::Dorsale::CustomerVault::Person.t(:all_activity_types)
@@ -7,6 +7,8 @@ fields = %w(
7
7
  email
8
8
  phone
9
9
  mobile
10
+ origin
11
+ activity_type
10
12
  fax
11
13
  skype
12
14
  www
@@ -81,6 +81,8 @@ en:
81
81
  dorsale/customer_vault/person: &customer_vault_person_attributes
82
82
  context: "Context"
83
83
  all_tags: "All tags"
84
+ all_origins: "All origins"
85
+ all_activity_types: "All activities"
84
86
  all_types: "All types"
85
87
  capital: "Capital"
86
88
  immatriculation_number: "Immatriculation number 1"
@@ -80,6 +80,8 @@ fr:
80
80
  dorsale/customer_vault/person: &customer_vault_person_attributes
81
81
  context: "Contexte"
82
82
  all_tags: "Tous les tags"
83
+ all_origins: "Toutes les origines"
84
+ all_activity_types: "Toutes les activités"
83
85
  all_types: "Tous les types"
84
86
  capital: "Capital"
85
87
  immatriculation_number: "SIREN"
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.7.0"
2
+ VERSION = "3.7.1"
3
3
  end
@@ -54,6 +54,31 @@ RSpec.describe ::Dorsale::CustomerVault::PeopleController, type: :controller do
54
54
 
55
55
  expect(assigns(:people)).to eq [individual]
56
56
  end
57
+
58
+ it "should filter by person origin" do
59
+ @origin = create(:customer_vault_origin)
60
+ individual = create(:customer_vault_individual, origin: @origin)
61
+ corporation = create(:customer_vault_corporation)
62
+
63
+ cookies[:filters] = {person_origin: @origin.id}.to_json
64
+
65
+ get :index
66
+
67
+ expect(assigns(:people)).to eq [individual]
68
+ end
69
+
70
+ it "should filter by person activity" do
71
+ @activity = create(:customer_vault_activity_type)
72
+ corpo1 = create(:customer_vault_corporation, activity_type: @activity)
73
+ individual = create(:customer_vault_individual, corporation: corpo1)
74
+ corpo2 = create(:customer_vault_corporation)
75
+
76
+ cookies[:filters] = {person_activity: @activity.id}.to_json
77
+
78
+ get :index
79
+
80
+ expect(assigns(:people)).to eq [corpo1, individual]
81
+ end
57
82
  end # describe "filters"
58
83
 
59
84
  describe "search" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorsale
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-27 00:00:00.000000000 Z
11
+ date: 2017-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -553,6 +553,7 @@ files:
553
553
  - app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
554
554
  - app/filters/dorsale/billing_machine/small_data/filter_strategy_by_state.rb
555
555
  - app/filters/dorsale/customer_vault/small_data/filter_for_people.rb
556
+ - app/filters/dorsale/customer_vault/small_data/filter_strategy_by_activity_type.rb
556
557
  - app/filters/dorsale/expense_gun/small_data/filter_for_expenses.rb
557
558
  - app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb
558
559
  - app/filters/dorsale/flyboy/small_data/filter_strategy_by_done.rb