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

Conflicts:
	htdocs/projet/tasks/time.php
This commit is contained in:
Laurent Destailleur 2019-06-17 15:59:52 +02:00
commit 6966a854b0
3 changed files with 34 additions and 5 deletions

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
@ -831,6 +831,8 @@ if (empty($reshook))
// Auto calculation of date due if not filled by user
if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement();
$object->fetch_thirdparty();
// If creation from another object of another module
if (! $error && $_POST['origin'] && $_POST['originid'])
{

View File

@ -5,6 +5,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2017 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -707,6 +708,27 @@ class Project extends CommonObject
$ret = $this->deleteTasks($user);
if ($ret < 0) $error++;
// Delete all child tables
if (! $error) {
$elements = array('categorie_project'); // elements to delete. TODO Make goodway to delete
foreach($elements as $table)
{
if (! $error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE fk_project = ".$this->id;
$result = $this->db->query($sql);
if (! $result) {
$error++;
$this->errors[] = $this->db->lasterror();
}
}
}
}
// Delete project
if (! $error)
{

View File

@ -467,7 +467,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$object->project = clone $projectstatic;
}
$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
$userRead = $projectstatic->restrictedProjectArea($user, 'read');
$linktocreatetime = '';
if ($projectstatic->id > 0)
@ -582,9 +582,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$linktocreatetimeBtnStatus = 0;
$linktocreatetimeUrl = '';
$linktocreatetimeHelpText = '';
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
if ($user->rights->projet->all->lire || $user->rights->projet->lire)
{
if ($projectstatic->public || $userWrite > 0)
if ($projectstatic->public || $userRead > 0)
{
$linktocreatetimeBtnStatus = 1;
@ -1017,7 +1017,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
// Duration - Time spent
print '<td>';
print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text');
$durationtouse = ($_POST['timespent_duration']?$_POST['timespent_duration']:'');
if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin'))
{
$durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60);
}
print $form->select_duration('timespent_duration', $durationtouse, 0, 'text');
print '</td>';
// Progress declared