diff --git a/ChangeLog b/ChangeLog
index 9d014f14e97..24f8f332207 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,7 @@ For users:
and a delay.
- New: Can define a different clicktodial setup per user.
- New: Add option INVOICE_CAN_NEVER_BE_REMOVED.
+- New: Enhance agenda module to reach RFC2445 (add busy information).
- First change to prepare feature click to print for PDF.
For translators:
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index a6199580353..52620f4445b 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -59,7 +59,7 @@ class ActionComm extends CommonObject
var $punctual = 1; // Milestone
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 $note; // Description
@@ -121,6 +121,7 @@ class ActionComm extends CommonObject
if (empty($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;
if ($this->percentage > 100) $this->percentage = 100;
if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep);
@@ -178,6 +179,7 @@ class ActionComm extends CommonObject
$sql.= "fk_user_action,";
$sql.= "fk_user_done,";
$sql.= "label,percent,priority,fulldayevent,location,punctual,";
+ $sql.= "transparency,";
$sql.= "fk_element,";
$sql.= "elementtype,";
$sql.= "entity";
@@ -196,6 +198,7 @@ class ActionComm extends CommonObject
$sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").",";
$sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").",";
$sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',";
+ $sql.= "'".$this->transparency."',";
$sql.= (! empty($this->fk_element)?$this->fk_element:"null").",";
$sql.= (! empty($this->elementtype)?"'".$this->elementtype."'":"null").",";
$sql.= $conf->entity;
@@ -282,7 +285,7 @@ class ActionComm extends CommonObject
$sql.= " a.fk_user_action, a.fk_user_done,";
$sql.= " a.fk_contact, a.percent as percentage,";
$sql.= " a.fk_element, a.elementtype,";
- $sql.= " a.priority, a.fulldayevent, a.location,";
+ $sql.= " a.priority, a.fulldayevent, a.location, a.transparency,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle,";
$sql.= " s.nom as socname,";
$sql.= " u.firstname, u.lastname as lastname";
@@ -331,6 +334,7 @@ class ActionComm extends CommonObject
$this->priority = $obj->priority;
$this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location;
+ $this->transparency = $obj->transparency;
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->societe->id = $obj->fk_soc;
@@ -437,6 +441,7 @@ class ActionComm extends CommonObject
$this->note=trim($this->note);
if (empty($this->percentage)) $this->percentage = 0;
if (empty($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;
if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
@@ -471,6 +476,7 @@ class ActionComm extends CommonObject
$sql.= ", priority = '".$this->priority."'";
$sql.= ", fulldayevent = '".$this->fulldayevent."'";
$sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null");
+ $sql.= ", transparency = '".$this->transparency."'";
$sql.= ", fk_user_mod = '".$user->id."'";
$sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null");
$sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null");
@@ -952,7 +958,7 @@ class ActionComm extends CommonObject
$event['priority']=$obj->priority;
$event['fulldayevent']=$obj->fulldayevent;
$event['location']=$obj->location;
- $event['transparency']='TRANSPARENT'; // OPAQUE (busy) or TRANSPARENT (not busy)
+ $event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy)
$event['category']=$obj->libelle; // libelle type action
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
@@ -1058,6 +1064,7 @@ class ActionComm extends CommonObject
$this->punctual=0;
$this->percentage=0;
$this->location='Location';
+ $this->transparency=0;
$this->priority='Priority X';
$this->note = 'Note';
}
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 5530c1f02b0..5ed00c1fd6e 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -136,6 +136,7 @@ if ($action == 'add_action')
$actioncomm->priority = GETPOST("priority")?GETPOST("priority"):0;
$actioncomm->fulldayevent = (! empty($fulldayevent)?1:0);
$actioncomm->location = GETPOST("location");
+ $actioncomm->transparency = (GETPOST("transparency")=='on'?1:0);
$actioncomm->label = trim(GETPOST('label'));
if (! GETPOST('label'))
{
@@ -313,7 +314,7 @@ if ($action == 'update')
$actioncomm->percentage = $percentage;
$actioncomm->priority = $_POST["priority"];
$actioncomm->fulldayevent= $_POST["fullday"]?1:0;
- $actioncomm->location = isset($_POST["location"])?$_POST["location"]:'';
+ $actioncomm->location = GETPOST('location');
$actioncomm->societe->id = $_POST["socid"];
$actioncomm->contact->id = $_POST["contactid"];
$actioncomm->fk_project = $_POST["projectid"];
@@ -333,6 +334,8 @@ if ($action == 'update')
$usertodo->fetch($_POST["affectedto"]);
}
$actioncomm->usertodo = $usertodo;
+ $actioncomm->transparency=(GETPOST("transparency")=='on'?1:0);
+
$userdone=new User($db);
if ($_POST["doneby"])
{
@@ -509,16 +512,24 @@ if ($action == 'create')
print '
';
print '
';
@@ -745,21 +756,23 @@ if ($id > 0)
print '
';
@@ -909,23 +922,24 @@ if ($id > 0)
print '
';
- // Input by
- $var=false;
- print '| '.$langs->trans("ActionAskedBy").' | ';
- if ($act->author->id > 0) print $act->author->getNomUrl(1);
- else print ' ';
- print ' |
';
-
- // Affecte a
- print '| '.$langs->trans("ActionAffectedTo").' | ';
+ // Assigned to
+ print ' |
| '.$langs->trans("ActionAffectedTo").' | ';
if ($act->usertodo->id > 0) print $act->usertodo->getNomUrl(1);
print ' |
';
- // Done by
- print '| '.$langs->trans("ActionDoneBy").' | ';
- if ($act->userdone->id > 0) print $act->userdone->getNomUrl(1);
+ // Busy
+ print ' |
| '.$langs->trans("Busy").' | ';
+ print yn(($act->transparency > 0)?1:0);
print ' |
';
+ // Done by
+ if ($conf->global->AGENDA_ENABLE_DONEBY)
+ {
+ print '| '.$langs->trans("ActionDoneBy").' | ';
+ if ($act->userdone->id > 0) print $act->userdone->getNomUrl(1);
+ print ' |
';
+ }
+
print '
';
// Third party - Contact
diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
index f83ab168987..4910ab463f4 100755
--- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
+++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
@@ -227,3 +227,6 @@ ALTER TABLE llx_socpeople ADD COLUMN ref_ext varchar(128) after entity;
ALTER TABLE llx_socpeople ADD COLUMN note_public text after note;
ALTER TABLE llx_societe ADD COLUMN note_public text after note;
+ALTER TABLE llx_actioncomm ADD COLUMN transparency integer after fk_user_action;
+
+
diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql
index ab2183ca262..59b31bcc389 100644
--- a/htdocs/install/mysql/tables/llx_actioncomm.sql
+++ b/htdocs/install/mysql/tables/llx_actioncomm.sql
@@ -45,6 +45,7 @@ create table llx_actioncomm
fk_parent integer NOT NULL default 0,
fk_user_action integer, -- id de la personne qui doit effectuer l'action
+ transparency integer, -- transparency (ical standard). used to say if people assigned to event are busy or not by event.
fk_user_done integer, -- id de la personne qui a effectue l'action
priority smallint,
fulldayevent smallint NOT NULL default 0,