New: when adding an action, we can define a free code to tag it for

a specific need.
This commit is contained in:
Laurent Destailleur 2013-03-08 12:04:01 +01:00
parent b060e5961b
commit 2a67af3c94
7 changed files with 33 additions and 26 deletions

View File

@ -37,6 +37,7 @@ For developers:
- New: Add option dol_hide_topmenu and dol_hide_leftmenu onto login page.
- New: dol_syslog method accept a suffix to use different log files for log.
- New: Type of fields are received by export format handlers
- New: when adding an action, we can define a free code to tag it for a specific need.
For translators:
- Update language files.

View File

@ -38,9 +38,11 @@ class ActionComm extends CommonObject
protected $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id;
var $type_id;
var $type_code;
var $type;
var $type_id; // id into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
var $type; // label into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
var $code;
var $label;
var $date;
@ -165,11 +167,9 @@ class ActionComm extends CommonObject
$sql.= "(datec,";
$sql.= "datep,";
$sql.= "datep2,";
//$sql.= "datea,";
//$sql.= "datea2,";
$sql.= "durationp,";
//$sql.= "durationa,";
$sql.= "fk_action,";
$sql.= "code,";
$sql.= "fk_soc,";
$sql.= "fk_project,";
$sql.= "note,";
@ -185,11 +185,9 @@ class ActionComm extends CommonObject
$sql.= "'".$this->db->idate($now)."',";
$sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").",";
$sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").",";
//$sql.= (strval($this->date)!=''?"'".$this->db->idate($this->date)."'":"null").",";
//$sql.= (strval($this->dateend)!=''?"'".$this->db->idate($this->dateend)."'":"null").",";
$sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").",";
//$sql.= ($this->durationa >= 0 && $this->durationa != ''?"'".$this->durationa."'":"null").",";
$sql.= " '".$this->type_id."',";
$sql.= " '".$this->code."',";
$sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").",";
$sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").",";
$sql.= " '".$this->db->escape($this->note)."',";
@ -277,7 +275,7 @@ class ActionComm extends CommonObject
$sql.= " a.datec,";
$sql.= " a.durationp,";
$sql.= " a.tms as datem,";
$sql.= " a.note, a.label,";
$sql.= " a.code, a.label, a.note,";
$sql.= " a.fk_soc,";
$sql.= " a.fk_project,";
$sql.= " a.fk_user_author, a.fk_user_mod,";
@ -305,12 +303,14 @@ class ActionComm extends CommonObject
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext;
// Properties of parent table llx_c_actioncomm (will be deprecated in future)
$this->type_id = $obj->type_id;
$this->type_code = $obj->type_code;
$transcode=$langs->trans("Action".$obj->type_code);
$type_libelle=($transcode!="Action".$obj->type_code?$transcode:$obj->libelle);
$this->type = $type_libelle;
$this->code = $obj->code;
$this->label = $obj->label;
$this->datep = $this->db->jdate($obj->datep);
$this->datef = $this->db->jdate($obj->datep2);
@ -868,7 +868,7 @@ class ActionComm extends CommonObject
$sql.= " a.datep2,"; // End
$sql.= " a.durationp,";
$sql.= " a.datec, a.tms as datem,";
$sql.= " a.note, a.label, a.fk_action as type_id,";
$sql.= " a.label, a.code, a.note, a.fk_action as type_id,";
$sql.= " a.fk_soc,";
$sql.= " a.fk_user_author, a.fk_user_mod,";
$sql.= " a.fk_user_action, a.fk_user_done,";
@ -940,11 +940,7 @@ class ActionComm extends CommonObject
$event=array();
$event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"];
$event['type']=$type;
//$datestart=$obj->datea?$obj->datea:$obj->datep;
//$dateend=$obj->datea2?$obj->datea2:$obj->datep2;
//$duration=$obj->durationa?$obj->durationa:$obj->durationp;
$datestart=$this->db->jdate($obj->datep);
//print $datestart.'x'; exit;
$dateend=$this->db->jdate($obj->datep2);
$duration=$obj->durationp;
$event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":"");
@ -1050,6 +1046,7 @@ class ActionComm extends CommonObject
$this->specimen=1;
$this->type_code='AC_OTH';
$this->code='AC_SPECIMEN_CODE';
$this->label='Label of event Specimen';
$this->datec=$now;
$this->datem=$now;

View File

@ -563,7 +563,8 @@ class InterfaceActionsAuto
// Insertion action
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = $object->actiontypecode;
$actioncomm->type_code = $object->actiontypecode; // code of parent table llx_c_actioncomm (will be deprecated)
$actioncomm->code='AC_'.$action;
$actioncomm->label = $object->actionmsg2;
$actioncomm->note = $object->actionmsg;
$actioncomm->datep = $now;

View File

@ -31,15 +31,18 @@
--
delete from llx_c_actioncomm where id in (1,2,3,4,5,8,9,10,30,31,40,50);
-- Code used from 3.3+ when type of event is used
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 1,'AC_TEL','system','Phone call',NULL, 1, 2);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 2,'AC_FAX','system','Send Fax',NULL, 1, 3);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 3,'AC_PROP','systemauto', 'Send commercial proposal by email','propal',0,10);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 4,'AC_EMAIL','system','Send Email',NULL, 1, 4);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 5,'AC_RDV','system','Rendez-vous',NULL, 1, 1);
-- Code kept for backward compatibility < 3.3
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 3,'AC_PROP','systemauto', 'Send commercial proposal by email','propal',0,10);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 8,'AC_COM','systemauto','Send customer order by email','order', 0,8);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 9,'AC_FAC','systemauto', 'Send customer invoice by email','invoice',0,6);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 10,'AC_SHIP','systemauto', 'Send shipping by email','shipping',0,11);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 30,'AC_SUP_ORD','systemauto','Send supplier order by email','order_supplier',0,9);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 31,'AC_SUP_INV','systemauto','Send supplier invoice by email','invoice_supplier',0,7);
-- Code used from 3.3+ when type of event is not used
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 40,'AC_OTH_AUTO','systemauto','Other (automatically inserted events)',NULL, 1, 20);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 50,'AC_OTH','system','Other (manually inserted events)',NULL, 1, 5);

View File

@ -11,8 +11,8 @@
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
-- To restrict request to Mysql version x.y use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y use -- VPGSQLx.y
-- To make a primary key (mysql): VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid INTEGER AUTO_INCREMENT PRIMARY_KEY;
-- To make a primary key (postgres) VPGSQL8.2 ALTER TABLE llx_table CHANGE COLUMN rowid INTEGER SERIAL PRIMARY KEY;
-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres) VPGSQL8.2 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER SERIAL PRIMARY KEY;
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
@ -82,8 +82,9 @@ alter table llx_societe_address CHANGE COLUMN cp zip varchar(10);
alter table llx_societe CHANGE COLUMN tel phone varchar(20);
ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description;
ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER NOT NULL;
-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER AUTO_INCREMENT PRIMARY_KEY;
ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL;
-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- VPGSQL8.2 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER SERIAL PRIMARY KEY;
ALTER TABLE llx_stock_mouvement MODIFY COLUMN value real;
@ -102,3 +103,5 @@ CREATE TABLE llx_c_revenuestamp
) ENGINE=innodb;
insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1);
ALTER TABLE llx_actioncomm ADD COLUMN code varchar(32) NULL after fk_action;

View File

@ -1,5 +1,5 @@
-- ============================================================================
-- Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
--
-- This program is free software; you can redistribute it and/or modify
@ -21,3 +21,4 @@
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datea (datea);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_soc (fk_soc);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_contact (fk_contact);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_code (code);

View File

@ -24,15 +24,16 @@ create table llx_actioncomm
(
id integer AUTO_INCREMENT PRIMARY KEY,
ref_ext varchar(128),
entity integer DEFAULT 1 NOT NULL, -- multi company id
entity integer DEFAULT 1 NOT NULL, -- multi company id
datep datetime, -- date debut planifiee
datep2 datetime, -- deprecated
datea datetime, -- date debut realisation
datea2 datetime, -- deprecated
fk_action integer, -- type de l'action
fk_action integer, -- type of action (optionnal link with llx_c_actioncomm or null)
code varchar(32) NULL, -- code of action for automatic action
label varchar(128) NOT NULL, -- libelle de l'action
datec datetime, -- date creation
tms timestamp, -- date modif
fk_user_author integer, -- id user qui a cree l'action