Skip to content
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

Problem with Expenses table I guess #43

Open
reyeztom opened this issue Jun 20, 2016 · 9 comments
Open

Problem with Expenses table I guess #43

reyeztom opened this issue Jun 20, 2016 · 9 comments

Comments

@reyeztom
Copy link

I have a problem installing the plugin. I'm already running the finance plugin of RedmineCRM which has a database table "expenses".

I now can see the "Contracts" tab, but when I click on "new contract" I'll see theinternal error message of Redmine.

rake redmine:plugins:migrate RAILS_ENV=production
/var/lib/gems/1.9.1/gems/actionpack-4.2.4/lib/action_dispatch/http/mime_type.rb:163: warning: already initialized constant VCF
Migrating clipboard_image_paste (Clipboard image paste)...
Migrating contracts (Redmine Contracts With Time Tracking)...
== 1 CreateContracts: migrating ===============================================
-- create_table(:contracts)
-> 0.0337s
== 1 CreateContracts: migrated (0.0341s) ======================================

== 2 AddContractIdToTimeEntries: migrating ====================================
-- add_column(:time_entries, :contract_id, :integer)
-> 0.5242s
== 2 AddContractIdToTimeEntries: migrated (0.5244s) ===========================

== 3 AddPrecisionToHourlyRate: migrating ======================================
-- change_column(:contracts, :hourly_rate, :decimal, {:precision=>16, :scale=>2})
-> 0.0336s
== 3 AddPrecisionToHourlyRate: migrated (0.0341s) =============================

== 4 CreateUserProjectRates: migrating ========================================
-- create_table(:user_project_rates)
-> 0.0087s
== 4 CreateUserProjectRates: migrated (0.0091s) ===============================

== 5 CreateUserContractRates: migrating =======================================
-- create_table(:user_contract_rates)
-> 0.0104s
== 5 CreateUserContractRates: migrated (0.0108s) ==============================

== 6 CreateExpenses: migrating ================================================
-- create_table(:expenses)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'expenses' already exists: CREATE TABLE expenses (id int(11) auto_increment PRIMARY KEY, name varchar(255), expense_date date, amount float, contract_id int(11), issue_id int(11), description varchar(255)) ENGINE=InnoDB/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in query' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:inblock in execute'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_adapter.rb:473:in block in log' /var/lib/gems/1.9.1/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:ininstrument'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_adapter.rb:467:in log' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:inexecute'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in execute' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:208:increate_table'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:468:in create_table' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:662:inblock in method_missing'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:631:in block in say_with_time' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:631:insay_with_time'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:651:in method_missing' /opt/redmine-2.3/plugins/contracts/db/migrate/006_create_expenses.rb:3:inchange'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:605:in exec_migration' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:589:inblock (2 levels) in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:588:in block in migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:inwith_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:587:in migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:765:inmigrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:995:in block in execute_migration_in_transaction' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:1043:inddl_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:994:in execute_migration_in_transaction' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:956:inblock in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:952:in each' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:952:inmigrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:820:in up' /var/lib/gems/1.9.1/gems/activerecord-4.2.4/lib/active_record/migration.rb:798:inmigrate'
/opt/redmine-2.3/lib/redmine/plugin.rb:481:in migrate_plugin' /opt/redmine-2.3/lib/redmine/plugin.rb:453:inmigrate'
/opt/redmine-2.3/lib/redmine/plugin.rb:467:in block in migrate' /opt/redmine-2.3/lib/redmine/plugin.rb:466:ineach'
/opt/redmine-2.3/lib/redmine/plugin.rb:466:in migrate' /opt/redmine-2.3/lib/tasks/redmine.rake:127:inblock (3 levels) in <top (required)>'
Tasks: TOP => redmine:plugins:migrate
(See full trace by running task with --trace)

@wesley-jones
Copy link
Collaborator

Hey reyeztom, did you download the latest version? Version 2.1 of this plugin resolves that issue. We renamed the expenses table to contracts_expenses to avoid conflicts with other modules.

@reyeztom
Copy link
Author

Thanks for your reply Wesley!

Yes I installed the latest version of the plugin.
But as I can see the table first is installed as expenses and after that it
is renamed to contracts_expenses.
I already have a table expenses so that causes a problem.

