Clean code

This commit is contained in:
Laurent Destailleur
2020-05-20 23:40:04 +02:00
parent de11fb2783
commit 92cbff7749
4 changed files with 4 additions and 20 deletions

View File

@@ -177,12 +177,6 @@ class ActionComm extends CommonObject
*/ */
public $fulldayevent = 0; public $fulldayevent = 0;
/**
* @var int Milestone
* @deprecated Milestone is already event with end date = start date
*/
public $punctual = 1;
/** /**
* @var integer Percentage * @var integer Percentage
*/ */
@@ -384,7 +378,6 @@ class ActionComm extends CommonObject
if (empty($this->percentage)) $this->percentage = 0; if (empty($this->percentage)) $this->percentage = 0;
if (empty($this->priority) || !is_numeric($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->fulldayevent)) $this->fulldayevent = 0;
if (empty($this->punctual)) $this->punctual = 0;
if (empty($this->transparency)) $this->transparency = 0; if (empty($this->transparency)) $this->transparency = 0;
if ($this->percentage > 100) $this->percentage = 100; if ($this->percentage > 100) $this->percentage = 100;
//if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
@@ -462,7 +455,7 @@ class ActionComm extends CommonObject
$sql .= "fk_user_author,"; $sql .= "fk_user_author,";
$sql .= "fk_user_action,"; $sql .= "fk_user_action,";
$sql .= "fk_user_done,"; $sql .= "fk_user_done,";
$sql .= "label,percent,priority,fulldayevent,location,punctual,"; $sql .= "label,percent,priority,fulldayevent,location,";
$sql .= "transparency,"; $sql .= "transparency,";
$sql .= "fk_element,"; $sql .= "fk_element,";
$sql .= "elementtype,"; $sql .= "elementtype,";
@@ -492,7 +485,7 @@ class ActionComm extends CommonObject
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
$sql .= ($userownerid > 0 ? $userownerid : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", ";
$sql .= ($userdoneid > 0 ? $userdoneid : "null").", "; $sql .= ($userdoneid > 0 ? $userdoneid : "null").", ";
$sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."','".$this->db->escape($this->punctual)."', "; $sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."', ";
$sql .= "'".$this->db->escape($this->transparency)."', "; $sql .= "'".$this->db->escape($this->transparency)."', ";
$sql .= (!empty($this->fk_element) ? $this->fk_element : "null").", "; $sql .= (!empty($this->fk_element) ? $this->fk_element : "null").", ";
$sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", "; $sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", ";
@@ -693,7 +686,7 @@ class ActionComm extends CommonObject
$sql .= " a.fk_user_action, a.fk_user_done,"; $sql .= " a.fk_user_action, a.fk_user_done,";
$sql .= " a.fk_contact, a.percent as percentage,"; $sql .= " a.fk_contact, a.percent as percentage,";
$sql .= " a.fk_element as elementid, a.elementtype,"; $sql .= " a.fk_element as elementid, a.elementtype,";
$sql .= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
$sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,"; $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
$sql .= " s.nom as socname,"; $sql .= " s.nom as socname,";
$sql .= " u.firstname, u.lastname as lastname"; $sql .= " u.firstname, u.lastname as lastname";
@@ -758,7 +751,6 @@ class ActionComm extends CommonObject
$this->fulldayevent = $obj->fulldayevent; $this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location; $this->location = $obj->location;
$this->transparency = $obj->transparency; $this->transparency = $obj->transparency;
$this->punctual = $obj->punctual; // deprecated
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->contactid = $obj->fk_contact; // To have fetch_contact method working $this->contactid = $obj->fk_contact; // To have fetch_contact method working
@@ -1612,7 +1604,7 @@ class ActionComm extends CommonObject
$sql .= " a.fk_user_action,"; $sql .= " a.fk_user_action,";
$sql .= " a.fk_contact, a.percent as percentage,"; $sql .= " a.fk_contact, a.percent as percentage,";
$sql .= " a.fk_element, a.elementtype,"; $sql .= " a.fk_element, a.elementtype,";
$sql .= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
$sql .= " u.firstname, u.lastname, u.email,"; $sql .= " u.firstname, u.lastname, u.email,";
$sql .= " s.nom as socname,"; $sql .= " s.nom as socname,";
$sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label"; $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label";
@@ -1719,7 +1711,6 @@ class ActionComm extends CommonObject
$event['fulldayevent'] = $obj->fulldayevent; $event['fulldayevent'] = $obj->fulldayevent;
$event['location'] = $obj->location; $event['location'] = $obj->location;
$event['transparency'] = (($obj->transparency > 0) ? 'OPAQUE' : 'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) $event['transparency'] = (($obj->transparency > 0) ? 'OPAQUE' : 'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy)
$event['punctual'] = $obj->punctual;
$event['category'] = $obj->type_label; $event['category'] = $obj->type_label;
$event['email'] = $obj->email; $event['email'] = $obj->email;
// Define $urlwithroot // Define $urlwithroot
@@ -1929,11 +1920,7 @@ class ActionComm extends CommonObject
$this->datem = $now; $this->datem = $now;
$this->datep = $now; $this->datep = $now;
$this->datef = $now; $this->datef = $now;
$this->author = $user;
$this->usermod = $user;
$this->usertodo = $user;
$this->fulldayevent = 0; $this->fulldayevent = 0;
$this->punctual = 0;
$this->percentage = 0; $this->percentage = 0;
$this->location = 'Location'; $this->location = 'Location';
$this->transparency = 1; // 1 means opaque $this->transparency = 1; // 1 means opaque

View File

@@ -255,7 +255,6 @@ class CommActionRapport
$eventstatic->id = $obj->id; $eventstatic->id = $obj->id;
$eventstatic->percentage = $obj->percent; $eventstatic->percentage = $obj->percent;
$eventstatic->fulldayevent = $obj->fulldayevent; $eventstatic->fulldayevent = $obj->fulldayevent;
$eventstatic->punctual = $obj->punctual;
$y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3); $y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3);

View File

@@ -898,7 +898,6 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->datep = $now; $actioncomm->datep = $now;
$actioncomm->datef = $now; $actioncomm->datef = $now;
$actioncomm->durationp = 0; $actioncomm->durationp = 0;
$actioncomm->punctual = 1;
$actioncomm->percentage = -1; // Not applicable $actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $societeforaction->id; $actioncomm->socid = $societeforaction->id;
$actioncomm->contactid = $contactforaction->id; $actioncomm->contactid = $contactforaction->id;

View File

@@ -48,7 +48,6 @@ create table llx_actioncomm
priority smallint, -- priority (ical standard) priority smallint, -- priority (ical standard)
visibility varchar(12) DEFAULT 'default', -- visibility (ical standard) - 'default', 'public', 'private', 'confidential' visibility varchar(12) DEFAULT 'default', -- visibility (ical standard) - 'default', 'public', 'private', 'confidential'
fulldayevent smallint NOT NULL default 0, -- full day (ical standard) fulldayevent smallint NOT NULL default 0, -- full day (ical standard)
punctual smallint NOT NULL default 1, -- deprecated. milestone is event with date start (datep) = date end (datep2)
percent smallint NOT NULL default 0, percent smallint NOT NULL default 0,
location varchar(128), location varchar(128),
durationp real, -- planed duration durationp real, -- planed duration