dhanasingh / redmine_wktime

ERPmine is an open source free ERP for Service Industries. It runs within Redmine
https://erpmine.org/
Other
121 stars 78 forks source link

Custom field ID Conflict in wktime #205

Closed PascalP333 closed 4 years ago

PascalP333 commented 4 years ago

I use version 3.9.3 and Redmine 4.1.1 on Linux With the following scenario :

When I reach 20 row in the week time sheet, the ID regerated from the template in the javascript (template) get wrong custom field ID because of this code in the assets/javascripts/edit.js (function renameIDName ). The regex replace will change the first field id to _custom_field_value320 which is exactly the same name at the template one ( custom field id 32 (320). So in the process, both IDs are replaced and this lead to a post with _custom_field_value_3 having no values and the ID 32 with 14 values.

This lead to this server error : Completed 500 Internal Server Error in 196ms (ActiveRecord: 37.2ms)

NoMethodError (undefined method `[]' for nil:NilClass):

plugins/redmine_wktime/app/controllers/wktime_controller.rb:1445:in block (3 levels) in gatherEntries' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1434:ineach' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1434:in block (2 levels) in gatherEntries' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1395:ineach' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1395:in each_with_index' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1395:inblock in gatherEntries' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1380:in each' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1380:ineach_with_index' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1380:in gatherEntries' plugins/redmine_wktime/app/controllers/wktime_controller.rb:176:inupdate' lib/redmine/sudo_mode.rb:65:in `sudo_mode'

If I change the ID of the first field (3) directly in the database, everything is working fine.

If you need more informations, don't hesitate to ask !

PascalP333 commented 4 years ago

Here's the generated ID taken from the inspect in the web browser : Line 19 image Line 20 image

PascalP333 commented 4 years ago

Hello, is there a plan to fix this ?

Thank you

amutha1997 commented 4 years ago

This will be fixed in 4.0 which will probably be released next week.

PascalP333 commented 4 years ago

Thank you for this follow up ! Glad to have it fixed !

Good work !

amutha1997 commented 4 years ago

4.0 is released, Please take a look.

consensusdevteam commented 4 years ago

Hi! I see that this issue was solved in v4.0. But in v4.0.1 redmine crashes in the spend time field after reaching the 20 row in the week time.

Tested in Redmine 4.1.1 + wk_time 4.0.1

Completed 404 Not Found in 71ms (ActiveRecord: 7.8ms)

ActiveRecord::RecordNotFound (Couldn't find WkSpentFor with ID=1312 for TimeEntry with ID=):

plugins/redmine_wktime/app/controllers/wktime_controller.rb:1435:in block (2 levels) in gatherEntries' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1427:ineach' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1427:in each_with_index' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1427:inblock in gatherEntries' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1411:in each' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1411:ineach_with_index' plugins/redmine_wktime/app/controllers/wktime_controller.rb:1411:in gatherEntries' plugins/redmine_wktime/app/controllers/wktime_controller.rb:183:inupdate' lib/redmine/sudo_mode.rb:65:in `sudo_mode'

amutha1997 commented 4 years ago

This issue is fixed in 4.0.2 . 4.0.2 is released, Please take a look.