And besides that it encounters an error on the url "/expenses" (rights
maybe?)

2016-08-18 5:44 GMT+02:00 Wesley Jones [email protected]:

Hey reyeztom, did you download the latest version? Version 2.1 of this
plugin resolves that issue. We renamed the expenses table to
contracts_expenses to avoid conflicts with other modules.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#43 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFr_AOb3uJBggEHmL_-PcSzYRN2tXaIRks5qg9UZgaJpZM4I6MoW
.

@wesley-jones
Copy link
Collaborator

Thanks reyeztom, I understand the issue now. I need to rethink how to address that for users that already have an existing expenses table.

How did you get to the url "/expenses"? Is that url used by the plugin that created the initial expenses table? I don't think the contracts module uses that url.

@reyeztom
Copy link
Author

Thanks for your reply again!

Yes the url is from the existing expenss table and will be blocked in some
kind of way by your plugin (...../projects/{projectnumber}/expenses)

2016-08-23 6:32 GMT+02:00 Wesley Jones [email protected]:

Thanks reyeztom, I understand the issue now. I need to rethink how to
address that for users that already have an existing expenses table.

How did you get to the url "/expenses"? Is that url used by the plugin
that created the initial expenses table? I don't think the contracts module
uses that url.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#43 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFr_AKcXruTLlNWhy_HIFPN3UCYuXQupks5qinfBgaJpZM4I6MoW
.

@wesley-jones
Copy link
Collaborator

Ok thanks. Do you mind posting the error here?

On Aug 23, 2016, at 3:22 AM, reyeztom [email protected] wrote:

Thanks for your reply again!

Yes the url is from the existing expenss table and will be blocked in some
kind of way by your plugin (...../projects/{projectnumber}/expenses)

2016-08-23 6:32 GMT+02:00 Wesley Jones [email protected]:

Thanks reyeztom, I understand the issue now. I need to rethink how to
address that for users that already have an existing expenses table.

How did you get to the url "/expenses"? Is that url used by the plugin
that created the initial expenses table? I don't think the contracts module
uses that url.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#43 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFr_AKcXruTLlNWhy_HIFPN3UCYuXQupks5qinfBgaJpZM4I6MoW
.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@wesley-jones
Copy link
Collaborator

Ok, I have updated the plugin so that it never creates an expenses table anymore. That should allow you to install the plugin with no errors.

As for the /expenses url conflict, I need a little more information. Can you copy/paste the routes related to expenses? It should be in the /config/routes.rb file in one of the CRM modules (probably redmine_contacts_invoices).

@reyeztom
Copy link
Author

Ok I'll try to install this new version.

Hereby the routes:

resources :expenses do
collection do
get :bulk_edit, :context_menu
post :bulk_edit, :bulk_update
delete :bulk_destroy
end
end

resources :expense_imports, :only => [:new, :create]

resources :projects do
resources :invoices, :only => [:index, :new, :create]
resources :expenses, :only => [:index, :new, :create]
resources :recurring_invoices, :only => [:index, :new, :create]
end

Is this enough information for you?

@reyeztom
Copy link
Author

Hi Wesley,

Unfortunately the new installation doesn't work out. After installing:

  • the expenses navigation item is disappeared from the header navigation
  • .../projects/{project_id}/expenses givs me a 403 error
  • .../expenses link from the top navigation shows me a page without the correct data. It looks like the page is getting the data from another table than de previous expenses module
  • when I want to create a "New Contract" (..../projects/{project_id}/contracts/new) I see the Redmine error page: "Internal Error message ("An error occurred on the page you were trying to access....")"

Can you help me how to solve this?

Cheers.

@wesley-jones
Copy link
Collaborator

Hey,
Make sure you have an expenses table. If it doesn't exist, check to see if it got renamed to contracts_expenses and rename it back to expenses.

Once you have confirmed you have an expenses table, uninstall the contracts plugin and make sure everything is back to normal. To uninstall run:

rake redmine:plugins:migrate NAME=contracts VERSION=0

Then let me know:

  1. Did the uninstall complete successfully?
  2. Is your site back to normal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants