diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index 334964660f2443726fbfa4e267d9761da2aff2b7..3fd80919ac94503a2c1e78b951aa5019bcb50345 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -96,8 +96,9 @@ class ActionComm // Clean parameters $this->label=trim($this->label); - $this->note=trim($this->note); - if (! $this->percentage) $this->percentage = 0; + $this->location=trim($this->location); + $this->note=trim($this->note); + if (! $this->percentage) $this->percentage = 0; if (! $this->priority) $this->priority = 0; if (! $this->punctual) $this->punctual = 0; if ($this->percentage > 100) $this->percentage = 100; @@ -147,7 +148,7 @@ class ActionComm $sql.= "fk_user_author,"; $sql.= "fk_user_action,"; $sql.= "fk_user_done,"; - $sql.= "label,percent,priority,punctual,"; + $sql.= "label,percent,priority,location,punctual,"; $sql.= "fk_facture,propalrowid,fk_commande)"; $sql.= " VALUES ("; $sql.= "'".$this->db->idate($now)."',"; @@ -162,7 +163,7 @@ class ActionComm $sql.= ($user->id > 0 ? "'".$user->id."'":"null").","; $sql.= ($this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").","; $sql.= ($this->userdone->id > 0?"'".$this->userdone->id."'":"null").","; - $sql.= "'".addslashes($this->label)."','".$this->percentage."','".$this->priority."','".$this->punctual."',"; + $sql.= "'".addslashes($this->label)."','".$this->percentage."','".$this->priority."','".addslashes($this->location)."','".$this->punctual."',"; $sql.= ($this->facid?$this->facid:"null").","; $sql.= ($this->propalrowid?$this->propalrowid:"null").","; $sql.= ($this->orderrowid?$this->orderrowid:"null"); @@ -215,7 +216,7 @@ class ActionComm $sql.= " a.fk_user_author, a.fk_user_mod,"; $sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_contact, a.percent as percentage, a.fk_facture, a.fk_commande, a.propalrowid,"; - $sql.= " a.priority,"; + $sql.= " a.priority, a.location,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; @@ -252,7 +253,8 @@ class ActionComm $this->usertodo->id = $obj->fk_user_action; $this->userdone->id = $obj->fk_user_done; $this->priority = $obj->priority; - + $this->location = $obj->location; + $this->societe->id = $obj->fk_soc; $this->contact->id = $obj->fk_contact; @@ -297,6 +299,7 @@ class ActionComm $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; + dolibarr_syslog("ActionComm::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -346,6 +349,7 @@ class ActionComm $sql.= ", fk_soc =". ($this->societe->id > 0 ? "'".$this->societe->id."'":"null"); $sql.= ", fk_contact =". ($this->contact->id > 0 ? "'".$this->contact->id."'":"null"); $sql.= ", priority = '".$this->priority."'"; + $sql.= ", location = ".($this->location ? "'".addslashes($this->location)."'":"null"); $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"); @@ -595,7 +599,7 @@ class ActionComm $sql.= " a.fk_user_author, a.fk_user_mod,"; $sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_contact, a.fk_facture, a.percent as percentage, a.fk_commande,"; - $sql.= " a.priority,"; + $sql.= " a.priority,a.location,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c"; $sql.= " WHERE a.fk_action=c.id"; @@ -657,20 +661,22 @@ class ActionComm $datestart=$obj->datep; $dateend=$obj->datep2; $duration=$obj->durationp; + $event['summary']=$obj->label; + $event['desc']=$obj->note; $event['startdate']=$datestart; $event['duration']=$duration; // Not required with type 'journal' $event['enddate']=$dateend; // Not required with type 'journal' - $event['summary']=$obj->label; - $event['desc']=$obj->note; - $event['category']=$obj->libelle; $event['author']=$obj->fk_user_author; + $event['priority']=$obj->priority; + $event['location']=$obj->location; $event['transparency']='TRANSPARENT'; // TRANSPARENT or OPAQUE + $event['category']=$obj->libelle; // libelle type action $url=$dolibarr_main_url_root; if (! eregi('\/$',$url)) $url.='/'; $url.='comm/action/fiche.php?id='.$obj->id; $event['url']=$url; - if ($qualified) + if ($qualified && $datestart) { $eventarray[$datestart]=$event; } diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index a83525b2848872f14fd40037302ae94a6cadea30..30043f2485eadc50769bd8f6105212bca271490c 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -97,13 +97,13 @@ if ($_POST["action"] == 'add_action') $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); - $datea=dolibarr_mktime($_POST["adhour"], + $datea=dolibarr_mktime($_POST["adhour"], // deprecated $_POST["admin"], 0, $_POST["admonth"], $_POST["adday"], $_POST["adyear"]); - $datea2=dolibarr_mktime($_POST["a2hour"], + $datea2=dolibarr_mktime($_POST["a2hour"], // deprecated $_POST["a2min"], 0, $_POST["a2month"], @@ -126,6 +126,7 @@ if ($_POST["action"] == 'add_action') $actioncomm->type_id = $cactioncomm->id; $actioncomm->type_code = $cactioncomm->code; $actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0; + $actioncomm->location = isset($_POST["location"])?$_POST["location"]:''; $actioncomm->label = trim($_POST["label"]); if (! $_POST["label"]) { @@ -191,7 +192,13 @@ if ($_POST["action"] == 'add_action') if ($_POST["add_webcal"] == 'on' && $conf->webcal->enabled) $actioncomm->use_webcal=1; if ($_POST["add_phenix"] == 'on' && $conf->phenix->enabled) $actioncomm->use_phenix=1; - + // Check parameters + if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || $datep2 == '')) + { + $error=1; + $_GET["action"] = 'create'; + $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEnd")).'</div>'; + } if ($datea && $_POST["percentage"] == 0) { $error=1; @@ -325,7 +332,8 @@ if ($_POST["action"] == 'update') $actioncomm->dateend = $datea2; $actioncomm->percentage = $_POST["percentage"]; $actioncomm->priority = $_POST["priority"]; - $actioncomm->societe->id = $_POST["socid"]; + $actioncomm->location = isset($_POST["location"])?$_POST["location"]:''; + $actioncomm->societe->id = $_POST["socid"]; $actioncomm->contact->id = $_POST["contactid"]; $actioncomm->note = $_POST["note"]; @@ -416,9 +424,9 @@ if ($_GET["action"] == 'create') else print "<br>"; print '<table class="border" width="100%">'; - + // Type d'action actifs - print '<tr><td><b>'.$langs->trans("Type").'*</b></td><td>'; + print '<tr><td width="30%"><b>'.$langs->trans("Type").'*</b></td><td>'; if ($_GET["actioncode"]) { print '<input type="hidden" name="actioncode" value="'.$_GET["actioncode"].'">'."\n"; @@ -431,10 +439,18 @@ if ($_GET["action"] == 'create') } print '</td></tr>'; + // Title print '<tr><td>'.$langs->trans("Title").'</td><td><input type="text" name="label" size="30" value="'.$actioncomm->label.'"></td></tr>'; - + + // Location + print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" size="30" value="'.$actioncomm->location.'"></td></tr>'; + + print '</table>'; + print '<br>'; + print '<table class="border" width="100%">'; + // Societe, contact - print '<tr><td nowrap>'.$langs->trans("ActionOnCompany").'</td><td>'; + print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("ActionOnCompany").'</td><td>'; if ($_REQUEST["socid"] > 0) { $societe = new Societe($db); @@ -466,13 +482,17 @@ if ($_GET["action"] == 'create') $html->select_users($_REQUEST["doneby"]?$_REQUEST["doneby"]:$actioncomm->userdone,'doneby',1); print '</td></tr>'; + print '</table>'; + print '<br>'; + print '<table class="border" width="100%">'; + if (! empty($_GET["datep"]) && eregi('^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$',$_GET["datep"],$reg)) { $actioncomm->datep=dolibarr_mktime(0,0,0,$reg[2],$reg[3],$reg[1]); } // Date start - print '<tr><td nowrap="nowrap">'.$langs->trans("DateActionStart").'</td><td>'; + print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("DateActionStart").'</td><td>'; if ($_REQUEST["afaire"] == 1) $html->select_date($actioncomm->datep,'ap',1,1,0,"action"); else if ($_REQUEST["afaire"] == 2) $html->select_date($actioncomm->datep,'ap',1,1,1,"action"); else $html->select_date($actioncomm->datep,'ap',1,1,1,"action"); @@ -618,9 +638,20 @@ if ($_GET["id"]) if (! empty($_REQUEST["backtopage"])) print '<input type="hidden" name="from" value="'.($_REQUEST["from"] ? $_REQUEST["from"] : $_SERVER["HTTP_REFERER"]).'">'; print '<table class="border" width="100%">'; + + // Ref print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$act->id.'</td></tr>'; + + // Type print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>'; + + // Title print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$act->label.'"></td></tr>'; + + // Location + print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.$act->location.'"></td></tr>'; + + // Company print '<tr><td>'.$langs->trans("Company").'</td>'; print '<td>'; print $html->select_societes($act->societe->id,'socid',1,1); @@ -712,10 +743,13 @@ if ($_GET["id"]) // Type print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>'; - // Libelle + // Title print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>'; - - // Societe - contact + + // Location + print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3">'.$act->location.'</td></tr>'; + + // Societe - contact print '<tr><td>'.$langs->trans("Company").'</td><td>'.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None")).'</td>'; print '<td>'.$langs->trans("Contact").'</td>'; print '<td>'; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 1e8db697af524a9e8a8c36a0ee065555b6ef5909..7fb9d05a2786b9f7cf262747aa9dfd6c9bf4c44f 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -8,6 +8,7 @@ Calendars = Calendars AffectedTo = Affected to DoneBy = Done by Events = Events +Location=Location SearchAnAction = Search an action/task MenuToDoActions = All uncomplete actions MenuDoneActions = All terminated actions diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index d023ba8976304d002ef3809cc79d7fbbd3797869..b375385448db5c8faa583db6b9bf669f87a49941 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -8,6 +8,7 @@ Calendars=Calendriers AffectedTo=Affect� � DoneBy=R�alis� par Events=Ev�nements +Location=Lieu SearchAnAction=Rechercher une action/tache MenuToDoActions=Les actions incompl�tes MenuDoneActions=Les actions termin�es diff --git a/htdocs/lib/xcal.lib.php b/htdocs/lib/xcal.lib.php index 1acf1f06b22b90a4c6fe8fb103d0f96921952a78..8b2e5add84329e2438625a1dffc88408e7a16f9a 100644 --- a/htdocs/lib/xcal.lib.php +++ b/htdocs/lib/xcal.lib.php @@ -67,7 +67,7 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi if ($eventqualified) { // See http://fr.wikipedia.org/wiki/ICalendar for format - //$uid = dolibarr_print_date($now,'dayhourxcard',true).'-'.$event['uid']."-export@".$_SERVER["SERVER_NAME"]; + // See http://www.ietf.org/rfc/rfc2445.txt for RFC $uid = $event['uid']; $type = $event['type']; $startdate = $event['startdate']; @@ -78,7 +78,7 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi $location = $event['location']; $email = $event['email']; $url = $event['url']; - $transparency = $event['transparency']; + $transparency = $event['transparency']; // OPAQUE or TRANSPARENT $description=eregi_replace('<br[ \/]?>',"\n",$event['desc']); $description=clean_html($description,0); // Remove html tags @@ -134,9 +134,7 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi / "CANCELLED" ;Indicates journal is removed. ;Status values for "VJOURNAL". */ - if (! empty($category)) fwrite($calfileh,"CATEGORIES:".$encoding.$category."\n"); if (! empty($location)) fwrite($calfileh,"LOCATION:".$encoding.$location."\n"); - //fwrite($calfileh,"TRANSP:".$transparency."\n"); //fwrite($calfileh,"CLASS:PUBLIC\n"); // PUBLIC, PRIVATE, CONFIDENTIAL // Date must be GMT dates @@ -146,6 +144,9 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$fi if (empty($enddate)) $enddate=$startdate+$duration; $enddatef = dolibarr_print_date($enddate,'dayhourxcard',true); fwrite($calfileh,"DTEND:".$enddatef."\n"); + + if (! empty($transparency)) fwrite($calfileh,"TRANSP:".$transparency."\n"); + if (! empty($category)) fwrite($calfileh,"CATEGORIES:".$encoding.$category."\n"); fwrite($calfileh,"END:VEVENT\n"); } diff --git a/mysql/migration/2.4.0-2.5.0.sql b/mysql/migration/2.4.0-2.5.0.sql index 98929dc3d6bba089d52c3d6e0a302adc27aee788..e4caf1e921aa5c88ef3f397b09c8dc2a859cae78 100644 --- a/mysql/migration/2.4.0-2.5.0.sql +++ b/mysql/migration/2.4.0-2.5.0.sql @@ -1,8 +1,9 @@ -- -- $Id$ -- --- Attention � l ordre des requetes. --- Ce fichier doit �tre charg� sur une version 2.4.0 +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 2.4.0 or higher. -- alter table llx_product add column price_min double(24,8) DEFAULT 0; @@ -16,3 +17,7 @@ alter table llx_societe add column gencod varchar(255); delete from llx_user_param where page <> ''; alter table llx_expedition add tracking_number varchar(50) after fk_expedition_methode; + +alter table llx_actioncomm add column location varchar(128) after percent; + + diff --git a/mysql/tables/llx_actioncomm.sql b/mysql/tables/llx_actioncomm.sql index 1ce9451faf8cbc825e07c03e09e8e1b6a02a60f4..c2f55bb02f847f9a5f15f6d589fe42cc8f13dc5a 100644 --- a/mysql/tables/llx_actioncomm.sql +++ b/mysql/tables/llx_actioncomm.sql @@ -25,9 +25,9 @@ create table llx_actioncomm ( id integer AUTO_INCREMENT PRIMARY KEY, datep datetime, -- date debut planifiee - datep2 datetime, -- date fin planifiee si action non ponctuelle + datep2 datetime, -- deprecated datea datetime, -- date debut realisation - datea2 datetime, -- date fin realisation si action non ponctuelle + datea2 datetime, -- deprecated fk_action integer, -- type de l'action label varchar(50) NOT NULL, -- libelle de l'action @@ -47,8 +47,9 @@ create table llx_actioncomm priority smallint, punctual smallint NOT NULL default 1, percent smallint NOT NULL default 0, + location varchar(128), durationp real, -- duree planifiee - durationa real, -- duree reellement passee + durationa real, -- deprecated note text, propalrowid integer,