Run rubocop --fix-layout and remove encoding comments
This commit is contained in:
parent
fa63e6e81d
commit
ea2862fdef
283 changed files with 1164 additions and 1969 deletions
|
@ -29,491 +29,6 @@ Gemspec/RequiredRubyVersion:
|
|||
- 'plugins/uservoice/foodsoft_uservoice.gemspec'
|
||||
- 'plugins/wiki/foodsoft_wiki.gemspec'
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: outdent, indent
|
||||
Layout/AccessModifierIndentation:
|
||||
Exclude:
|
||||
- 'app/controllers/finance/financial_links_controller.rb'
|
||||
- 'app/models/invite.rb'
|
||||
- 'db/migrate/20130622095040_move_weekly_tasks.rb'
|
||||
|
||||
# Offense count: 13
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: with_first_argument, with_fixed_indentation
|
||||
Layout/ArgumentAlignment:
|
||||
Exclude:
|
||||
- 'app/controllers/finance/balancing_controller.rb'
|
||||
- 'app/controllers/foodcoop/workgroups_controller.rb'
|
||||
- 'app/helpers/deliveries_helper.rb'
|
||||
- 'app/helpers/stockit_helper.rb'
|
||||
- 'db/migrate/20140102170431_add_result_computed_to_group_order_articles.rb'
|
||||
- 'plugins/discourse/app/controllers/discourse_login_controller.rb'
|
||||
- 'plugins/discourse/app/controllers/discourse_sso_controller.rb'
|
||||
- 'plugins/messages/lib/foodsoft_messages/user_link.rb'
|
||||
- 'plugins/polls/app/controllers/polls_controller.rb'
|
||||
- 'spec/models/user_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: with_first_element, with_fixed_indentation
|
||||
Layout/ArrayAlignment:
|
||||
Exclude:
|
||||
- 'lib/render_pdf.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyleAlignWith.
|
||||
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
||||
Layout/BlockAlignment:
|
||||
Exclude:
|
||||
- 'db/migrate/008_create_orders.rb'
|
||||
- 'db/migrate/20090120184410_road_to_version_three.rb'
|
||||
- 'spec/api/v1/user/group_order_articles_spec.rb'
|
||||
|
||||
# Offense count: 86
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
|
||||
# SupportedStyles: case, end
|
||||
Layout/CaseIndentation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
Layout/ClosingParenthesisIndentation:
|
||||
Exclude:
|
||||
- 'app/helpers/stockit_helper.rb'
|
||||
- 'app/models/group_order_article.rb'
|
||||
- 'app/models/shared_article.rb'
|
||||
- 'db/seeds/minimal.seeds.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
Layout/CommentIndentation:
|
||||
Exclude:
|
||||
- 'app/controllers/concerns/auth_api.rb'
|
||||
- 'app/controllers/finance/financial_transactions_controller.rb'
|
||||
- 'app/documents/order_fax.rb'
|
||||
- 'db/migrate/20090120184410_road_to_version_three.rb'
|
||||
|
||||
# Offense count: 51
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: leading, trailing
|
||||
Layout/DotPosition:
|
||||
Exclude:
|
||||
- 'app/controllers/api/v1/user/group_order_articles_controller.rb'
|
||||
- 'app/controllers/stockit_controller.rb'
|
||||
- 'app/documents/order_fax.rb'
|
||||
- 'app/models/order.rb'
|
||||
- 'app/models/stock_article.rb'
|
||||
- 'app/models/task.rb'
|
||||
- 'lib/order_pdf.rb'
|
||||
- 'plugins/current_orders/app/controllers/current_orders/group_orders_controller.rb'
|
||||
- 'plugins/current_orders/app/controllers/current_orders/ordergroups_controller.rb'
|
||||
- 'plugins/current_orders/app/documents/multiple_orders_by_articles.rb'
|
||||
- 'plugins/current_orders/app/documents/multiple_orders_by_groups.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
Layout/ElseAlignment:
|
||||
Exclude:
|
||||
- 'app/helpers/group_orders_helper.rb'
|
||||
|
||||
# Offense count: 70
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLineAfterGuardClause:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 38
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLineAfterMagicComment:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 15
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
||||
Layout/EmptyLineBetweenDefs:
|
||||
Exclude:
|
||||
- 'app/helpers/finance/invoices_helper.rb'
|
||||
- 'app/helpers/orders_helper.rb'
|
||||
- 'app/models/group_order.rb'
|
||||
- 'app/models/ordergroup.rb'
|
||||
- 'app/models/task.rb'
|
||||
- 'db/migrate/20181201000400_create_supplier_categories.rb'
|
||||
- 'db/migrate/20181204000000_clear_invalid_invoices_from_orders.rb'
|
||||
- 'db/migrate/20181204070000_create_stock_events.rb'
|
||||
- 'lib/api/errors.rb'
|
||||
- 'lib/foodsoft/expansion_variables.rb'
|
||||
- 'lib/token_verifier.rb'
|
||||
- 'plugins/wiki/app/helpers/pages_helper.rb'
|
||||
- 'spec/support/shared_database.rb'
|
||||
|
||||
# Offense count: 55
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLines:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: around, only_before
|
||||
Layout/EmptyLinesAroundAccessModifier:
|
||||
Exclude:
|
||||
- 'db/migrate/20130622095040_move_weekly_tasks.rb'
|
||||
|
||||
# Offense count: 85
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, no_empty_lines
|
||||
Layout/EmptyLinesAroundBlockBody:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 147
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
||||
Layout/EmptyLinesAroundClassBody:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
||||
Exclude:
|
||||
- 'app/controllers/articles_controller.rb'
|
||||
- 'app/controllers/finance/balancing_controller.rb'
|
||||
- 'plugins/wiki/app/controllers/pages_controller.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLinesAroundMethodBody:
|
||||
Exclude:
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'db/migrate/002_create_groups.rb'
|
||||
|
||||
# Offense count: 37
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
||||
Layout/EmptyLinesAroundModuleBody:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 9
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
||||
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
||||
Layout/EndAlignment:
|
||||
Exclude:
|
||||
- 'app/controllers/articles_controller.rb'
|
||||
- 'app/controllers/concerns/auth.rb'
|
||||
- 'app/controllers/concerns/send_order_pdf.rb'
|
||||
- 'app/controllers/finance/financial_transactions_controller.rb'
|
||||
- 'app/controllers/home_controller.rb'
|
||||
- 'app/controllers/orders_controller.rb'
|
||||
- 'app/helpers/group_orders_helper.rb'
|
||||
- 'plugins/wiki/app/controllers/pages_controller.rb'
|
||||
|
||||
# Offense count: 57
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
||||
Layout/ExtraSpacing:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
||||
Layout/FirstArgumentIndentation:
|
||||
Exclude:
|
||||
- 'app/models/group_order_article.rb'
|
||||
- 'app/models/shared_article.rb'
|
||||
- 'db/seeds/minimal.seeds.rb'
|
||||
- 'plugins/current_orders/app/controllers/current_orders/articles_controller.rb'
|
||||
- 'plugins/current_orders/app/controllers/current_orders/ordergroups_controller.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
||||
Layout/FirstArrayElementIndentation:
|
||||
Exclude:
|
||||
- 'db/seeds/small.en.seeds.rb'
|
||||
- 'db/seeds/small.nl.seeds.rb'
|
||||
- 'lib/financial_transactions_csv.rb'
|
||||
- 'lib/order_csv.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
||||
Layout/FirstHashElementIndentation:
|
||||
Exclude:
|
||||
- 'app/controllers/finance/financial_transactions_controller.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/models/group_order.rb'
|
||||
- 'db/migrate/20130718183101_migrate_user_settings.rb'
|
||||
- 'lib/bank_account_information_importer.rb'
|
||||
|
||||
# Offense count: 83
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
||||
# SupportedHashRocketStyles: key, separator, table
|
||||
# SupportedColonStyles: key, separator, table
|
||||
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
||||
Layout/HashAlignment:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 9
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: normal, indented_internal_methods
|
||||
Layout/IndentationConsistency:
|
||||
Exclude:
|
||||
- 'db/migrate/003_create_suppliers.rb'
|
||||
- 'db/migrate/007_create_article_prices.rb'
|
||||
- 'db/migrate/008_create_orders.rb'
|
||||
- 'db/migrate/010_user_password_reset.rb'
|
||||
- 'db/migrate/20090120184410_road_to_version_three.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IndentationWidth, EnforcedStyle.
|
||||
# SupportedStyles: spaces, tabs
|
||||
Layout/IndentationStyle:
|
||||
Exclude:
|
||||
- 'db/migrate/010_user_password_reset.rb'
|
||||
|
||||
# Offense count: 12
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: Width, IgnoredPatterns.
|
||||
Layout/IndentationWidth:
|
||||
Exclude:
|
||||
- 'app/helpers/admin/configs_helper.rb'
|
||||
- 'app/helpers/group_orders_helper.rb'
|
||||
- 'app/models/user.rb'
|
||||
- 'db/migrate/003_create_suppliers.rb'
|
||||
- 'db/migrate/007_create_article_prices.rb'
|
||||
- 'db/migrate/008_create_orders.rb'
|
||||
- 'db/migrate/20090120184410_road_to_version_three.rb'
|
||||
- 'lib/tasks/multicoops.rake'
|
||||
- 'spec/api/v1/user/group_order_articles_spec.rb'
|
||||
- 'spec/spec_helper.rb'
|
||||
|
||||
# Offense count: 39
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
||||
Layout/LeadingCommentSpace:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
Layout/LeadingEmptyLines:
|
||||
Exclude:
|
||||
- 'db/migrate/20090120184410_road_to_version_three.rb'
|
||||
- 'db/seeds/seed_helper.rb'
|
||||
- 'lib/order_txt.rb'
|
||||
- 'spec/support/integration.rb'
|
||||
- 'spec/support/session_helper.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: symmetrical, new_line, same_line
|
||||
Layout/MultilineMethodCallBraceLayout:
|
||||
Exclude:
|
||||
- 'app/helpers/stockit_helper.rb'
|
||||
|
||||
# Offense count: 42
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
Exclude:
|
||||
- 'app/controllers/stockit_controller.rb'
|
||||
- 'app/models/order.rb'
|
||||
- 'app/models/ordergroup.rb'
|
||||
- 'app/models/stock_article.rb'
|
||||
- 'app/models/task.rb'
|
||||
- 'lib/foodsoft/expansion_variables.rb'
|
||||
- 'lib/order_pdf.rb'
|
||||
- 'plugins/current_orders/app/controllers/current_orders/group_orders_controller.rb'
|
||||
- 'plugins/current_orders/app/controllers/current_orders/ordergroups_controller.rb'
|
||||
- 'plugins/current_orders/app/documents/multiple_orders_by_groups.rb'
|
||||
- 'spec/api/v1/user/group_order_articles_spec.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: aligned, indented
|
||||
Layout/MultilineOperationIndentation:
|
||||
Exclude:
|
||||
- 'app/helpers/orders_helper.rb'
|
||||
- 'app/inputs/date_picker_time_input.rb'
|
||||
- 'app/models/ordergroup.rb'
|
||||
- 'app/models/task.rb'
|
||||
- 'lib/apple_bar.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Layout/RescueEnsureAlignment:
|
||||
Exclude:
|
||||
- 'app/controllers/suppliers_controller.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Cop supports --auto-correct.
|
||||
Layout/SpaceAfterColon:
|
||||
Exclude:
|
||||
- 'app/controllers/styles_controller.rb'
|
||||
- 'spec/integration/articles_spec.rb'
|
||||
- 'spec/integration/balancing_spec.rb'
|
||||
- 'spec/integration/order_spec.rb'
|
||||
- 'spec/integration/receive_spec.rb'
|
||||
- 'spec/integration/supplier_spec.rb'
|
||||
- 'spec/models/order_article_spec.rb'
|
||||
- 'spec/models/ordergroup_spec.rb'
|
||||
|
||||
# Offense count: 110
|
||||
# Cop supports --auto-correct.
|
||||
Layout/SpaceAfterComma:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 8
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyleInsidePipes.
|
||||
# SupportedStylesInsidePipes: space, no_space
|
||||
Layout/SpaceAroundBlockParameters:
|
||||
Exclude:
|
||||
- 'app/models/group_order_article.rb'
|
||||
- 'db/migrate/008_create_orders.rb'
|
||||
|
||||
# Offense count: 50
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: space, no_space
|
||||
Layout/SpaceAroundEqualsInParameterDefault:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 109
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
||||
# SupportedStylesForExponentOperator: space, no_space
|
||||
Layout/SpaceAroundOperators:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 73
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
||||
# SupportedStyles: space, no_space
|
||||
# SupportedStylesForEmptyBraces: space, no_space
|
||||
Layout/SpaceBeforeBlockBraces:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
Layout/SpaceBeforeComma:
|
||||
Exclude:
|
||||
- 'db/migrate/016_add_shared_lists_connection.rb'
|
||||
- 'lib/render_pdf.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Layout/SpaceBeforeComment:
|
||||
Exclude:
|
||||
- 'plugins/wiki/lib/foodsoft_wiki/wiki_parser.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment.
|
||||
Layout/SpaceBeforeFirstArg:
|
||||
Exclude:
|
||||
- 'app/controllers/application_controller.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: require_no_space, require_space
|
||||
Layout/SpaceInLambdaLiteral:
|
||||
Exclude:
|
||||
- 'plugins/messages/app/models/message.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
|
||||
# SupportedStyles: space, no_space, compact
|
||||
# SupportedStylesForEmptyBrackets: space, no_space
|
||||
Layout/SpaceInsideArrayLiteralBrackets:
|
||||
Exclude:
|
||||
- 'app/helpers/orders_helper.rb'
|
||||
- 'config/application.rb'
|
||||
- 'config/environments/production.rb'
|
||||
- 'db/migrate/20130718183100_create_settings.rb'
|
||||
|
||||
# Offense count: 148
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
||||
# SupportedStyles: space, no_space
|
||||
# SupportedStylesForEmptyBraces: space, no_space
|
||||
Layout/SpaceInsideBlockBraces:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 374
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
||||
# SupportedStyles: space, no_space, compact
|
||||
# SupportedStylesForEmptyBraces: space, no_space
|
||||
Layout/SpaceInsideHashLiteralBraces:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: space, no_space
|
||||
Layout/SpaceInsideParens:
|
||||
Exclude:
|
||||
- 'app/helpers/group_orders_helper.rb'
|
||||
- 'db/migrate/006_create_articles.rb'
|
||||
- 'spec/api/v1/user/group_order_articles_spec.rb'
|
||||
|
||||
# Offense count: 14
|
||||
# Cop supports --auto-correct.
|
||||
Layout/SpaceInsidePercentLiteralDelimiters:
|
||||
Exclude:
|
||||
- 'lib/tasks/foodsoft_setup.rake'
|
||||
|
||||
# Offense count: 7
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
|
||||
# SupportedStyles: space, no_space
|
||||
# SupportedStylesForEmptyBrackets: space, no_space
|
||||
Layout/SpaceInsideReferenceBrackets:
|
||||
Exclude:
|
||||
- 'lib/bank_account_information_importer.rb'
|
||||
- 'lib/foodsoft_config.rb'
|
||||
- 'spec/api/v1/user/ordergroup_spec.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: final_newline, final_blank_line
|
||||
Layout/TrailingEmptyLines:
|
||||
Exclude:
|
||||
- 'app/models/ordergroup.rb'
|
||||
- 'config/initializers/bullet.rb'
|
||||
- 'config/initializers/new_rails_defaults.rb'
|
||||
- 'db/migrate/20130718183101_migrate_user_settings.rb'
|
||||
- 'lib/apple_bar.rb'
|
||||
- 'lib/tasks/foodsoft_setup.rake'
|
||||
- 'spec/support/faker.rb'
|
||||
|
||||
# Offense count: 111
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
Layout/TrailingWhitespace:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 8
|
||||
Lint/AmbiguousBlockAssociation:
|
||||
Exclude:
|
||||
|
@ -529,13 +44,12 @@ Lint/AmbiguousOperator:
|
|||
- 'app/mailers/mailer.rb'
|
||||
- 'spec/models/order_article_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
Lint/AmbiguousRegexpLiteral:
|
||||
Exclude:
|
||||
- 'app/models/article_category.rb'
|
||||
- 'lib/foodsoft/expansion_variables.rb'
|
||||
- 'lib/foodsoft_config.rb'
|
||||
|
||||
# Offense count: 40
|
||||
# Configuration parameters: AllowSafeAssignment.
|
||||
|
@ -626,7 +140,7 @@ Lint/ParenthesesAsGroupedExpression:
|
|||
- 'spec/lib/token_verifier_spec.rb'
|
||||
- 'spec/models/order_article_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 1
|
||||
Lint/ReturnInVoidContext:
|
||||
Exclude:
|
||||
- 'lib/foodsoft_config.rb'
|
||||
|
@ -721,12 +235,11 @@ Lint/UnusedMethodArgument:
|
|||
- 'lib/render_pdf.rb'
|
||||
- 'plugins/wiki/lib/foodsoft_wiki/mailer.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
|
||||
Lint/UselessAccessModifier:
|
||||
Exclude:
|
||||
- 'lib/foodsoft_config.rb'
|
||||
- 'lib/token_verifier.rb'
|
||||
- 'plugins/messages/app/models/messagegroup.rb'
|
||||
|
||||
|
@ -746,6 +259,12 @@ Lint/UselessAssignment:
|
|||
- 'plugins/current_orders/app/documents/multiple_orders_by_groups.rb'
|
||||
- 'spec/lib/foodsoft_config_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
||||
Lint/Void:
|
||||
Exclude:
|
||||
- 'lib/foodsoft_config.rb'
|
||||
|
||||
# Offense count: 158
|
||||
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
|
@ -1082,7 +601,7 @@ RSpec/MultipleMemoizedHelpers:
|
|||
RSpec/NestedGroups:
|
||||
Max: 6
|
||||
|
||||
# Offense count: 32
|
||||
# Offense count: 31
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: not_to, to_not
|
||||
|
@ -1092,7 +611,6 @@ RSpec/NotToNot:
|
|||
- 'spec/api/v1/user/group_order_articles_spec.rb'
|
||||
- 'spec/integration/balancing_spec.rb'
|
||||
- 'spec/integration/login_spec.rb'
|
||||
- 'spec/integration/order_spec.rb'
|
||||
- 'spec/integration/receive_spec.rb'
|
||||
- 'spec/integration/session_spec.rb'
|
||||
- 'spec/lib/token_verifier_spec.rb'
|
||||
|
@ -1520,14 +1038,13 @@ Security/YAMLLoad:
|
|||
- 'lib/foodsoft_config.rb'
|
||||
- 'spec/api/v1/swagger_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: prefer_alias, prefer_alias_method
|
||||
Style/Alias:
|
||||
Exclude:
|
||||
- 'config/initializers/session_store.rb'
|
||||
- 'lib/foodsoft_config.rb'
|
||||
- 'plugins/discourse/lib/foodsoft_discourse/redirect_to_login.rb'
|
||||
- 'plugins/printer/lib/foodsoft_printer/order_printer_jobs.rb'
|
||||
|
||||
|
@ -1685,7 +1202,7 @@ Style/DefWithParentheses:
|
|||
Exclude:
|
||||
- 'app/models/user.rb'
|
||||
|
||||
# Offense count: 306
|
||||
# Offense count: 307
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
|
@ -1735,11 +1252,6 @@ Style/EmptyMethod:
|
|||
- 'db/migrate/20140318173000_delete_empty_group_order_articles.rb'
|
||||
- 'lib/bank_account_connector.rb'
|
||||
|
||||
# Offense count: 40
|
||||
# Cop supports --auto-correct.
|
||||
Style/Encoding:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 21
|
||||
# Cop supports --auto-correct.
|
||||
Style/ExpandPathArguments:
|
||||
|
@ -1809,7 +1321,7 @@ Style/GlobalStdStream:
|
|||
- 'lib/tasks/foodsoft.rake'
|
||||
- 'lib/tasks/foodsoft_setup.rake'
|
||||
|
||||
# Offense count: 63
|
||||
# Offense count: 62
|
||||
# Configuration parameters: MinBodyLength.
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
|
@ -1822,7 +1334,7 @@ Style/HashAsLastArrayItem:
|
|||
Exclude:
|
||||
- 'app/models/order.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowSplatArgument.
|
||||
Style/HashConversion:
|
||||
|
@ -1831,7 +1343,6 @@ Style/HashConversion:
|
|||
- 'app/models/article.rb'
|
||||
- 'app/models/order.rb'
|
||||
- 'lib/bank_account_information_importer.rb'
|
||||
- 'lib/foodsoft_config.rb'
|
||||
- 'plugins/wiki/app/controllers/pages_controller.rb'
|
||||
- 'spec/api/v1/user/ordergroup_spec.rb'
|
||||
|
||||
|
@ -2201,7 +1712,7 @@ Style/RedundantRegexpEscape:
|
|||
- 'plugins/documents/app/controllers/documents_controller.rb'
|
||||
- 'plugins/wiki/app/models/page.rb'
|
||||
|
||||
# Offense count: 18
|
||||
# Offense count: 15
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowMultipleReturnValues.
|
||||
Style/RedundantReturn:
|
||||
|
@ -2216,7 +1727,6 @@ Style/RedundantReturn:
|
|||
- 'app/models/periodic_task_group.rb'
|
||||
- 'app/models/supplier.rb'
|
||||
- 'lib/bank_transaction_reference.rb'
|
||||
- 'lib/foodsoft_config.rb'
|
||||
|
||||
# Offense count: 85
|
||||
# Cop supports --auto-correct.
|
||||
|
@ -2435,9 +1945,9 @@ Style/ZeroLengthPredicate:
|
|||
- 'plugins/current_orders/app/documents/multiple_orders_by_articles.rb'
|
||||
- 'plugins/current_orders/app/documents/multiple_orders_by_groups.rb'
|
||||
|
||||
# Offense count: 436
|
||||
# Offense count: 447
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
Layout/LineLength:
|
||||
Max: 414
|
||||
Max: 420
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -9,7 +9,6 @@ gem 'uglifier', '>= 1.0.3'
|
|||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
gem 'therubyracer', platforms: :ruby
|
||||
|
||||
|
||||
gem 'jquery-rails'
|
||||
gem 'select2-rails'
|
||||
gem 'rails_tokeninput'
|
||||
|
@ -71,7 +70,6 @@ gem 'foodsoft_polls', path: 'plugins/polls'
|
|||
# gem 'foodsoft_printer', path: 'plugins/printer'
|
||||
# gem 'foodsoft_uservoice', path: 'plugins/uservoice'
|
||||
|
||||
|
||||
group :development do
|
||||
gem 'sqlite3', '~> 1.3.6'
|
||||
gem 'mailcatcher'
|
||||
|
|
|
@ -6,5 +6,4 @@ class Admin::BaseController < ApplicationController
|
|||
@groups = Group.where(deleted_at: nil).order('created_on DESC').limit(10)
|
||||
@users = User.order('created_on DESC').limit(10)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Admin::ConfigsController < Admin::BaseController
|
||||
|
||||
before_action :get_tabs, only: [:show, :list]
|
||||
|
||||
def show
|
||||
|
@ -61,5 +60,4 @@ class Admin::ConfigsController < Admin::BaseController
|
|||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -15,5 +15,4 @@ class Admin::FinancesController < Admin::BaseController
|
|||
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class Admin::OrdergroupsController < Admin::BaseController
|
||||
inherit_resources
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class Admin::WorkgroupsController < Admin::BaseController
|
||||
inherit_resources
|
||||
|
||||
|
|
|
@ -22,5 +22,4 @@ class Api::V1::ArticleCategoriesController < Api::V1::BaseController
|
|||
def scope
|
||||
ArticleCategory.all
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
class Api::V1::ConfigsController < Api::V1::BaseController
|
||||
|
||||
before_action -> { doorkeeper_authorize! 'config:user', 'config:read', 'config:write' }
|
||||
|
||||
def show
|
||||
render json: FoodsoftConfig, serializer: ConfigSerializer, root: 'config'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -22,5 +22,4 @@ class Api::V1::FinancialTransactionClassesController < Api::V1::BaseController
|
|||
def scope
|
||||
FinancialTransactionClass.all
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -22,5 +22,4 @@ class Api::V1::FinancialTransactionTypesController < Api::V1::BaseController
|
|||
def scope
|
||||
FinancialTransactionType.includes(:bank_account, :financial_transaction_class)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -20,5 +20,4 @@ class Api::V1::FinancialTransactionsController < Api::V1::BaseController
|
|||
def ransack_auth_object
|
||||
:finance
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Api::V1::NavigationsController < Api::V1::BaseController
|
||||
|
||||
def show
|
||||
# we don't use active_model_serializers here, because source is a Hash
|
||||
render json: { navigation: transform(navigation) }
|
||||
|
@ -20,5 +19,4 @@ class Api::V1::NavigationsController < Api::V1::BaseController
|
|||
r
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -29,5 +29,4 @@ class Api::V1::User::FinancialTransactionsController < Api::V1::BaseController
|
|||
def create_params
|
||||
params.require(:financial_transaction).permit(:amount, :financial_transaction_type_id, :note)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -62,10 +62,10 @@ class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController
|
|||
end
|
||||
|
||||
def scope
|
||||
GroupOrderArticle.
|
||||
joins(:group_order).
|
||||
includes(order_article: :article, group_order: :order).
|
||||
where(group_orders: { ordergroup_id: current_ordergroup.id })
|
||||
GroupOrderArticle
|
||||
.joins(:group_order)
|
||||
.includes(order_article: :article, group_order: :order)
|
||||
.where(group_orders: { ordergroup_id: current_ordergroup.id })
|
||||
end
|
||||
|
||||
def scope_for_update
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Api::V1::User::OrdergroupController < Api::V1::BaseController
|
||||
|
||||
before_action -> { doorkeeper_authorize! 'finance:user' }, only: [:financial_overview]
|
||||
|
||||
def financial_overview
|
||||
|
@ -19,5 +18,4 @@ class Api::V1::User::OrdergroupController < Api::V1::BaseController
|
|||
}
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
class Api::V1::User::UsersController < Api::V1::BaseController
|
||||
|
||||
before_action -> { doorkeeper_authorize! 'user:read', 'user:write' }
|
||||
|
||||
def show
|
||||
render json: current_user
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class ApplicationController < ActionController::Base
|
||||
include Concerns::FoodcoopScope
|
||||
include Concerns::Auth
|
||||
|
@ -12,7 +11,6 @@ class ApplicationController < ActionController::Base
|
|||
after_action :remove_controller
|
||||
around_action :set_time_zone, :set_currency
|
||||
|
||||
|
||||
# Returns the controller handling the current request.
|
||||
def self.current
|
||||
Thread.current[:application_controller]
|
||||
|
@ -95,5 +93,4 @@ class ApplicationController < ActionController::Base
|
|||
ensure
|
||||
::I18n.backend.store_translations(::I18n.locale, number: { currency: { format: { unit: old_currency } } })
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class ArticleCategoriesController < ApplicationController
|
||||
|
||||
inherit_resources # Build default REST Actions via plugin
|
||||
|
||||
before_action :authenticate_article_meta
|
||||
|
@ -23,5 +22,4 @@ class ArticleCategoriesController < ApplicationController
|
|||
def collection
|
||||
@article_categories = ArticleCategory.order('name')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class ArticlesController < ApplicationController
|
||||
before_action :authenticate_article_meta, :find_supplier
|
||||
|
||||
|
@ -117,6 +116,7 @@ class ArticlesController < ApplicationController
|
|||
# makes different actions on selected articles
|
||||
def update_selected
|
||||
raise I18n.t('articles.controller.error_nosel') if params[:selected_articles].nil?
|
||||
|
||||
articles = Article.find(params[:selected_articles])
|
||||
Article.transaction do
|
||||
case params[:selected_action]
|
||||
|
@ -135,7 +135,6 @@ class ArticlesController < ApplicationController
|
|||
end
|
||||
# action succeded
|
||||
redirect_to supplier_articles_url(@supplier, :per_page => params[:per_page])
|
||||
|
||||
rescue => error
|
||||
redirect_to supplier_articles_url(@supplier, :per_page => params[:per_page]),
|
||||
:alert => I18n.t('errors.general_msg', :msg => error)
|
||||
|
|
|
@ -137,6 +137,7 @@ module Concerns::Auth
|
|||
# @see https://github.com/doorkeeper-gem/doorkeeper/issues/71#issuecomment-5471317
|
||||
def expire_access_tokens
|
||||
return unless @current_user
|
||||
|
||||
Doorkeeper::AccessToken.transaction do
|
||||
token_scope = Doorkeeper::AccessToken.where(revoked_at: nil, resource_owner_id: @current_user.id)
|
||||
token_scope.each do |token|
|
||||
|
@ -149,5 +150,4 @@ module Concerns::Auth
|
|||
def redirect_to_login(options = {})
|
||||
redirect_to login_url, options
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -54,5 +54,4 @@ module Concerns::CollectionScope
|
|||
def ransack_auth_object
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -32,5 +32,4 @@ module Concerns::FoodcoopScope
|
|||
def default_url_options(options = {})
|
||||
super().merge({ foodcoop: FoodsoftConfig.scope })
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -47,5 +47,4 @@ module Concerns::Locale
|
|||
locale = session[:locale] = ::I18n.locale
|
||||
logger.info("Set locale to #{locale}")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,5 +13,4 @@ module Concerns::SendOrderPdf
|
|||
pdf = klass.new order
|
||||
send_data pdf.to_pdf, filename: pdf.filename, type: 'application/pdf'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class DeliveriesController < ApplicationController
|
||||
|
||||
before_action :find_supplier, :exclude => :fill_new_stock_article_form
|
||||
|
||||
def index
|
||||
|
@ -68,5 +66,4 @@ class DeliveriesController < ApplicationController
|
|||
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class FeedbackController < ApplicationController
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
|
@ -11,5 +10,4 @@ class FeedbackController < ApplicationController
|
|||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class Finance::BalancingController < Finance::BaseController
|
||||
|
||||
def index
|
||||
@orders = Order.finished.page(params[:page]).per(@per_page).order('ends DESC')
|
||||
end
|
||||
|
@ -84,7 +82,6 @@ class Finance::BalancingController < Finance::BaseController
|
|||
@type = FinancialTransactionType.find_by_id(params.permit(:type)[:type])
|
||||
@order.close!(@current_user, @type)
|
||||
redirect_to finance_order_index_url, notice: t('finance.balancing.close.notice')
|
||||
|
||||
rescue => error
|
||||
redirect_to new_finance_order_url(order_id: @order.id), alert: t('finance.balancing.close.alert', message: error.message)
|
||||
end
|
||||
|
@ -110,5 +107,4 @@ class Finance::BalancingController < Finance::BaseController
|
|||
rescue => error
|
||||
redirect_to finance_order_index_url, alert: t('errors.general_msg', msg: error.message)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Finance::BankAccountsController < Finance::BaseController
|
||||
|
||||
def index
|
||||
@bank_accounts = BankAccount.order('name')
|
||||
redirect_to finance_bank_account_transactions_url(@bank_accounts.first) if @bank_accounts.count == 1
|
||||
|
@ -39,6 +38,7 @@ class Finance::BankAccountsController < Finance::BaseController
|
|||
needs_redirect = true
|
||||
ensure
|
||||
return unless needs_redirect
|
||||
|
||||
redirect_path = finance_bank_account_transactions_url(@bank_account)
|
||||
if request.post?
|
||||
@js_redirect = redirect_path
|
||||
|
@ -46,5 +46,4 @@ class Finance::BankAccountsController < Finance::BaseController
|
|||
redirect_to redirect_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -128,5 +128,4 @@ private
|
|||
JOIN bank_transactions b ON a.iban = b.iban AND b.financial_link_id = #{financial_link_id.to_i}
|
||||
SQL
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class Finance::FinancialTransactionsController < ApplicationController
|
||||
before_action :authenticate_finance
|
||||
before_action :find_ordergroup, :except => [:new_collection, :create_collection, :index_collection]
|
||||
|
@ -79,6 +78,7 @@ class Finance::FinancialTransactionsController < ApplicationController
|
|||
|
||||
def create_collection
|
||||
raise I18n.t('finance.financial_transactions.controller.create_collection.error_note_required') if params[:note].blank?
|
||||
|
||||
type = FinancialTransactionType.find_by_id(params[:type_id])
|
||||
financial_link = nil
|
||||
|
||||
|
@ -131,5 +131,4 @@ class Finance::FinancialTransactionsController < ApplicationController
|
|||
@foodcoop = true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Finance::OrdergroupsController < Finance::BaseController
|
||||
|
||||
def index
|
||||
m = /^(?<col>name|sum_of_class_\d+)(?<reverse>_reverse)?$/.match params["sort"]
|
||||
if m
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Foodcoop::OrdergroupsController < ApplicationController
|
||||
|
||||
def index
|
||||
@ordergroups = Ordergroup.undeleted.order('name')
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Foodcoop::UsersController < ApplicationController
|
||||
|
||||
def index
|
||||
@users = User.undeleted.natural_order
|
||||
|
||||
|
@ -17,5 +16,4 @@ class Foodcoop::UsersController < ApplicationController
|
|||
format.js { render :layout => false } # index.js.erb
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Foodcoop::WorkgroupsController < ApplicationController
|
||||
|
||||
before_action :authenticate_membership_or_admin,
|
||||
:except => [:index]
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class GroupOrderArticlesController < ApplicationController
|
||||
|
||||
before_action :authenticate_finance
|
||||
before_action :find_group_order_article, except: [:new, :create]
|
||||
|
||||
|
|
|
@ -107,5 +107,4 @@ class GroupOrdersController < ApplicationController
|
|||
def order_id_param
|
||||
params[:order_id] || (params[:group_order] && params[:group_order][:order_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class HomeController < ApplicationController
|
||||
|
||||
def index
|
||||
# unaccepted tasks
|
||||
@unaccepted_tasks = Task.order(:due_date).unaccepted_tasks_for(current_user)
|
||||
|
@ -88,5 +86,4 @@ class HomeController < ApplicationController
|
|||
params.require(:user).require(:ordergroup).permit(:contact_address)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class InvitesController < ApplicationController
|
||||
|
||||
before_action :authenticate_membership_or_admin_for_invites
|
||||
before_action -> { require_config_disabled :disable_invite }
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class LoginController < ApplicationController
|
||||
skip_before_action :authenticate # no authentication since this is the login page
|
||||
before_action :validate_token, :only => [:new_password, :update_password]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class OrderCommentsController < ApplicationController
|
||||
|
||||
def new
|
||||
@order = Order.find(params[:order_id])
|
||||
@order_comment = @order.comments.build(:user => current_user)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# Controller for managing orders, i.e. all actions that require the "orders" role.
|
||||
# Normal ordering actions of members of order groups is handled by the OrderingController.
|
||||
|
@ -163,6 +162,7 @@ class OrdersController < ApplicationController
|
|||
|
||||
def update_order_amounts
|
||||
return if not params[:order_articles]
|
||||
|
||||
# where to leave remainder during redistribution
|
||||
rest_to = []
|
||||
rest_to << :tolerance if params[:rest_to_tolerance]
|
||||
|
@ -193,6 +193,7 @@ class OrdersController < ApplicationController
|
|||
end
|
||||
end
|
||||
return nil if counts[0] == 0
|
||||
|
||||
notice = []
|
||||
notice << I18n.t('orders.update_order_amounts.msg1', count: counts[0], units: cunits[0])
|
||||
notice << I18n.t('orders.update_order_amounts.msg2', count: counts[1], units: cunits[1]) if params[:rest_to_tolerance]
|
||||
|
@ -206,5 +207,4 @@ class OrdersController < ApplicationController
|
|||
def remove_empty_article
|
||||
params[:order][:article_ids].reject!(&:blank?) if params[:order] && params[:order][:article_ids]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class PickupsController < ApplicationController
|
||||
|
||||
before_action :authenticate_pickups
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class SessionsController < ApplicationController
|
||||
|
||||
skip_before_action :authenticate
|
||||
layout 'login'
|
||||
|
||||
|
@ -30,5 +29,4 @@ class SessionsController < ApplicationController
|
|||
def redirect_to_foodcoop
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
class StockitController < ApplicationController
|
||||
|
||||
def index
|
||||
@stock_articles = StockArticle.undeleted.includes(:supplier, :article_category).
|
||||
order('suppliers.name, article_categories.name, articles.name')
|
||||
@stock_articles = StockArticle.undeleted.includes(:supplier, :article_category)
|
||||
.order('suppliers.name, article_categories.name, articles.name')
|
||||
end
|
||||
|
||||
def index_on_stock_article_create # See publish/subscribe design pattern in /doc.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class SuppliersController < ApplicationController
|
||||
before_action :authenticate_suppliers, :except => [:index, :list]
|
||||
helper :deliveries
|
||||
|
@ -74,5 +73,4 @@ class SuppliersController < ApplicationController
|
|||
:iban, :custom_fields, :delivery_days, :order_howto, :note, :supplier_category_id,
|
||||
:shared_supplier_id, :min_order_quantity, :shared_sync_method)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class TasksController < ApplicationController
|
||||
# auto_complete_for :user, :nick
|
||||
|
||||
|
@ -122,5 +121,4 @@ class TasksController < ApplicationController
|
|||
.require(:task)
|
||||
.permit(:name, :description, :duration, :user_list, :required_users, :workgroup_id, :due_date, :done)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class UsersController < ApplicationController
|
||||
|
||||
# Currently used to display users nick and ids for autocomplete
|
||||
def index
|
||||
@users = User.undeleted.natural_search(params[:q])
|
||||
|
@ -7,5 +6,4 @@ class UsersController < ApplicationController
|
|||
format.json { render :json => @users.map(&:token_attributes).to_json }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class OrderByArticles < OrderPdf
|
||||
|
||||
def filename
|
||||
I18n.t('documents.order_by_articles.filename', :name => order.name, :date => order.ends.to_date) + '.pdf'
|
||||
end
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class OrderByGroups < OrderPdf
|
||||
|
||||
def filename
|
||||
I18n.t('documents.order_by_groups.filename', :name => order.name, :date => order.ends.to_date) + '.pdf'
|
||||
end
|
||||
|
@ -33,6 +31,7 @@ class OrderByGroups < OrderPdf
|
|||
number_to_currency(goa.total_price)]
|
||||
end
|
||||
next unless rows.length > 1
|
||||
|
||||
rows << [nil, nil, nil, nil, nil, number_to_currency(oa_total)]
|
||||
if has_transport
|
||||
rows << [GroupOrder.human_attribute_name(:transport), nil, nil, nil, nil, number_to_currency(oa_transport)]
|
||||
|
@ -64,5 +63,4 @@ class OrderByGroups < OrderPdf
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class OrderFax < OrderPdf
|
||||
|
||||
BATCH_SIZE = 250
|
||||
|
||||
def filename
|
||||
|
@ -94,14 +92,13 @@ class OrderFax < OrderPdf
|
|||
private
|
||||
|
||||
def order_articles
|
||||
order.order_articles.ordered.
|
||||
joins(:article).
|
||||
order('articles.order_number').order('articles.name').
|
||||
preload(:article, :article_price)
|
||||
order.order_articles.ordered
|
||||
.joins(:article)
|
||||
.order('articles.order_number').order('articles.name')
|
||||
.preload(:article, :article_price)
|
||||
end
|
||||
|
||||
def each_order_article
|
||||
order_articles.find_each_with_order(batch_size: BATCH_SIZE) { |oa| yield oa }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class OrderMatrix < OrderPdf
|
||||
|
||||
HEADER_ROTATE = -30
|
||||
PLACEHOLDER_CHAR = 'X'
|
||||
|
||||
|
@ -113,5 +112,4 @@ class OrderMatrix < OrderPdf
|
|||
first_page = false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -11,6 +11,7 @@ module Admin::ConfigsHelper
|
|||
# @todo find way to pass current value to time_zone input without using default
|
||||
def config_input(form, key, options = {}, &block)
|
||||
return unless @cfg.allowed_key? key
|
||||
|
||||
options[:label] ||= config_input_label(form, key)
|
||||
options[:required] ||= false
|
||||
options[:input_html] ||= {}
|
||||
|
@ -47,6 +48,7 @@ module Admin::ConfigsHelper
|
|||
# @todo find out how to pass +checked_value+ and +unchecked_value+ to +input_field+
|
||||
def config_input_field(form, key, options = {})
|
||||
return unless @cfg.allowed_key? :key
|
||||
|
||||
options[:required] ||= false
|
||||
config_input_field_options form, key, options
|
||||
config_input_tooltip_options form, key, options
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# Methods added to this helper will be available to all templates in the application.
|
||||
module ApplicationHelper
|
||||
|
@ -58,7 +57,6 @@ module ApplicationHelper
|
|||
links.join.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def sort_link_helper(text, key, options = {})
|
||||
|
@ -78,7 +76,6 @@ module ApplicationHelper
|
|||
:class => class_name
|
||||
}
|
||||
|
||||
|
||||
# Url options
|
||||
key += "_reverse" if params[:sort] == key
|
||||
per_page = options[:per_page] || @per_page
|
||||
|
@ -200,6 +197,7 @@ module ApplicationHelper
|
|||
# http://railsapps.github.io/twitter-bootstrap-rails.html
|
||||
def base_errors resource
|
||||
return '' if resource.errors.empty? || resource.errors[:base].empty?
|
||||
|
||||
messages = resource.errors[:base].map { |msg| content_tag(:li, msg) }.join
|
||||
render :partial => 'shared/base_errors', :locals => { :error_messages => messages }
|
||||
end
|
||||
|
@ -230,6 +228,7 @@ module ApplicationHelper
|
|||
# allow truncate to add title when tooltip option is given
|
||||
def truncate(text, options = {}, &block)
|
||||
return text if !text || text.length <= (options[:length] || 30)
|
||||
|
||||
text_truncated = super(text, options, &block)
|
||||
if options[:tooltip]
|
||||
content_tag :span, text_truncated, title: text
|
||||
|
@ -264,5 +263,4 @@ module ApplicationHelper
|
|||
stylesheet_link_tag foodcoop_css_path, media: 'all'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module ArticlesHelper
|
||||
|
||||
# useful for highlighting attributes, when synchronizing articles
|
||||
def highlight_new(unequal_attributes, attribute)
|
||||
return unless unequal_attributes
|
||||
|
||||
unequal_attributes.has_key?(attribute) ? "background-color: yellow" : ""
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
module DeliveriesHelper
|
||||
|
||||
def link_to_invoice(delivery)
|
||||
if delivery.invoice
|
||||
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
|
||||
|
@ -25,9 +24,9 @@ module DeliveriesHelper
|
|||
|
||||
def stock_change_remove_link(stock_change_form)
|
||||
return link_to t('deliveries.stock_change_fields.remove_article'), "#", :class => 'remove_new_stock_change btn btn-small' if stock_change_form.object.new_record?
|
||||
|
||||
output = stock_change_form.hidden_field :_destroy
|
||||
output += link_to t('deliveries.stock_change_fields.remove_article'), "#", :class => 'destroy_stock_change btn btn-small'
|
||||
return output.html_safe
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ module Finance::InvoicesHelper
|
|||
def format_delivery_item delivery
|
||||
format_date(delivery.date)
|
||||
end
|
||||
|
||||
def format_order_item order
|
||||
"#{format_date(order.ends)} (#{number_to_currency(order.sum)})"
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
module GroupOrderArticlesHelper
|
||||
|
||||
# return an edit field for a GroupOrderArticle result
|
||||
def group_order_article_edit_result(goa)
|
||||
result = number_with_precision goa.result, strip_insignificant_zeros: true
|
||||
|
@ -11,5 +10,4 @@ module GroupOrderArticlesHelper
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
module OrderArticlesHelper
|
||||
|
||||
def article_label_with_unit(article)
|
||||
pkg_info = pkg_helper(article, plain: true)
|
||||
"#{article.name} (#{[article.unit, pkg_info].reject(&:blank?).join(' ')})"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
module OrdersHelper
|
||||
|
||||
def update_articles_link(order, text, view, options = {})
|
||||
options = { remote: true, id: "view_#{view}_btn", class: '' }.merge(options)
|
||||
options[:class] += ' active' if view.to_s == @view.to_s
|
||||
|
@ -51,6 +49,7 @@ module OrdersHelper
|
|||
# @return [String] Text showing unit and unit quantity when applicable.
|
||||
def pkg_helper(article, options = {})
|
||||
return '' if !article || article.unit_quantity == 1
|
||||
|
||||
uq_text = "× #{article.unit_quantity}"
|
||||
uq_text = content_tag(:span, uq_text, class: 'hidden-phone') if options[:soft_uq]
|
||||
if options[:plain]
|
||||
|
@ -61,6 +60,7 @@ module OrdersHelper
|
|||
pkg_helper_icon(uq_text, tag: :span)
|
||||
end
|
||||
end
|
||||
|
||||
# @param c [Symbol, String] Tag to use
|
||||
# @option options [String] :class CSS class(es) (in addition to +package+)
|
||||
# @return [String] Icon used for displaying the unit quantity
|
||||
|
@ -75,6 +75,7 @@ module OrdersHelper
|
|||
|
||||
def article_price_change_hint(order_article, gross = false)
|
||||
return nil if order_article.article.price == order_article.price.price
|
||||
|
||||
title = "#{t('helpers.orders.old_price')}: #{number_to_currency order_article.article.price}"
|
||||
title += " / #{number_to_currency order_article.article.gross_price}" if gross
|
||||
content_tag(:i, nil, class: 'icon-asterisk', title: j(title)).html_safe
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
module PathHelper
|
||||
|
||||
def finance_group_transactions_path(ordergroup)
|
||||
if ordergroup
|
||||
finance_ordergroup_transactions_path(ordergroup)
|
||||
|
@ -7,5 +6,4 @@ module PathHelper
|
|||
finance_foodcoop_financial_transactions_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
module SharedHelper
|
||||
|
||||
# provide input_html for password autocompletion
|
||||
def autocomplete_flag_to_password_html(password_autocomplete)
|
||||
case password_autocomplete
|
||||
|
@ -9,5 +8,4 @@ module SharedHelper
|
|||
else {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -19,8 +19,6 @@ module StockitHelper
|
|||
t('simple_form.hints.stock_article.edit_stock_article.price',
|
||||
:stock_article_copy_link => link_to(t('stockit.form.copy_stock_article'),
|
||||
stock_article_copy_path(stock_article),
|
||||
:remote => true
|
||||
)
|
||||
)
|
||||
:remote => true))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
module SuppliersHelper
|
||||
|
||||
def associated_supplier_names(shared_supplier)
|
||||
"(#{shared_supplier.suppliers.map(&:name).join(', ')})"
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
module TasksHelper
|
||||
|
||||
def task_assignments(task)
|
||||
task.assignments.map do |ass|
|
||||
content_tag :span, show_user(ass.user), :class => (ass.accepted? ? 'accepted' : 'unaccepted')
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class DeltaInput < SimpleForm::Inputs::StringInput
|
||||
# for now, need to pass id or it won't work
|
||||
def input(wrapper_options)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class BounceMailReceiver
|
||||
|
||||
def self.regexp
|
||||
/bounce\+(?<local>.*)=(?<domain>[^=]+)/
|
||||
end
|
||||
|
@ -16,5 +15,4 @@ class BounceMailReceiver
|
|||
attachment_mime: 'message/rfc822',
|
||||
attachment_data: data
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
# ActionMailer class that handles all emails for Foodsoft.
|
||||
class Mailer < ActionMailer::Base
|
||||
# XXX Quick fix to allow the use of show_user. Proper take would be one of
|
||||
|
@ -180,5 +179,4 @@ class Mailer < ActionMailer::Base
|
|||
address.display_name = name
|
||||
address.format
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class Article < ApplicationRecord
|
||||
include PriceCalculation
|
||||
|
||||
|
@ -250,5 +249,4 @@ class Article < ApplicationRecord
|
|||
errors.add :name, :taken_with_unit if matches.where(unit: unit, unit_quantity: unit_quantity).any?
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# Article category
|
||||
class ArticleCategory < ApplicationRecord
|
||||
|
||||
# @!attribute name
|
||||
# @return [String] Title of the category.
|
||||
# @!attrubute description
|
||||
|
@ -34,6 +33,7 @@ class ArticleCategory < ApplicationRecord
|
|||
# TODO more intelligence like remembering earlier associations (global and/or per-supplier)
|
||||
def self.find_match(category)
|
||||
return if category.blank? || category.length < 3
|
||||
|
||||
c = nil
|
||||
## exact match - not needed, will be returned by next query as well
|
||||
# c ||= ArticleCategory.where(name: category).first
|
||||
|
@ -52,5 +52,4 @@ class ArticleCategory < ApplicationRecord
|
|||
def check_for_associated_articles
|
||||
raise I18n.t('activerecord.errors.has_many_left', collection: Article.model_name.human) if articles.undeleted.exists?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -27,5 +27,4 @@ class ArticlePrice < ApplicationRecord
|
|||
validates_numericality_of :price, :greater_than_or_equal_to => 0
|
||||
validates_numericality_of :unit_quantity, :greater_than => 0
|
||||
validates_numericality_of :deposit, :tax
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Assignment < ApplicationRecord
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :task
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class BankAccount < ApplicationRecord
|
||||
|
||||
has_many :bank_transactions, dependent: :destroy
|
||||
|
||||
normalize_attributes :name, :iban, :description
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class BankTransaction < ApplicationRecord
|
||||
|
||||
# @!attribute external_id
|
||||
# @return [String] Unique Identifier of the transaction within the bank account.
|
||||
# @!attribute date
|
||||
|
@ -57,8 +56,10 @@ class BankTransaction < ApplicationRecord
|
|||
return unless m
|
||||
|
||||
return false if m[:parts].values.sum != amount
|
||||
|
||||
group = Ordergroup.find_by_id(m[:group])
|
||||
return false unless group
|
||||
|
||||
usr = m[:user] ? User.find_by_id(m[:user]) : group.users.first
|
||||
return false unless usr
|
||||
|
||||
|
@ -69,6 +70,7 @@ class BankTransaction < ApplicationRecord
|
|||
m[:parts].each do |short, value|
|
||||
ftt = FinancialTransactionType.find_by_name_short(short)
|
||||
return false unless ftt
|
||||
|
||||
group.add_financial_transaction! value, note, usr, ftt, link if value > 0
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ module FindEachWithOrder
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
class_methods do
|
||||
|
||||
def find_each_with_order(options = {})
|
||||
find_in_batches_with_order(options) do |records|
|
||||
records.each { |record| yield record }
|
||||
|
@ -34,6 +33,5 @@ module FindEachWithOrder
|
|||
records = relation.offset(start).to_a
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class Delivery < StockEvent
|
||||
|
||||
belongs_to :supplier
|
||||
belongs_to :invoice, optional: true
|
||||
|
||||
|
@ -44,5 +43,4 @@ class Delivery < StockEvent
|
|||
errors.add(:base, I18n.t('model.delivery.each_stock_article_must_be_unique'))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
# Groups organize the User.
|
||||
# A Member gets the roles from the Group
|
||||
class Group < ApplicationRecord
|
||||
|
|
|
@ -39,7 +39,6 @@ class GroupOrder < ApplicationRecord
|
|||
data[:order_articles] = {}
|
||||
order.articles_grouped_by_category.each do |article_category, order_articles|
|
||||
order_articles.each do |order_article|
|
||||
|
||||
# Get the result of last time ordering, if possible
|
||||
goa = group_order_articles.detect { |goa| goa.order_article_id == order_article.id }
|
||||
|
||||
|
@ -88,7 +87,6 @@ class GroupOrder < ApplicationRecord
|
|||
update_attribute(:price, total)
|
||||
end
|
||||
|
||||
|
||||
# Save GroupOrder and updates group_order_articles/quantities accordingly
|
||||
def save_ordering!
|
||||
transaction do
|
||||
|
@ -104,7 +102,7 @@ class GroupOrder < ApplicationRecord
|
|||
|
||||
def total
|
||||
return price + transport if transport
|
||||
|
||||
price
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# The chronologically order of the Ordergroup - activity are stored in GroupOrderArticleQuantity
|
||||
#
|
||||
class GroupOrderArticle < ApplicationRecord
|
||||
|
||||
belongs_to :group_order
|
||||
belongs_to :order_article
|
||||
has_many :group_order_article_quantities, dependent: :destroy
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# Considers every update of an article-order, so may rows for one group_order_article ar possible.
|
||||
|
||||
class GroupOrderArticleQuantity < ApplicationRecord
|
||||
|
||||
belongs_to :group_order_article
|
||||
|
||||
validates_presence_of :group_order_article_id
|
||||
|
|
|
@ -30,5 +30,4 @@ class Invite < ApplicationRecord
|
|||
errors.add(:email, I18n.t('invites.errors.already_member'))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
class Membership < ApplicationRecord
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :group
|
||||
|
||||
before_destroy :check_last_admin
|
||||
|
||||
|
||||
protected
|
||||
|
||||
# check if this is the last admin-membership and deny
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
class Order < ApplicationRecord
|
||||
attr_accessor :ignore_warnings, :transport_distribution
|
||||
|
||||
|
@ -71,8 +69,8 @@ class Order < ApplicationRecord
|
|||
if stockit?
|
||||
# make sure to include those articles which are no longer available
|
||||
# but which have already been ordered in this stock order
|
||||
StockArticle.available.includes(:article_category).
|
||||
order('article_categories.name', 'articles.name').reject{ |a|
|
||||
StockArticle.available.includes(:article_category)
|
||||
.order('article_categories.name', 'articles.name').reject { |a|
|
||||
a.quantity_available <= 0 && !a.ordered_in_order?(self)
|
||||
}.group_by { |a| a.article_category.name }
|
||||
else
|
||||
|
@ -173,11 +171,11 @@ class Order < ApplicationRecord
|
|||
# The array has the following form:
|
||||
# e.g: [["drugs",[teethpaste, toiletpaper]], ["fruits" => [apple, banana, lemon]]]
|
||||
def articles_grouped_by_category
|
||||
@articles_grouped_by_category ||= order_articles.
|
||||
includes([:article_price, :group_order_articles, :article => :article_category]).
|
||||
order('articles.name').
|
||||
group_by { |a| a.article.article_category.name }.
|
||||
sort { |a, b| a[0] <=> b[0] }
|
||||
@articles_grouped_by_category ||= order_articles
|
||||
.includes([:article_price, :group_order_articles, :article => :article_category])
|
||||
.order('articles.name')
|
||||
.group_by { |a| a.article.article_category.name }
|
||||
.sort { |a, b| a[0] <=> b[0] }
|
||||
end
|
||||
|
||||
def articles_sort_by_category
|
||||
|
@ -290,6 +288,7 @@ class Order < ApplicationRecord
|
|||
# Close the order directly, without automaticly updating ordergroups account balances
|
||||
def close_direct!(user)
|
||||
raise I18n.t('orders.model.error_closed') if closed?
|
||||
|
||||
comments.create(user: user, text: I18n.t('orders.model.close_direct_message')) unless FoodsoftConfig[:charge_members_manually]
|
||||
update_attributes! state: 'closed', updated_by: user
|
||||
end
|
||||
|
@ -362,6 +361,7 @@ class Order < ApplicationRecord
|
|||
|
||||
def distribute_transport
|
||||
return unless group_orders.any?
|
||||
|
||||
case transport_distribution.try(&:to_i)
|
||||
when Order.transport_distributions[:ordergroup] then
|
||||
amount = transport / group_orders.size
|
||||
|
|
|
@ -38,6 +38,7 @@ class OrderArticle < ApplicationRecord
|
|||
def units
|
||||
return units_received unless units_received.nil?
|
||||
return units_billed unless units_billed.nil?
|
||||
|
||||
units_to_order
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class OrderComment < ApplicationRecord
|
||||
|
||||
belongs_to :order
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# Ordergroups can order, they are "children" of the class Group
|
||||
#
|
||||
|
@ -24,6 +23,7 @@ class Ordergroup < Group
|
|||
def contact
|
||||
"#{contact_phone} (#{contact_person})"
|
||||
end
|
||||
|
||||
def non_members
|
||||
User.natural_order.all.reject { |u| (users.include?(u) || u.ordergroup) }
|
||||
end
|
||||
|
@ -43,6 +43,7 @@ class Ordergroup < Group
|
|||
def self.custom_fields
|
||||
fields = FoodsoftConfig[:custom_fields] && FoodsoftConfig[:custom_fields][:ordergroup]
|
||||
return [] unless fields
|
||||
|
||||
fields.map(&:deep_symbolize_keys)
|
||||
end
|
||||
|
||||
|
@ -163,6 +164,4 @@ class Ordergroup < Group
|
|||
errors.add :name, message
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ class PeriodicTaskGroup < ApplicationRecord
|
|||
def has_next_task?
|
||||
return false if tasks.empty?
|
||||
return false if tasks.first.due_date.nil?
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class SharedArticle < ApplicationRecord
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
SharedArticle.establish_connection(FoodsoftConfig[:shared_lists])
|
||||
# set correct table_name in external DB
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class SharedSupplier < ApplicationRecord
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
SharedSupplier.establish_connection(FoodsoftConfig[:shared_lists])
|
||||
# set correct table_name in external DB
|
||||
|
@ -8,7 +7,6 @@ class SharedSupplier < ApplicationRecord
|
|||
has_many :suppliers, -> { undeleted }
|
||||
has_many :shared_articles, :foreign_key => :supplier_id
|
||||
|
||||
|
||||
def find_article_by_number(order_number)
|
||||
# note that `shared_articles` uses number instead order_number
|
||||
cached_articles.detect { |a| a.number == order_number }
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class StockArticle < Article
|
||||
|
||||
has_many :stock_changes
|
||||
|
||||
scope :available, -> { undeleted.where('quantity > 0') }
|
||||
|
@ -30,8 +28,8 @@ class StockArticle < Article
|
|||
end
|
||||
|
||||
def quantity_ordered
|
||||
OrderArticle.where(article_id: id).
|
||||
joins(:order).where(orders: {state: %w[open finished received]}).sum(:units_to_order)
|
||||
OrderArticle.where(article_id: id)
|
||||
.joins(:order).where(orders: { state: %w[open finished received] }).sum(:units_to_order)
|
||||
end
|
||||
|
||||
def quantity_history
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
class StockEvent < ApplicationRecord
|
||||
|
||||
has_many :stock_changes, dependent: :destroy
|
||||
has_many :stock_articles, through: :stock_changes
|
||||
|
||||
validates_presence_of :date
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class Supplier < ApplicationRecord
|
||||
include MarkAsDeletedWithName
|
||||
include CustomFields
|
||||
|
@ -116,6 +115,7 @@ class Supplier < ApplicationRecord
|
|||
# default value
|
||||
def shared_sync_method
|
||||
return unless shared_supplier
|
||||
|
||||
self[:shared_sync_method] || 'import'
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class SupplierCategory < ActiveRecord::Base
|
||||
|
||||
belongs_to :financial_transaction_class
|
||||
has_many :suppliers
|
||||
|
||||
|
@ -15,5 +14,4 @@ class SupplierCategory < ActiveRecord::Base
|
|||
def check_for_associated_suppliers
|
||||
raise I18n.t('activerecord.errors.has_many_left', collection: Supplier.model_name.human) if suppliers.undeleted.any?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
class Task < ApplicationRecord
|
||||
has_many :assignments, :dependent => :destroy
|
||||
has_many :users, :through => :assignments
|
||||
|
@ -33,11 +32,10 @@ class Task < ApplicationRecord
|
|||
user.tasks.undone.where(assignments: { accepted: true })
|
||||
end
|
||||
|
||||
|
||||
# find all tasks in the period (or another number of days)
|
||||
def self.next_assigned_tasks_for(user, number = FoodsoftConfig[:tasks_period_days].to_i)
|
||||
user.tasks.undone.where(assignments: {accepted: true}).
|
||||
where(["tasks.due_date >= ? AND tasks.due_date <= ?", Time.now, number.days.from_now])
|
||||
user.tasks.undone.where(assignments: { accepted: true })
|
||||
.where(["tasks.due_date >= ? AND tasks.due_date <= ?", Time.now, number.days.from_now])
|
||||
end
|
||||
|
||||
# count tasks with not enough responsible people
|
||||
|
@ -53,6 +51,7 @@ class Task < ApplicationRecord
|
|||
periodic_task_group_count = {}
|
||||
self.unassigned_tasks_for(user).reject do |item|
|
||||
next false unless item.periodic_task_group
|
||||
|
||||
count = periodic_task_group_count[item.periodic_task_group] || 0
|
||||
periodic_task_group_count[item.periodic_task_group] = count + 1
|
||||
count >= max
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'digest/sha1'
|
||||
# specific user rights through memberships (see Group)
|
||||
class User < ApplicationRecord
|
||||
|
@ -232,6 +230,7 @@ class User < ApplicationRecord
|
|||
def self.custom_fields
|
||||
fields = FoodsoftConfig[:custom_fields] && FoodsoftConfig[:custom_fields][:user]
|
||||
return [] unless fields
|
||||
|
||||
fields.map(&:deep_symbolize_keys)
|
||||
end
|
||||
|
||||
|
@ -251,5 +250,4 @@ class User < ApplicationRecord
|
|||
# this should not be part of the model anyway
|
||||
{ :id => id, :name => "#{display} (#{ordergroup.try(:name)})" }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class Workgroup < Group
|
||||
include CustomFields
|
||||
|
||||
|
@ -26,5 +25,4 @@ class Workgroup < Group
|
|||
errors.add(:role_admin, I18n.t('workgroups.error_last_admin_role'))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,7 +12,6 @@ class ConfigSerializer < ActiveModel::Serializer
|
|||
# help and version
|
||||
attributes :applepear_url, :help_url, :foodsoft
|
||||
|
||||
|
||||
def foodsoft
|
||||
{
|
||||
version: Foodsoft::VERSION,
|
||||
|
|
|
@ -12,6 +12,7 @@ class UserNotifier
|
|||
order_id = args.first
|
||||
Order.find(order_id).group_orders.each do |group_order|
|
||||
next if group_order.ordergroup.nil?
|
||||
|
||||
group_order.ordergroup.users.each do |user|
|
||||
if user.settings.notify['order_finished']
|
||||
Mailer.deliver_now_with_user_locale user do
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require 'exception_notification/rails'
|
||||
|
||||
|
||||
require 'resque/failure/multiple'
|
||||
require 'resque/failure/redis'
|
||||
require 'exception_notification/resque'
|
||||
|
@ -8,7 +7,6 @@ require 'exception_notification/resque'
|
|||
Resque::Failure::Multiple.classes = [Resque::Failure::Redis, ExceptionNotification::Resque]
|
||||
Resque::Failure.backend = Resque::Failure::Multiple
|
||||
|
||||
|
||||
ExceptionNotification.configure do |config|
|
||||
# Ignore additional exception types.
|
||||
# ActiveRecord::RecordNotFound, Mongoid::Errors::DocumentNotFound, AbstractController::ActionNotFound and ActionController::RoutingError are already added.
|
||||
|
@ -49,5 +47,4 @@ ExceptionNotification.configure do |config|
|
|||
# :url => 'http://example.com:5555/hubot/path',
|
||||
# :http_method => :post
|
||||
# }
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# extend the BigDecimal class
|
||||
class String
|
||||
|
||||
# remove comma from decimal inputs
|
||||
def self.delocalized_decimal(string)
|
||||
if !string.blank? and string.is_a?(String)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue