Defect #29826

Can't use back_url in Documents

Added by Krystian Ł. 7 months ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Documents
Target version:-
Resolution: Affected version:3.4.6

Description

Hello, I'm developing an feature for existing open source redmine plugin (ERPMine).
I already found a way to connect CRM contacts, accounts, and leads with projects, documents, issues etc.
What now I'm trying to is to allow creation of new document, issue, project etc. from ERPMine CRM.

<%= link_to l(:label_new_item, l(:field_issue)), url_for(controller: "issues", action: "new", project_id: 'project_id', "issue[custom_field_values][#{wkcustomfield.custom_field.id.to_s}]" => entry.id, :continue => true, :back_url => request.fullpath), class: 'icon icon-time-add', id: link_id, onclick: "get_project(event, '#{link_id}', '#{select_id}')".html_safe %>

(get_project is a javascript that replace "project_id" with project id)
And it works for issues. After I create new issue it redirect me to lead/account/contact as it should.
But It doesn't work for documents...

<%= link_to l(:label_new_item, l(:label_document_plural)), url_for(controller: "documents", action: "new", project_id: 'project_id', "document[custom_field_values][#{wkcustomfield.custom_field.id.to_s}]" => entry.id, :continue => true, :back_url => request.fullpath), class: 'icon icon-time-add', id: link_id, onclick: "get_project(event, '#{link_id}', '#{select_id}')".html_safe %>

I know had read documents controller, and I see the part:

redirect_to document_path(@document)

However it still inherits from ActiveRecord::Base which have back_url. Shouldn't it still work? Am I doing something wrong, or is it impossible to do it without editing DocumentsController?

Also available in: Atom PDF