Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
hregis committed Jun 24, 2013
2 parents 9992beb + 7778a17 commit ba606bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
17 changes: 6 additions & 11 deletions htdocs/comm/action/class/actioncomm.class.php
Expand Up @@ -45,15 +45,13 @@ class ActionComm extends CommonObject
var $code;
var $label;

var $date;
var $datec; // Date creation record (datec)
var $datem; // Date modification record (tms)
var $author; // Object user that create action
var $usermod; // Object user that modified action

var $datep; // Date action start (datep)
var $datef; // Date action end (datep2)
var $dateend; // ??
var $durationp = -1; // -1=Unkown duration
var $fulldayevent = 0; // 1=Event on full day
var $punctual = 1; // Milestone
Expand Down Expand Up @@ -123,11 +121,11 @@ function add($user,$notrigger=0)
if (empty($this->punctual)) $this->punctual = 0;
if (empty($this->transparency)) $this->transparency = 0;
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;
if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep);
if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date);
//if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date);
if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep;
if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date;
//if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date;
if (! isset($this->fk_project) || $this->fk_project < 0) $this->fk_project = 0;
if ($this->elementtype=='facture') $this->elementtype='invoice';
if ($this->elementtype=='commande') $this->elementtype='order';
Expand Down Expand Up @@ -444,11 +442,11 @@ function update($user,$notrigger=0)
if (empty($this->transparency)) $this->transparency = 0;
if (empty($this->fulldayevent)) $this->fulldayevent = 0;
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;
if ($this->datep && $this->datef) $this->durationp=($this->datef - $this->datep);
if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date);
//if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date);
if ($this->datep && $this->datef && $this->datep > $this->datef) $this->datef=$this->datep;
if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date;
//if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date;
if ($this->fk_project < 0) $this->fk_project = 0;

// Check parameters
Expand All @@ -460,15 +458,12 @@ function update($user,$notrigger=0)

$this->db->begin();

//print 'eeea'.$this->datep.'-'.(strval($this->datep) != '').'-'.$this->db->idate($this->datep);
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
$sql.= " SET percent = '".$this->percentage."'";
if ($this->fk_action > 0) $sql.= ", fk_action = '".$this->fk_action."'";
$sql.= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'":"null");
$sql.= ", datep = ".(strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null');
$sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null');
//$sql.= ", datea = ".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null');
//$sql.= ", datea2 = ".(strval($this->dateend)!='' ? "'".$this->db->idate($this->dateend)."'" : 'null');
$sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null");
$sql.= ", fk_soc =". ($this->societe->id > 0 ? "'".$this->societe->id."'":"null");
$sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null");
Expand Down
6 changes: 3 additions & 3 deletions htdocs/install/mysql/tables/llx_actioncomm.sql
Expand Up @@ -25,9 +25,9 @@ create table llx_actioncomm
id integer AUTO_INCREMENT PRIMARY KEY,
ref_ext varchar(128),
entity integer DEFAULT 1 NOT NULL, -- multi company id
datep datetime, -- date debut planifiee
datep2 datetime, -- deprecated
datea datetime, -- date debut realisation
datep datetime, -- date start
datep2 datetime, -- date end
datea datetime, -- deprecated
datea2 datetime, -- deprecated

fk_action integer, -- type of action (optionnal link with llx_c_actioncomm or null)
Expand Down

0 comments on commit ba606bf

Please sign in to comment.