Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0
Conflicts: htdocs/core/class/html.formmail.class.php htdocs/projet/class/task.class.php htdocs/projet/tasks/task.php
This commit is contained in:
commit
499d93b8c4
@ -329,7 +329,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $
|
|||||||
print '<font style="font-size: 10px;"><br><hr>'."\n";
|
print '<font style="font-size: 10px;"><br><hr>'."\n";
|
||||||
print $fromcompany->name.'<br>';
|
print $fromcompany->name.'<br>';
|
||||||
print $line1;
|
print $line1;
|
||||||
if (strlen($line1+$line2) > 50) print '<br>';
|
if (strlen($line1.$line2) > 50) print '<br>';
|
||||||
else print ' - ';
|
else print ' - ';
|
||||||
print $line2;
|
print $line2;
|
||||||
print '</font></div>'."\n";
|
print '</font></div>'."\n";
|
||||||
|
|||||||
@ -66,6 +66,7 @@ class MyObject extends CommonObject
|
|||||||
* 'position' is the sort order of field.
|
* 'position' is the sort order of field.
|
||||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
|
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||||
* 'help' is a string visible as a tooltip on field
|
* 'help' is a string visible as a tooltip on field
|
||||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
|
|||||||
@ -64,6 +64,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$id=$object->id;
|
$id=$object->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -454,18 +454,12 @@ class Project extends CommonObject
|
|||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
|
|
||||||
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
|
|
||||||
{
|
|
||||||
$this->fetchComments();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
if ($num_rows) return 1;
|
return 0;
|
||||||
else return 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -652,9 +646,8 @@ class Project extends CommonObject
|
|||||||
$this->getLinesArray($user);
|
$this->getLinesArray($user);
|
||||||
|
|
||||||
// Delete tasks
|
// Delete tasks
|
||||||
foreach($this->lines as &$task) {
|
$ret = $this->deleteTasks($user);
|
||||||
$task->delete($user);
|
if ($ret < 0) $error++;
|
||||||
}
|
|
||||||
|
|
||||||
// Delete project
|
// Delete project
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -730,6 +723,40 @@ class Project extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete tasks with no children first, then task with children recursively
|
||||||
|
*
|
||||||
|
* @param User $user User
|
||||||
|
* @return int <0 if KO, 1 if OK
|
||||||
|
*/
|
||||||
|
function deleteTasks($user)
|
||||||
|
{
|
||||||
|
$countTasks = count($this->lines);
|
||||||
|
$deleted = false;
|
||||||
|
if ($countTasks)
|
||||||
|
{
|
||||||
|
foreach($this->lines as $task)
|
||||||
|
{
|
||||||
|
if ($task->hasChildren() <= 0) { // If there is no children (or error to detect them)
|
||||||
|
$deleted = true;
|
||||||
|
$ret = $task->delete($user);
|
||||||
|
if ($ret <= 0)
|
||||||
|
{
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->getLinesArray($user);
|
||||||
|
if ($deleted && count($this->lines) < $countTasks)
|
||||||
|
{
|
||||||
|
if (count($this->lines)) $this->deleteTasks($this->lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a project
|
* Validate a project
|
||||||
|
|||||||
@ -194,7 +194,7 @@ class Task extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch($id, $ref='', $loadparentdata=0)
|
function fetch($id, $ref='', $loadparentdata=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs, $conf;
|
||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.rowid,";
|
$sql.= " t.rowid,";
|
||||||
@ -267,7 +267,6 @@ class Task extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retreive all extrafield
|
// Retreive all extrafield
|
||||||
// fetch optionals attributes and labels
|
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,6 +67,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$id=$object->id;
|
$id=$object->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,7 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0;
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
@ -140,6 +141,7 @@ $userstatic=new User($db);
|
|||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
// To verify role of users
|
// To verify role of users
|
||||||
//$userAccess = $object->restrictedProjectArea($user,'read');
|
//$userAccess = $object->restrictedProjectArea($user,'read');
|
||||||
$userWrite = $object->restrictedProjectArea($user,'write');
|
$userWrite = $object->restrictedProjectArea($user,'write');
|
||||||
|
|||||||
@ -48,6 +48,7 @@ $result=restrictedArea($user,'projet',$id,'projet&project');
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
if ($id > 0 || ! empty($ref)) {
|
if ($id > 0 || ! empty($ref)) {
|
||||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
|
|||||||
@ -95,6 +95,7 @@ $projectid=$id; // For backward compatibility
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=$object->socid;
|
$socid=$object->socid;
|
||||||
|
|||||||
@ -42,6 +42,7 @@ $mine = ($mode == 'mine' ? 1 : 0);
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
|
|||||||
@ -98,6 +98,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
$object->fetch($id, $ref);
|
$object->fetch($id, $ref);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$object->info($object->id);
|
$object->info($object->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
|
|||||||
@ -64,6 +64,7 @@ $extrafields_project = new ExtraFields($db);
|
|||||||
$extrafields_task = new ExtraFields($db);
|
$extrafields_task = new ExtraFields($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -106,6 +106,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
|
||||||
|
|||||||
@ -173,9 +173,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($object->fetch($id, $ref) > 0)
|
if ($object->fetch($id, $ref) > 0)
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$id = $object->id; // So when doing a search from ref, id is also set correctly.
|
$id = $object->id; // So when doing a search from ref, id is also set correctly.
|
||||||
|
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
|||||||
@ -91,7 +91,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($object->fetch($id,$ref) > 0)
|
if ($object->fetch($id,$ref) > 0)
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$projectstatic->fetch($object->fk_project);
|
$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
|
|
||||||
if (! empty($projectstatic->socid)) {
|
if (! empty($projectstatic->socid)) {
|
||||||
$projectstatic->fetch_thirdparty();
|
$projectstatic->fetch_thirdparty();
|
||||||
|
|||||||
@ -51,7 +51,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($object->fetch($id,$ref) > 0)
|
if ($object->fetch($id,$ref) > 0)
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$projectstatic->fetch($object->fk_project);
|
$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
|||||||
@ -211,8 +211,10 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($object->fetch($id,$ref) > 0)
|
if ($object->fetch($id,$ref) > 0)
|
||||||
{
|
{
|
||||||
$res=$object->fetch_optionals();
|
$res=$object->fetch_optionals();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
|||||||
@ -307,7 +307,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
}
|
}
|
||||||
elseif ($object->fetch($id, $ref) >= 0)
|
elseif ($object->fetch($id, $ref) >= 0)
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
$res=$projectstatic->fetch_optionals();
|
$res=$projectstatic->fetch_optionals();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user