Initial Redmine tooling and local plugin forks

This commit is contained in:
Jason Thistlethwaite
2026-04-24 22:01:18 +00:00
commit 9f682af0eb
683 changed files with 56878 additions and 0 deletions
@@ -0,0 +1,87 @@
# encoding: utf-8
#
# This file is a part of Redmine CRM (redmine_contacts) plugin,
# customer relationship management plugin for Redmine
#
# Copyright (C) 2010-2018 RedmineUP
# http://www.redmineup.com/
#
# redmine_contacts is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# redmine_contacts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with redmine_contacts. If not, see <http://www.gnu.org/licenses/>.
require File.expand_path('../../../test_helper', __FILE__)
class ContactsHelperTest < ActionView::TestCase
include ApplicationHelper
include ContactsHelper
include CustomFieldsHelper
include Redmine::I18n
include ERB::Util
fixtures :projects, :trackers, :issue_statuses, :issues,
:enumerations, :users, :issue_categories,
:versions,
:projects_trackers,
:member_roles,
:members,
:groups_users,
:enabled_modules
RedmineContacts::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_contacts).directory + '/test/fixtures/', [:contacts,
:contacts_projects,
:contacts_issues,
:deals,
:notes,
:tags,
:taggings,
:queries])
def setup
super
set_language_if_valid('en')
User.current = nil
end
def test_contacts_to_xls
User.current = User.find(1)
xls_result = contacts_to_xls(Contact.all)
assert_match /First Name/, xls_result
assert_match /Domoway/, xls_result
end
def test_contacts_to_xls_with_multivalue_custom_field
User.current = User.find(1)
field = ContactCustomField.create!(:name => 'filter', :field_format => 'list',
:is_filter => true, :is_for_all => true,
:possible_values => ['value1', 'value2', 'value3'],
:multiple => true)
contact = Contact.find(1)
contact.custom_field_values = { field.id => ['value1', 'value2', 'value3'] }
contact.save!
xls_result = contacts_to_xls([contact])
assert_match /First Name/, xls_result
assert_match /Domoway/, xls_result
assert_match /value1, value2, value3/, xls_result
end
def test_mail_macro
field = ContactCustomField.create!(:name => 'Custom field', :field_format => 'string')
contact = Contact.find(1)
contact.custom_field_values = {field.id => 'test value'}
contact.save!
message = "Hello %%NAME%%, %%FULL_NAME%% %%COMPANY%% %%LAST_NAME%% %%MIDDLE_NAME%% %%DATE%% %%Custom field%%"
result_msg = mail_macro(contact, message)
assert_equal "Hello Ivan, Ivan Ivanov Domoway Ivanov Ivanovich #{format_date(Date.today)} test value", result_msg
end
end
@@ -0,0 +1,76 @@
# encoding: utf-8
#
# This file is a part of Redmine CRM (redmine_contacts) plugin,
# customer relationship management plugin for Redmine
#
# Copyright (C) 2010-2018 RedmineUP
# http://www.redmineup.com/
#
# redmine_contacts is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# redmine_contacts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with redmine_contacts. If not, see <http://www.gnu.org/licenses/>.
require File.expand_path('../../../test_helper', __FILE__)
class DealsHelperTest < ActionView::TestCase
include ApplicationHelper
include DealsHelper
include CustomFieldsHelper
include Redmine::I18n
include ERB::Util
fixtures :projects, :trackers, :issue_statuses, :issues,
:enumerations, :users, :issue_categories,
:versions,
:projects_trackers,
:member_roles,
:members,
:groups_users,
:enabled_modules
RedmineContacts::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_contacts).directory + '/test/fixtures/', [:contacts,
:contacts_projects,
:contacts_issues,
:deals,
:notes,
:tags,
:taggings,
:queries])
def setup
super
set_language_if_valid('en')
User.current = nil
end
def test_deals_to_csv
User.current = User.find(1)
csv_result = deals_to_csv(Deal.all)
assert_match /Name/, csv_result
assert_match /First deal with contacts/, csv_result
end
def test_deals_to_csv_with_multivalue_custom_field
User.current = User.find(1)
field = DealCustomField.create!(:name => 'filter', :field_format => 'list',
:is_filter => true, :is_for_all => true,
:possible_values => ['value1', 'value2', 'value3'],
:multiple => true)
deal = Deal.find(1)
deal.custom_field_values = { field.id => ['value1', 'value2', 'value3'] }
deal.save!
csv_result = deals_to_csv([deal])
assert_match /Name/, csv_result
assert_match /First deal with contacts/, csv_result
assert_match /value1, value2, value3/, csv_result
end
end
@@ -0,0 +1,78 @@
# encoding: utf-8
#
# This file is a part of Redmine CRM (redmine_contacts) plugin,
# customer relationship management plugin for Redmine
#
# Copyright (C) 2010-2018 RedmineUP
# http://www.redmineup.com/
#
# redmine_contacts is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# redmine_contacts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with redmine_contacts. If not, see <http://www.gnu.org/licenses/>.
require File.expand_path('../../../test_helper', __FILE__)
class NotesHelperTest < ActionView::TestCase
include ApplicationHelper
include NotesHelper
include Redmine::I18n
include ERB::Util
fixtures :projects, :trackers, :issue_statuses, :issues,
:enumerations, :users, :issue_categories,
:versions,
:projects_trackers,
:member_roles,
:members,
:groups_users,
:enabled_modules
RedmineContacts::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_contacts).directory + '/test/fixtures/', [:contacts,
:contacts_projects,
:contacts_issues,
:deals,
:notes,
:tags,
:taggings,
:queries])
def setup
super
set_language_if_valid('en')
User.current = nil
end
def test_authoring_note_without_time
RedmineContacts.settings[:note_authoring_time] = false
assert_nothing_raised { authoring_note('2012-12-12 10:00'.to_time, User.find(1)) }
end
def test_authoring_note_with_time
RedmineContacts.settings[:note_authoring_time] = true
assert_nothing_raised { authoring_note('2012-12-12 10:00'.to_time, User.find(1)) }
end
def test_authoring_note_without_time_with_empty_time
RedmineContacts.settings[:note_authoring_time] = true
assert_nothing_raised { authoring_note(nil, User.find(1)) }
end
def test_authoring_note_without_time_with_empty_time
RedmineContacts.settings[:note_authoring_time] = false
assert_nothing_raised { authoring_note(nil, User.find(1)) }
end
def test_authoring_note_without_time_with_empty_user
RedmineContacts.settings[:note_authoring_time] = true
assert_nothing_raised { authoring_note('2012-12-12 10:00'.to_time, nil) }
end
end