Skip to content

add market opportunities (62898) #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/accounting_posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AccountingPostsController < CrudController
self.permitted_attrs = [:closed, :offered_hours, :offered_rate, :offered_total,
:remaining_hours, :portfolio_item_id, :service_id, :billable,
:description_required, :ticket_required, :from_to_times_required,
:meal_compensation,
:meal_compensation, :market_opportunity_id,
{ work_item_attributes: %i[name shortname description] }]

helper_method :order
Expand Down
10 changes: 10 additions & 0 deletions app/controllers/market_opportunities_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

# Copyright (c) 2006-2024, Puzzle ITC GmbH. This file is part of
# PuzzleTime and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

class MarketOpportunitiesController < ManageController
self.permitted_attrs = %i[name active]
end
1 change: 1 addition & 0 deletions app/controllers/revenue_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class RevenueReportsController < ApplicationController
Reports::Revenue::DepartmentOrder,
Reports::Revenue::DepartmentMember,
Reports::Revenue::PortfolioItem,
Reports::Revenue::MarketOpportunities,
Reports::Revenue::Service,
Reports::Revenue::Sector
].freeze
Expand Down
15 changes: 15 additions & 0 deletions app/domain/reports/revenue/market_opportunities.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

# Copyright (c) 2006-2017, Puzzle ITC GmbH. This file is part of
# PuzzleTime and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

module Reports
module Revenue
class MarketOpportunities < Base
self.grouping_model = ::MarketOpportunity
self.grouping_fk = :market_opportunity_id
end
end
end
1 change: 1 addition & 0 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def management_abilities
PortfolioItem,
Sector,
Service,
MarketOpportunity,
TargetScope,
UserNotification,
WorkingCondition,
Expand Down
6 changes: 6 additions & 0 deletions app/models/absence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: absences
Expand All @@ -14,6 +15,11 @@
# payed :boolean default(FALSE)
# vacation :boolean default(FALSE), not null
#
# Indexes
#
# index_absences_on_name (name) UNIQUE
#
# }}}

class Absence < ApplicationRecord
include Evaluatable
Expand Down
44 changes: 30 additions & 14 deletions app/models/absencetime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,41 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: worktimes
#
# id :integer not null, primary key
# absence_id :integer
# employee_id :integer
# report_type :string(255) not null
# work_date :date not null
# hours :float
# from_start_time :time
# to_end_time :time
# description :text
# billable :boolean default(TRUE)
# type :string(255)
# ticket :string(255)
# work_item_id :integer
# invoice_id :integer
# id :integer not null, primary key
# billable :boolean default(TRUE)
# description :text
# from_start_time :time
# hours :float
# internal_description :text
# meal_compensation :boolean default(FALSE), not null
# report_type :string(255) not null
# ticket :string(255)
# to_end_time :time
# type :string(255)
# work_date :date not null
# absence_id :integer
# employee_id :integer
# invoice_id :integer
# work_item_id :integer
#
# Indexes
#
# index_worktimes_on_invoice_id (invoice_id)
# worktimes_absences (absence_id,employee_id,work_date)
# worktimes_employees (employee_id,work_date)
# worktimes_work_items (work_item_id,employee_id,work_date)
#
# Foreign Keys
#
# fk_times_absences (absence_id => absences.id) ON DELETE => cascade
# fk_times_employees (employee_id => employees.id) ON DELETE => cascade
#
# }}}

class Absencetime < Worktime
self.account_label = 'Absenz'
Expand Down
24 changes: 18 additions & 6 deletions app/models/accounting_post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,35 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: accounting_posts
#
# id :integer not null, primary key
# work_item_id :integer not null
# portfolio_item_id :integer
# billable :boolean default(TRUE), not null
# closed :boolean default(FALSE), not null
# description_required :boolean default(FALSE), not null
# from_to_times_required :boolean default(FALSE), not null
# meal_compensation :boolean default(FALSE), not null
# offered_hours :float
# offered_rate :decimal(12, 2)
# offered_total :decimal(12, 2)
# remaining_hours :integer
# billable :boolean default(TRUE), not null
# description_required :boolean default(FALSE), not null
# ticket_required :boolean default(FALSE), not null
# closed :boolean default(FALSE), not null
# from_to_times_required :boolean default(FALSE), not null
# market_opportunity_id :integer
# portfolio_item_id :integer
# service_id :integer
# work_item_id :integer not null
#
# Indexes
#
# index_accounting_posts_on_market_opportunity_id (market_opportunity_id)
# index_accounting_posts_on_portfolio_item_id (portfolio_item_id)
# index_accounting_posts_on_service_id (service_id)
# index_accounting_posts_on_work_item_id (work_item_id)
#
# }}}

