diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php
index 115d015608d..3ab2cadd26e 100644
--- a/htdocs/actioncomm.class.php
+++ b/htdocs/actioncomm.class.php
@@ -42,8 +42,9 @@ class ActionComm
var $type;
var $label;
var $datec; // Date creation enregistrement
- var $datep; // Date action 0%
- var $date; // Date action 100% (datea)
+ var $datep; // Date action planifie debut
+ var $datef; // Date action planifie fin
+ var $date; // Date action realise completement (datea)
var $datem; // Date modif (tms)
var $priority;
var $user;
@@ -85,13 +86,13 @@ class ActionComm
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm";
$sql.= "(datec,";
- if ($this->percent < 100) $sql.= "datep,";
- if ($this->percent == 100) $sql.= "datea,";
+ if ($this->date_p) $sql.= "datep,";
+ if ($this->date_a) $sql.= "datea,";
$sql.= "fk_action,fk_soc,note,fk_contact,fk_user_author,fk_user_action,label,percent,priority,";
$sql.= "fk_facture,propalrowid,fk_commande)";
$sql.= " VALUES (now(),";
- if ($this->percent < 100) $sql.= "'".$this->db->idate($this->date)."',";
- if ($this->percent == 100) $sql.= "'".$this->db->idate($this->date)."',";
+ if ($this->date_p) $sql.= "'".$this->db->idate($this->date_p)."',";
+ if ($this->date_a) $sql.= "'".$this->db->idate($this->date_a)."',";
$sql.= "'".$this->type_id."', '".$this->societe->id."' ,'".addslashes($this->note)."',";
$sql.= ($this->contact->id?$this->contact->id:"null").",";
$sql.= "'$author->id', '".$this->user->id ."', '".addslashes($this->label)."','".$this->percent."','".$this->priority."',";
diff --git a/htdocs/cactioncomm.class.php b/htdocs/cactioncomm.class.php
index 82d2f86cc4b..12499ad595d 100644
--- a/htdocs/cactioncomm.class.php
+++ b/htdocs/cactioncomm.class.php
@@ -98,50 +98,58 @@ class CActioncomm {
}
}
- /*
- * \brief Renvoi la liste des types d'actions existant
- * \param active 1 ou 0 pour un filtre sur l'etat actif ou non ('' par defaut = pas de filtre)
- * \return array tableau des types d'actions actifs si ok, <0 si erreur
- */
- function liste_array($active='')
- {
- global $langs;
- $langs->load("commercial");
-
- $ga = array();
-
- $sql = "SELECT id, code, libelle";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
- if ($active != '') {
- $sql.=" WHERE active=$active";
- }
- $sql .= " ORDER BY id";
-
- $resql=$this->db->query($sql);
- if ($resql)
- {
- $nump = $this->db->num_rows($resql);
-
- if ($nump)
- {
- $i = 0;
- while ($i < $nump)
- {
- $obj = $this->db->fetch_object($resql);
-
- $transcode=$langs->trans("Action".$obj->code);
- $ga[$obj->id] = ($transcode!="Action".$obj->code?$transcode:$obj->libelle);
- $i++;
- }
- }
- $this->liste_array=$ga;
- return $ga;
- }
- else
- {
- return -1;
- }
- }
+ /*
+ * \brief Renvoi la liste des types d'actions existant
+ * \param active 1 ou 0 pour un filtre sur l'etat actif ou non ('' par defaut = pas de filtre)
+ * \return array tableau des types d'actions actifs si ok, <0 si erreur
+ */
+ function liste_array($active='')
+ {
+ global $langs,$conf;
+ $langs->load("commercial");
+
+ $ga = array();
+
+ $sql = "SELECT id, code, libelle, module";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
+ if ($active != '')
+ {
+ $sql.=" WHERE active=".$active;
+ }
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $nump = $this->db->num_rows($resql);
+ if ($nump)
+ {
+ $i = 0;
+ while ($i < $nump)
+ {
+ $obj = $this->db->fetch_object($resql);
+ $qualified=1;
+ if ($obj->module)
+ {
+ if ($obj->module == 'invoice' && ! $conf->facture->enabled) $qualified=0;
+ if ($obj->module == 'order' && ! $conf->commande->enabled) $qualified=0;
+ if ($obj->module == 'propal' && ! $conf->propal->enabled) $qualified=0;
+ }
+ if ($qualified)
+ {
+ $transcode=$langs->trans("Action".$obj->code);
+ $ga[$obj->id] = ($transcode!="Action".$obj->code?$transcode:$obj->libelle);
+ }
+ $i++;
+ }
+ }
+ $this->liste_array=$ga;
+ return $ga;
+ }
+ else
+ {
+ return -1;
+ }
+ }
/*
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 9ab58d5b157..1471e5d6fce 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -78,7 +78,7 @@ if ($_POST["action"] == 'add_action')
$actioncomm->type_id = $_POST["actionid"];
$actioncomm->type_code = $cactioncomm->code;
$actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0;
- $actioncomm->label = $_POST["label"];
+ $actioncomm->label = trim($_POST["label"]);
if (! $_POST["label"])
{
if ($_POST["actionid"] == 5 && $contact->fullname)
@@ -93,16 +93,28 @@ if ($_POST["action"] == 'add_action')
}
}
}
- $actioncomm->date = mktime($_POST["heurehour"],
- $_POST["heuremin"],
- 0,
- $_POST["acmonth"],
- $_POST["acday"],
- $_POST["acyear"]);
- $actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
$actioncomm->percent = isset($_POST["percentage"])?$_POST["percentage"]:0;
+ if ($actioncomm->percent < 100)
+ {
+ $actioncomm->date_p = @mktime($_POST["heurephour"],
+ $_POST["heurepmin"],
+ 0,
+ $_POST["apmonth"],
+ $_POST["apday"],
+ $_POST["apyear"]);
+ }
+ if ($actioncomm->percent == 100)
+ {
+ $actioncomm->date_a = @mktime($_POST["heuredhour"],
+ $_POST["heuredmin"],
+ 0,
+ $_POST["admonth"],
+ $_POST["adday"],
+ $_POST["adyear"]);
+ }
+ $actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
$actioncomm->user = $user;
- $actioncomm->note = $_POST["note"];
+ $actioncomm->note = trim($_POST["note"]);
if (isset($_POST["contactid"])) $actioncomm->contact = $contact;
if (isset($_POST["socid"])) $actioncomm->societe = $societe;
if ($_POST["todo_webcal"] == 'on') $actioncomm->use_webcal=1;
@@ -115,7 +127,8 @@ if ($_POST["action"] == 'add_action')
if (! $actioncomm->error)
{
$db->commit();
- Header("Location: ".$_POST["from"]);
+ if ($_POST["from"]) Header("Location: ".$_POST["from"]);
+ else Header("Location: ".DOL_URL_ROOT.'/comm/action/fiche.php?id='.$idaction);
exit;
}
else
@@ -129,12 +142,13 @@ if ($_POST["action"] == 'add_action')
else
{
$db->rollback();
- dolibarr_print_error($db);
+ $error=$actioncomm->error;
}
}
else
{
- dolibarr_print_error('',"Le type d'action n'a pas été choisi");
+ $_GET["action"] = 'create';
+ $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'
';
}
}
@@ -187,200 +201,288 @@ $html = new Form($db);
if ($_GET["action"] == 'create')
{
- $caction = new CActioncomm($db);
-
- if ($_GET["contactid"])
- {
- $contact = new Contact($db);
- $contact->fetch($_GET["contactid"]);
- }
+ $caction = new CActioncomm($db);
- print '";
+ }
+ print "";
}
/*
@@ -448,9 +550,15 @@ if ($_GET["id"])
$html->select_array("contactid", $act->societe->contact_array(), $act->contact->id, 1);
print '';
- // Auteur
- print '| '.$langs->trans("Author").' | ';
- print ''.img_object($langs->trans("ShowUser"),'user').' '.$act->author->fullname.' |
';
+ // Affecte a
+ print '| '.$langs->trans("ActionAffectedTo").' | ';
+ print $langs->trans("FeatureNotYetSupported");
+ print ' |
';
+
+ // Realise par
+ print '| '.$langs->trans("ActionDoneBy").' | ';
+ print $langs->trans("FeatureNotYetSupported");
+ print ' |
';
// Date debut
print '| '.$langs->trans("DateActionPlanned").' | '.dolibarr_print_date($act->datep,'%d %B %Y %H:%M').' |
';
@@ -458,7 +566,10 @@ if ($_GET["id"])
// Date fin real
print '| '.$langs->trans("DateActionDone").' | '.dolibarr_print_date($act->date,'%d %B %Y %H:%M').' |
';
+ // Etat
print '| '.$langs->trans("Status").' / '.$langs->trans("Percentage").' | % |
';
+
+ // Objet lié
if ($act->objet_url)
{
print '| '.$langs->trans("LinkedObject").' | ';
@@ -467,7 +578,19 @@ if ($_GET["id"])
// Note
print '
| '.$langs->trans("Note").' | ';
- print ' |
';
+ if ($conf->fckeditor->enabled)
+ {
+ // Editeur wysiwyg
+ require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+ $doleditor=new DolEditor('note','',280,'dolibarr_notes','In',true);
+ $doleditor->Create();
+ }
+ else
+ {
+ print '';
+ }
+
+ print '';
print '| ';
print ' ';
@@ -497,9 +620,15 @@ if ($_GET["id"])
print ' |
';
- // Auteur
- print '| '.$langs->trans("Author").' | ';
- print ''.img_object($langs->trans("ShowUser"),'user').' '.$act->author->fullname.' |
';
+ // Affecte a
+ print '| '.$langs->trans("ActionAffectedTo").' | ';
+ print $langs->trans("FeatureNotYetSupported");
+ print ' |
';
+
+ // Realise par
+ print '| '.$langs->trans("ActionDoneBy").' | ';
+ print $langs->trans("FeatureNotYetSupported");
+ print ' |
';
// Date debut
print '| '.$langs->trans("DateActionPlanned").' | '.dolibarr_print_date($act->datep,'%d %B %Y %H:%M').' |
';
@@ -521,7 +650,8 @@ if ($_GET["id"])
// Note
print '| '.$langs->trans("Note").' | ';
- print nl2br($act->note).' |
';
+ print nl2br($act->note);
+ print '';
print '';
}
diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang
index dcbe32d42fa..a6710442ce3 100644
--- a/htdocs/langs/en_US/commercial.lang
+++ b/htdocs/langs/en_US/commercial.lang
@@ -55,6 +55,8 @@ LastProspectContactInProcess=Contact in process
LastProspectContactDone=Contact done
DateActionPlanned=Date planned
DateActionDone=Date done
+ActionAffectedTo=Action affected to
+ActionDoneBy=Action done by
ActionAC_TEL=Phone call
ActionAC_FAX=Send fax
ActionAC_PROP=Send proposal
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index df082609892..af1dc837a4e 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -332,6 +332,7 @@ Redo=Redo
ExpandAll=Expand all
UndoExpandAll=Undo expand
Reason=Raison
+FeatureNotYetSupported=Feature not yet supported
# Countries
CountryFR=France
CountryBE=Belgium
diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang
index cfc587df0ea..6995a4e3860 100644
--- a/htdocs/langs/fr_FR/commercial.lang
+++ b/htdocs/langs/fr_FR/commercial.lang
@@ -55,6 +55,8 @@ LastProspectContactInProcess=Contact en cours
LastProspectContactDone=Prospects contactés
DateActionPlanned=Date planification
DateActionDone=Date réalisation
+ActionAffectedTo=Action affectée à
+ActionDoneBy=Action faite par
ActionAC_TEL=Appel téléphonique
ActionAC_FAX=Envoi fax
ActionAC_PROP=Envoi proposition par mail
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index 4d08633065b..eb8a19715a6 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -332,6 +332,7 @@ Redo=Refaire
ExpandAll=Tout dérouler
UndoExpandAll=Annuler déroulement
Reason=Raison
+FeatureNotYetSupported=Fonctionnalité pas encore supportée
# Countries
CountryFR=France
CountryBE=Belgique
diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php
index b5cd4abe42a..d87e65564d3 100644
--- a/htdocs/lib/functions.inc.php
+++ b/htdocs/lib/functions.inc.php
@@ -1692,21 +1692,21 @@ function print_fleche_navigation($page,$file,$options='',$nextpage)
\param begin (1 par defaut)
\param end (23 par defaut)
*/
-function print_heure_select($prefix,$begin=1,$end=23) {
-
- print ' H ";
- print '\n";
+function print_heure_select($prefix,$begin=1,$end=23)
+{
+ print ' H ";
+ print '\n";
}
/**
diff --git a/mysql/data/data.sql b/mysql/data/data.sql
index d215663fbf2..bf1fc4ab725 100644
--- a/mysql/data/data.sql
+++ b/mysql/data/data.sql
@@ -315,15 +315,14 @@ insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype,
--
delete from llx_c_actioncomm;
-insert into llx_c_actioncomm (id, code, type, libelle) values ( 1, 'AC_TEL', 'system', 'Appel Téléphonique');
-insert into llx_c_actioncomm (id, code, type, libelle) values ( 2, 'AC_FAX', 'system', 'Envoi Fax');
-insert into llx_c_actioncomm (id, code, type, libelle) values ( 3, 'AC_PROP', 'system', 'Envoi Proposition');
-insert into llx_c_actioncomm (id, code, type, libelle) values ( 4, 'AC_EMAIL','system', 'Envoi Email');
-insert into llx_c_actioncomm (id, code, type, libelle) values ( 5, 'AC_RDV', 'system', 'Prendre rendez-vous');
-insert into llx_c_actioncomm (id, code, type, libelle) values ( 8, 'AC_COM', 'system', 'Envoi Commande');
-insert into llx_c_actioncomm (id, code, type, libelle) values ( 9, 'AC_FAC', 'system', 'Envoi Facture');
-insert into llx_c_actioncomm (id, code, type, libelle) values (10, 'AC_REL', 'system', 'Relance effectuée');
-insert into llx_c_actioncomm (id, code, type, libelle) values (11, 'AC_CLO', 'system', 'Clôture');
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 1, 'AC_TEL', 'system', 'Appel Téléphonique' ,NULL);
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 2, 'AC_FAX', 'system', 'Envoi Fax' ,NULL);
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 3, 'AC_PROP', 'system', 'Envoi Proposition' ,'propal');
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 4, 'AC_EMAIL','system', 'Envoi Email' ,NULL);
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 5, 'AC_RDV', 'system', 'Rendez-vous' ,NULL);
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 8, 'AC_COM', 'system', 'Envoi Commande' ,'order');
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 9, 'AC_FAC', 'system', 'Envoi Facture' ,'invoice');
+insert into llx_c_actioncomm (id, code, type, libelle, module) values (50, 'AC_OTH', 'system', 'Autre' ,NULL);
--
-- Ape
diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql
index e00848d8ef0..d00247410fb 100644
--- a/mysql/migration/2.0.0-2.1.0.sql
+++ b/mysql/migration/2.0.0-2.1.0.sql
@@ -82,12 +82,28 @@ alter table llx_categorie drop column fk_statut;
alter table llx_categorie add visible tinyint DEFAULT 1 NOT NULL;
+alter table llx_c_actioncomm add module varchar(16) DEFAULT NULL after libelle;
+
+delete from llx_c_actioncomm;
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 1, 'AC_TEL', 'system', 'Appel Téléphonique' ,NULL);
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 2, 'AC_FAX', 'system', 'Envoi Fax' ,NULL);
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 3, 'AC_PROP', 'system', 'Envoi Proposition' ,'propal');
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 4, 'AC_EMAIL','system', 'Envoi Email' ,NULL);
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 5, 'AC_RDV', 'system', 'Rendez-vous' ,NULL);
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 8, 'AC_COM', 'system', 'Envoi Commande' ,'order');
+insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 9, 'AC_FAC', 'system', 'Envoi Facture' ,'invoice');
+insert into llx_c_actioncomm (id, code, type, libelle, module) values (50, 'AC_OTH', 'system', 'Autre' ,NULL);
+
alter table llx_actioncomm modify datea datetime;
alter table llx_actioncomm add column datec datetime after id;
alter table llx_actioncomm add column datep datetime after datec;
alter table llx_actioncomm add column tms timestamp after datea;
+alter table llx_actioncomm add column fk_commande integer after propalrowid;
+
update llx_actioncomm set datec = datea where datec is null;
update llx_actioncomm set datep = datea where datep is null;
+update llx_actioncomm set fk_action = '8' where fk_action = '3' and label = 'Envoi commande par mail';
+
drop table if exists llx_expedition_model_pdf;
@@ -237,7 +253,6 @@ delete from llx_document_model where nom='transporteur' and type='shipping';
delete from llx_document_model where nom='dorade' and type='shipping';
-alter table llx_actioncomm add column fk_commande integer after propalrowid;
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber);
@@ -365,9 +380,6 @@ ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_factur
update llx_societe_remise_except set description='Remise sans description' where description is NULL or description ='';
alter table llx_societe_remise_except modify description varchar(255) NOT NULL;
-insert into llx_c_actioncomm (id, code, type, libelle) values ( 8, 'AC_COM', 'system', 'Envoi Commande');
-update llx_actioncomm set fk_action = '8' where fk_action = '3' and label = 'Envoi commande par mail';
-
insert into llx_const (name, value, type, visible, note) VALUES ('PROPALE_VALIDITY_DURATION', '15', 'chaine', 0, 'Durée de validitée des propales');
alter table llx_propal add column ref_client varchar(30) after ref;
diff --git a/mysql/tables/llx_c_actioncomm.sql b/mysql/tables/llx_c_actioncomm.sql
index 480a6a6626b..bd739b195ff 100644
--- a/mysql/tables/llx_c_actioncomm.sql
+++ b/mysql/tables/llx_c_actioncomm.sql
@@ -27,6 +27,7 @@ create table llx_c_actioncomm
code varchar(12) UNIQUE NOT NULL,
type varchar(10) DEFAULT 'system' NOT NULL,
libelle varchar(30) NOT NULL,
+ module varchar(16) DEFAULT NULL,
active tinyint DEFAULT 1 NOT NULL,
todo tinyint
)type=innodb;