From 9166dc2d8ceeffb02419880641e01ca69244e2f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Feb 2014 16:57:45 +0100 Subject: [PATCH] Fix: priority is a field smallint. --- htdocs/comm/action/class/actioncomm.class.php | 8 ++++---- htdocs/comm/action/fiche.php | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2f2b65cb6ac..10082062d06 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -58,7 +58,7 @@ class ActionComm extends CommonObject var $percentage; // Percentage var $location; // Location var $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events) - var $priority; // Free text ('' By default) + var $priority; // Small int (0 By default) var $note; // Description var $usertodo; // Object user that must do action @@ -116,7 +116,7 @@ class ActionComm extends CommonObject $this->location=dol_trunc(trim($this->location),128); $this->note=dol_htmlcleanlastbr(trim($this->note)); if (empty($this->percentage)) $this->percentage = 0; - if (empty($this->priority)) $this->priority = 0; + if (empty($this->priority) || ! is_numeric($this->priority)) $this->priority = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0; if (empty($this->punctual)) $this->punctual = 0; if (empty($this->transparency)) $this->transparency = 0; @@ -438,7 +438,7 @@ class ActionComm extends CommonObject $this->label=trim($this->label); $this->note=trim($this->note); if (empty($this->percentage)) $this->percentage = 0; - if (empty($this->priority)) $this->priority = 0; + if (empty($this->priority) || ! is_numeric($this->priority)) $this->priority = 0; if (empty($this->transparency)) $this->transparency = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0; if ($this->percentage > 100) $this->percentage = 100; @@ -1064,7 +1064,7 @@ class ActionComm extends CommonObject $this->percentage=0; $this->location='Location'; $this->transparency=0; - $this->priority='Priority X'; + $this->priority=1; $this->note = 'Note'; } diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 18bf3ecc7ed..d0c6a213c77 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -167,8 +167,7 @@ if ($action == 'add_action') $actioncomm->datep = $datep; $actioncomm->datef = $datef; $actioncomm->percentage = $percentage; - $actioncomm->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * -60; + $actioncomm->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; $usertodo=new User($db); if ($_POST["affectedto"] > 0)