dotProject Forums

Go Back   dotProject Forums > DOTPROJECT VERSION 2 > Latest Development Snapshot
Register FAQTop Posters Members List Calendar Search Today's Posts Resend Activation Email Mark Forums Read
Bugs & Feature Requests Download dotProject

Latest Development Snapshot Forum to be used for discussing any issues or questions to do with the latest CVS snapshot. Will obviously cover multiple iterations of this snapshot but should serve as a central location to look for all issues.

Reply
 
Thread Tools Display Modes
  #1  
Old 22-09-12, 10:59 PM
Rafael Queiroz Gonçalves's Avatar
Rafael Queiroz Gonçalves Rafael Queiroz Gonçalves is offline
Valued Users
Frequent Visitor
dotProject Version: 2.1.7
php Version: 5.3
MySQL Version: 5.4
Operating System Version: Windows
Browser: Firefox
 
Join Date: 25-04-12
Posts: 80
Send a message via Skype™ to Rafael Queiroz Gonçalves
Default Resources module on dotProject 2.1.6 (problem when saving a other resource alocation)

Today I was using the resources module (core dotProject module), and I had problems when I allocated a resource to a task. It was not saving the alocation properly. I did a few adjusts in the file: modules/resources/tasks_dosql.addedit.php

In case anyone has the same problem as me, it is possible to replace the file code for the one I am showning below:
PHP Code:
<?php
if (!defined('DP_BASE_DIR')) {
  die(
'You should not access this file directly.');
}

// Set the pre and post save functions
global $pre_save$post_save$other_resources;

$pre_save[] = "resource_presave";
$post_save[] = "resource_postsave";
$other_resources null;

/**
 * presave functions are called before the session storage of tab data
 * is destroyed.  It can be used to save this data to be used later in
 * the postsave function.
 */
function resource_presave() {
    global 
$other_resources;
    
//check to see if we are in the post save list or if we need to query the session.
    //$other_resources = (int)dPgetParam($_POST, 'hresource_assign');
    
$other_resources dPgetParam($_POST'hresource_assign');
    
dprint(__FILE____LINE__5"setting other resources to $other_resources");
}

/**
 * postsave functions are only called after a succesful save.  They are
 * used to perform database operations after the event.
*/
 
function resource_postsave(){
  global 
$other_resources;
  global 
$obj;
  
$task_id $obj->task_id;
    
dprint(__FILE____LINE__5"saving resources, $other_resources");
  if (isset(
$other_resources)) {
    
$value = array();
    
$reslist explode(';'$other_resources);
    foreach (
$reslist as $res) {
      if (
$res) {
                list (
$resource$perc) = explode('='$res);
                if(!isset(
$perc)){
                    
$perc=100;
                }
                
$value[] = array($task_id$resource$perc);
      }
    }
        
// first delete any elements already there, then replace with this
        // list.
        
$q = new DBQuery;
        
$q->setDelete('resource_tasks');
        
$q->addWhere('task_id = ' $obj->task_id);
        
$q->exec(); 
        
$q->clear();
    if (
count($value)) {
            foreach (
$value as $v)
            {
                
$q->addTable('resource_tasks');
                
$q->addInsert('task_id,resource_id,percent_allocated'$vtrue);
                
$q->exec();
                
$q->clear();
            }
    }
  }
}
?>

Reply With Quote
  #2  
Old 13-01-17, 06:57 PM
hlogermann hlogermann is offline
Junior Member
Return Visitor
dotProject Version: 2.1.7
php Version: 5.2
MySQL Version: 5.1
Operating System Version: Windows
Browser: Firefox
 
Join Date: 13-01-17
Posts: 3
Default Re: Resources module on dotProject 2.1.6 (problem when saving a other resource alocat

Hi Rafael - more than 4 years later I had the same problem in dp 2.1.8 and I'm very happy to find your solution.
Thank you very much - you make my day.

Regards
Holger

Reply With Quote
  #3  
Old 14-01-17, 09:31 PM
Rafael Queiroz Gonçalves's Avatar
Rafael Queiroz Gonçalves Rafael Queiroz Gonçalves is offline
Valued Users
Frequent Visitor
dotProject Version: 2.1.7
php Version: 5.3
MySQL Version: 5.4
Operating System Version: Windows
Browser: Firefox
 
Join Date: 25-04-12
Posts: 80
Send a message via Skype™ to Rafael Queiroz Gonçalves
Thumbs up Re: Resources module on dotProject 2.1.6 (problem when saving a other resource alocat

Hi Holger,

I am glad it was useful! Any problem you have just post here. I am currently using the 2.1.8, and I already have fixed same other little bugs.
__________________
Rafael Queiroz Gonçalves
Professional contact: rafael.q.g@hotmail.com
Reply With Quote
  #4  
Old 16-01-17, 10:18 PM
hlogermann hlogermann is offline
Junior Member
Return Visitor
dotProject Version: 2.1.7
php Version: 5.2
MySQL Version: 5.1
Operating System Version: Windows
Browser: Firefox
 
Join Date: 13-01-17
Posts: 3
Default Re: Resources module on dotProject 2.1.6 (problem when saving a other resource alocat

Hi Rafael. Yes, I'm working with 2.1.8 too - with still little issues. You write, that you fixed some - That will beat up my heart faster :-)

Currently I'm a beginner with the dotProject forum and I've problems to find fixes. e.g. your fix. I found that via google but not via the search function in this forum. However may be you fix my current issue?

Using the calculate button in a task place the value "8 hours" in the "expected duration" field. (Based on my settings in begin and end date). But this value will not stored in the database. The value is still 0.

Is this one of your fixes?

Regards
Holger

Reply With Quote
  #5  
Old 18-01-17, 10:21 PM
hlogermann hlogermann is offline
Junior Member
Return Visitor
dotProject Version: 2.1.7
php Version: 5.2
MySQL Version: 5.1
Operating System Version: Windows
Browser: Firefox
 
Join Date: 13-01-17
Posts: 3
Default Re: Resources module on dotProject 2.1.6 (problem when saving a other resource alocat

Hi Rafael. Problem fixed. I marked my tasks as milestones. Obviously milestones cannot calculated with a duration time.

Regards
Holger

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +10. The time now is 04:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.