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

Open
opened 2026-02-20 16:00:15 -05:00 by deekerman · 4 comments
Owner

Originally created by @mayerelyashiv on GitHub (May 8, 2018).

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

Originally created by @mayerelyashiv on GitHub (May 8, 2018). 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](https://user-images.githubusercontent.com/2909933/39768641-3a56dd60-52ea-11e8-8a08-263e7d828559.png) This (2-3-1) is the right sequence according to the order_number values. **View Gantt** ![view gantt](https://user-images.githubusercontent.com/2909933/39768643-3a97485a-52ea-11e8-8e91-71ceda7d1155.png) #### 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](https://user-images.githubusercontent.com/2909933/39768826-aca7feee-52ea-11e8-8dd1-f6f891faddb6.PNG) 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](https://user-images.githubusercontent.com/2909933/39768852-c29be666-52ea-11e8-82ff-b4bcc0396064.PNG) #### Your Environment I've tested it on SuiteCRM v. 7.10.4 and 7.8.5
Author
Owner

@Justin-Trueway commented on GitHub (Apr 23, 2020):

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.

@Justin-Trueway commented on GitHub (Apr 23, 2020): 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.
Author
Owner

@pgorod commented on GitHub (Apr 23, 2020):

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

@pgorod commented on GitHub (Apr 23, 2020): Can one of you please start a PR with these changes?
Author
Owner

@mayerelyashiv commented on GitHub (Apr 23, 2020):

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

@mayerelyashiv commented on GitHub (Apr 23, 2020): Hi pgorod, i’m not used to do it. Could you help me please?
Author
Owner

@pgorod commented on GitHub (Apr 23, 2020):

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?

@pgorod commented on GitHub (Apr 23, 2020): 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?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#3057
No description provided.