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.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 10:43 AM.


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