class AccountingPost < ApplicationRecord
include BelongingToWorkItem
Expand All @@ -31,6 +42,7 @@ class AccountingPost < ApplicationRecord
### ASSOCIATIONS

belongs_to :portfolio_item, optional: true
belongs_to :market_opportunity, optional: true
belongs_to :service, optional: true

has_ancestor_through_work_item :order
Expand Down
10 changes: 8 additions & 2 deletions app/models/additional_crm_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: additional_crm_orders
#
# id :bigint(8) not null, primary key
# order_id :bigint(8) not null
# id :bigint not null, primary key
# crm_key :string not null
# name :string
# order_id :bigint not null
#
# Indexes
#
# index_additional_crm_orders_on_order_id (order_id)
#
# }}}

class AdditionalCrmOrder < ApplicationRecord
belongs_to :order
Expand Down
19 changes: 19 additions & 0 deletions app/models/authentication.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# frozen_string_literal: true

# {{{
# == Schema Information
#
# Table name: authentications
#
# id :bigint not null, primary key
# provider :string
# token :string
# token_secret :string
# uid :string
# created_at :datetime not null
# updated_at :datetime not null
# employee_id :bigint
#
# Indexes
#
# index_authentications_on_employee_id (employee_id)
#
# }}}
class Authentication < ApplicationRecord
belongs_to :employee
end
19 changes: 13 additions & 6 deletions app/models/billing_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: billing_addresses
#
# id :integer not null, primary key
# client_id :integer not null
# contact_id :integer
# supplement :string
# street :string
# zip_code :string
# town :string
# country :string(2)
# invoicing_key :string
# street :string
# supplement :string
# town :string
# zip_code :string
# client_id :integer not null
# contact_id :integer
#
# Indexes
#
# index_billing_addresses_on_client_id (client_id)
# index_billing_addresses_on_contact_id (contact_id)
#
# }}}

class BillingAddress < ApplicationRecord
protect_if :invoices,
Expand Down
15 changes: 11 additions & 4 deletions app/models/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: clients
#
# id :integer not null, primary key
# work_item_id :integer not null
# crm_key :string
# allow_local :boolean default(FALSE), not null
# last_invoice_number :integer default(0)
# crm_key :string
# e_bill_account_key :string
# invoicing_key :string
# last_invoice_number :integer default(0)
# sector_id :integer
# e_bill_account_key :string
# work_item_id :integer not null
#
# Indexes
#
# index_clients_on_sector_id (sector_id)
# index_clients_on_work_item_id (work_item_id)
#
# }}}

class Client < ApplicationRecord
include BelongingToWorkItem
Expand Down
18 changes: 12 additions & 6 deletions app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,29 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: contacts
#
# id :integer not null, primary key
# client_id :integer not null
# lastname :string
# crm_key :string
# email :string
# firstname :string
# function :string
# email :string
# phone :string
# invoicing_key :string
# lastname :string
# mobile :string
# crm_key :string
# phone :string
# created_at :datetime
# updated_at :datetime
# invoicing_key :string
# client_id :integer not null
#
# Indexes
#
# index_contacts_on_client_id (client_id)
#
# }}}

class Contact < ApplicationRecord
CRM_ID_PREFIX = 'crm_'
Expand Down
8 changes: 5 additions & 3 deletions app/models/contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: contracts
#
# id :integer not null, primary key
# number :string not null
# start_date :date not null
# end_date :date not null
# notes :text
# number :string not null
# payment_period :integer not null
# reference :text
# sla :text
# notes :text
# start_date :date not null
#
# }}}

class Contract < ApplicationRecord
has_one :order
Expand Down
6 changes: 4 additions & 2 deletions app/models/custom_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: custom_lists
#
# id :integer not null, primary key
# item_ids :integer not null, is an Array
# item_type :string not null
# name :string not null
# employee_id :integer
# item_type :string not null
# item_ids :integer not null, is an Array
#
# }}}

class CustomList < ApplicationRecord
belongs_to :employee, optional: true
Expand Down
7 changes: 7 additions & 0 deletions app/models/department.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# or later. See the COPYING file at the top-level directory or at
# https://github.com/puzzle/puzzletime.

# {{{
# == Schema Information
#
# Table name: departments
Expand All @@ -13,6 +14,12 @@
# name :string(255) not null
# shortname :string(3) not null
#
# Indexes
#
# index_departments_on_name (name) UNIQUE
# index_departments_on_shortname (shortname) UNIQUE
#
# }}}
class Department < ApplicationRecord
include Evaluatable

Expand Down
Loading
Loading