From 8afffc87627f1236d1355080c835a1dfc840dd76 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 14 Jun 2019 18:28:01 +0200 Subject: [PATCH 1/3] FIX: #11335 --- htdocs/fourn/facture/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 3956684d9b2..bca9cb8ad4e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2019 Juanjo Menent * Copyright (C) 2013-2015 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García @@ -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']) { From a73ae49c4d623b3e9aabb31230187c4b5d264b04 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 14 Jun 2019 18:56:30 +0200 Subject: [PATCH 2/3] FIX: #11296 --- htdocs/projet/class/project.class.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 549865c63cd..5abf7e76d33 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2017 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2019 Juanjo Menent * * 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 @@ -695,6 +696,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) { From c0a30d1ff5484471a9bb9aa8ab4f6c1dad0472c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Jun 2019 22:17:04 +0200 Subject: [PATCH 3/3] FIX #11325 FIX #5249 Conflicts: htdocs/projet/tasks/time.php --- htdocs/projet/tasks/time.php | 61 +++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 48167edcc1d..e69f4fcd899 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -317,7 +317,8 @@ 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) { @@ -427,33 +428,30 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; // Link to create time - //if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) - //{ - if ($user->rights->projet->all->creer || $user->rights->projet->creer) - { - if ($projectstatic->public || $userWrite > 0) - { - if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project - { - $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - else // We are on tab 'Time Spent' of task - { - $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - //} + if ($user->rights->projet->all->lire || $user->rights->projet->lire)) // To enter time, read permission is enough + { + if ($projectstatic->public || $userRead > 0) + { + if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project + { + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + else // We are on tab 'Time Spent' of task + { + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } } } @@ -803,7 +801,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Duration - Time spent print ''; - 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 ''; // Progress declared