2
0
forked from Wavyzz/dolibarr

Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	dev/skeletons/build_class_from_table.php
	dev/skeletons/skeleton_card.php
	htdocs/compta/facture/class/facture.class.php
	htdocs/core/lib/functions.lib.php
	htdocs/filefunc.inc.php
	htdocs/projet/card.php
This commit is contained in:
Laurent Destailleur
2017-06-03 01:55:05 +02:00
14 changed files with 187 additions and 151 deletions

View File

@@ -20,7 +20,7 @@
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
/**
* API class for projects
*
@@ -83,8 +83,8 @@ class Projects extends DolibarrApi
return $this->_cleanObjectDatas($this->project);
}
/**
* List projects
*
@@ -102,7 +102,7 @@ class Projects extends DolibarrApi
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
@@ -126,7 +126,7 @@ class Projects extends DolibarrApi
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@@ -135,7 +135,7 @@ class Projects extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@@ -228,7 +228,7 @@ class Projects extends DolibarrApi
}
$this->project->getLinesArray(DolibarrApiAccess::$user);
$result = array();
foreach ($this->project->lines as $line) // $line is a task
foreach ($this->project->lines as $line) // $line is a task
{
if ($includetimespent == 1)
{
@@ -244,7 +244,7 @@ class Projects extends DolibarrApi
return $result;
}
/**
* Get roles a user is assigned to a project with
*
@@ -257,20 +257,20 @@ class Projects extends DolibarrApi
*/
function getRoles($id, $userid=0) {
global $db;
if(! DolibarrApiAccess::$user->rights->projet->lire) {
throw new RestException(401);
}
$result = $this->project->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Project not found');
}
if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$taskstatic=new Task($this->db);
$userp = DolibarrApiAccess::$user;
@@ -286,8 +286,8 @@ class Projects extends DolibarrApi
}
return $result;
}
/**
* Add a task to given project
*
@@ -348,7 +348,7 @@ class Projects extends DolibarrApi
return false;
}
*/
/**
* Update a task to given project
*
@@ -406,9 +406,9 @@ class Projects extends DolibarrApi
}
return false;
}*/
/**
* Update project general fields (won't touch lines of project)
*
@@ -483,7 +483,7 @@ class Projects extends DolibarrApi
* Validate a project.
* You can test this API with the following input message
* { "notrigger": 0 }
*
*
* @param int $id Project ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
@@ -527,7 +527,7 @@ class Projects extends DolibarrApi
);
}
/**
* Clean sensible object datas
*
@@ -535,9 +535,12 @@ class Projects extends DolibarrApi
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
$object = parent::_cleanObjectDatas($object);
unset($object->titre);
unset($object->datec);
unset($object->datem);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
@@ -559,21 +562,21 @@ class Projects extends DolibarrApi
unset($object->country);
unset($object->country_id);
unset($object->country_code);
unset($object->weekWorkLoad);
unset($object->weekWorkLoad);
//unset($object->lines); // for task we use timespent_lines, but for project we use lines
unset($object->total_ht);
unset($object->total_tva);
unset($object->total_localtax1);
unset($object->total_localtax2);
unset($object->total_ttc);
return $object;
}
/**
* Validate fields before create or update object
*
@@ -592,8 +595,8 @@ class Projects extends DolibarrApi
}
return $object;
}
// TODO
// getSummaryOfTimeSpent
}