Suitecrm: AM_ProjectTemplates: Gantt View - Task Templates not showed according to order_number

Created on 8 May 2018  路  4Comments  路  Source: salesagility/SuiteCRM

In Project Template module, in gantt view, task templates aren't showed according to the value saved in am_tasktemplates.order_number.
This is unfriendly.

Issue

In Project Template module, if a user drag and drop a task template to change the order of a task, the change is saved but the result is not showed to the user until he goes in the detail view

Possible Fix

In /modules/AM_ProjectTemplates/controller.php
change
$tasks = $project_template->get_linked_beans('am_tasktemplates_am_projecttemplates','AM_TaskTemplates');
with
$tasks = $project_template->get_linked_beans('am_tasktemplates_am_projecttemplates','AM_TaskTemplates','order_number');

in /modules/AM_ProjectTemplates/views/view.ganttchart.php
change
$task_list = $this->bean->get_linked_beans('am_tasktemplates_am_projecttemplates','AM_TaskTemplates');
with
$task_list = $this->bean->get_linked_beans('am_tasktemplates_am_projecttemplates','AM_TaskTemplates','order_number');

Steps to Reproduce

https://demo.suiteondemand.com
Project Templates

  1. create new Project Template
  2. add at least 2 Task Templates
  3. try to change the order of Task Templates with drag and drop actions in Gantt view (put the #2 first)
  4. check the difference between View Detail and View Gantt:
    View Detail
    viewdetail
    This (2-3-1) is the right sequence according to the order_number values.
    View Gantt
    view gantt

Context

I think is a medium priority because you can actually change the order in Gantt View with drag and drop, but users can't see task templates have been affected until they look at the Project Template's Detail View Task Templates subpanel and they go into one of the Task Template Detail view.

The issue appers also when you want to create a Project from the Project Template (Task Templates aren't in order in the popup)
screen shot 05-08-18 at 06 06 pm
or you want to Add a new Task Template (Predecessors in the dropdown aren't ordered)
screen shot 05-08-18 at 06 07 pm

Your Environment

I've tested it on SuiteCRM v. 7.10.4 and 7.8.5

Module Bug

Most helpful comment

mayerelyashiv, you are amazing.

I have been frustrated with this issue for years. Twice I have tried to use the project templates, and each time I gave up after a couple of days of trying to figure out why the order was being jumbled. With your fix, I can finally throw out the task list PDF and use the template feature.

I am currently on version 7.11.13
Here is what I did:
nano /var/www/html/modules/AM_ProjectTemplates/controller.php
line 268
//Get project tasks
$project_template->load_relationship('am_tasktemplates_am_projecttemplates');
$tasks = $project_template->get_linked_beans('am_tasktemplates_am_projecttemplates', 'AM_TaskTemplates');

Changed to
//Get project tasks
$project_template->load_relationship('am_tasktemplates_am_projecttemplates');
$tasks = $project_template->get_linked_beans('am_tasktemplates_am_projecttemplates', 'AM_TaskTemplates','order_number');

nano /var/www/html/modules/AM_ProjectTemplates/views/view.ganttchart.php
line253
$this->bean->load_relationship('am_tasktemplates_am_projecttemplates');
$task_list = $this->bean->get_linked_beans('am_tasktemplates_am_projecttemplates', 'AM_TaskTemplates');

Changed to
$this->bean->load_relationship('am_tasktemplates_am_projecttemplates');
$task_list = $this->bean->get_linked_beans('am_tasktemplates_am_projecttemplates', 'AM_TaskTemplates', 'order_number');

I realize this change is not upgrade safe, and I will likely have to repeat after every upgrade until the changes are committed by the suitecrm developers.

All 4 comments

mayerelyashiv, you are amazing.

I have been frustrated with this issue for years. Twice I have tried to use the project templates, and each time I gave up after a couple of days of trying to figure out why the order was being jumbled. With your fix, I can finally throw out the task list PDF and use the template feature.

I am currently on version 7.11.13
Here is what I did:
nano /var/www/html/modules/AM_ProjectTemplates/controller.php
line 268
//Get project tasks
$project_template->load_relationship('am_tasktemplates_am_projecttemplates');
$tasks = $project_template->get_linked_beans('am_tasktemplates_am_projecttemplates', 'AM_TaskTemplates');

Changed to
//Get project tasks
$project_template->load_relationship('am_tasktemplates_am_projecttemplates');
$tasks = $project_template->get_linked_beans('am_tasktemplates_am_projecttemplates', 'AM_TaskTemplates','order_number');

nano /var/www/html/modules/AM_ProjectTemplates/views/view.ganttchart.php
line253
$this->bean->load_relationship('am_tasktemplates_am_projecttemplates');
$task_list = $this->bean->get_linked_beans('am_tasktemplates_am_projecttemplates', 'AM_TaskTemplates');

Changed to
$this->bean->load_relationship('am_tasktemplates_am_projecttemplates');
$task_list = $this->bean->get_linked_beans('am_tasktemplates_am_projecttemplates', 'AM_TaskTemplates', 'order_number');

I realize this change is not upgrade safe, and I will likely have to repeat after every upgrade until the changes are committed by the suitecrm developers.

Can one of you please start a PR with these changes?

Hi pgorod, i鈥檓 not used to do it. Could you help me please?

Yeah, sure.

Start with this, and then ask me when you get stuck:

https://docs.suitecrm.com/community/contributing-code/

Do you already use git locally?

Was this page helpful?
0 / 5 - 0 ratings