From dd864530201d3eb3c2ae9e5dfe3da26276898c8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Sep 2014 17:54:03 +0200 Subject: [PATCH] Add field color into table of type of events --- htdocs/admin/dict.php | 8 ++++---- htdocs/comm/action/class/actioncomm.class.php | 3 ++- htdocs/comm/action/peruser.php | 16 +++++++++++++++- htdocs/core/class/html.form.class.php | 6 ++++-- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 ++ htdocs/install/mysql/tables/llx_c_actioncomm.sql | 3 ++- 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d9ebddf2b22..dd8fa456600 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -133,7 +133,7 @@ $tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libe $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; $tabsql[4] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_country"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; -$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; +$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; $tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; $tabsql[9] = "SELECT code_iso as code, label, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies"; @@ -187,7 +187,7 @@ $tabfield[2] = "code,libelle,region_id,region,country"; // "code,libelle,regio $tabfield[3] = "code,libelle,country_id,country"; $tabfield[4] = "code,label"; $tabfield[5] = "code,label"; -$tabfield[6] = "code,libelle,type,position"; +$tabfield[6] = "code,libelle,type,color,position"; $tabfield[7] = "code,libelle,country_id,country,accountancy_code,deductible"; $tabfield[8] = "code,libelle,country_id,country"; $tabfield[9] = "code,label,unicode"; @@ -214,7 +214,7 @@ $tabfieldvalue[2] = "code,libelle,region"; // "code,libelle,region" $tabfieldvalue[3] = "code,libelle,country"; $tabfieldvalue[4] = "code,label"; $tabfieldvalue[5] = "code,label"; -$tabfieldvalue[6] = "code,libelle,type,position"; +$tabfieldvalue[6] = "code,libelle,type,color,position"; $tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible"; $tabfieldvalue[8] = "code,libelle,country"; $tabfieldvalue[9] = "code,label,unicode"; @@ -241,7 +241,7 @@ $tabfieldinsert[2] = "code_departement,nom,fk_region"; $tabfieldinsert[3] = "code_region,nom,fk_pays"; $tabfieldinsert[4] = "code,label"; $tabfieldinsert[5] = "code,label"; -$tabfieldinsert[6] = "code,libelle,type,position"; +$tabfieldinsert[6] = "code,libelle,type,color,position"; $tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible"; $tabfieldinsert[8] = "code,libelle,fk_country"; $tabfieldinsert[9] = "code_iso,label,unicode"; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index b12dc5fb702..ffe07614b7d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -66,11 +66,12 @@ class ActionComm extends CommonObject var $usertodo; // Object user of owner var $userdone; // Object user that did action (deprecated) + var $socid; + var $contactid; var $societe; // Company linked to action (optional) var $contact; // Contact linked to action (optional) var $fk_project; // Id of project (optional) - // Properties for links to other objects var $fk_element; // Id of record var $elementtype; // Type of record. This if property ->element of object linked to. diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 22f968e2b4a..f6a616d3496 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -410,6 +410,8 @@ if ($resql) $event->location=$obj->location; $event->transparency=$obj->transparency; + $event->socid=$obj->fk_soc; + $event->contactid=$obj->fk_contact; $event->societe->id=$obj->fk_soc; $event->contact->id=$obj->fk_contact; @@ -779,7 +781,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } //$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd; - // Show rect of event + // Define all rects with event (cases1 is first half hour, cases2 is second half hour) for ($h = $begin_h; $h < $end_h; $h++) { $color = ''; //init @@ -797,12 +799,22 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $busy=$event->transparency; $cases1[$h][$event->id]['busy']=$busy; $cases1[$h][$event->id]['string']=dol_print_date($event->date_start_in_calendar,'dayhour').' - '.dol_print_date($event->date_end_in_calendar,'dayhour').' - '.$event->label; + $cases1[$h][$event->id]['typecode']=$event->type_code; + if ($event->socid) + { + $cases1[$h][$event->id]['string'].='xxx'; + } } if ($event->date_start_in_calendar < $c && $dateendtouse > $b) { $busy=$event->transparency; $cases2[$h][$event->id]['busy']=$busy; $cases2[$h][$event->id]['string']=dol_print_date($event->date_start_in_calendar,'dayhour').' - '.dol_print_date($event->date_end_in_calendar,'dayhour').' - '.$event->label; + $cases1[$h][$event->id]['typecode']=$event->type_code; + if ($event->socid) + { + $cases2[$h][$event->id]['string'].='xxx'; + } } } else @@ -812,6 +824,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases2[$h][$event->id]['busy']=$busy; $cases1[$h][$event->id]['string']=$event->label; $cases2[$h][$event->id]['string']=$event->label; + $cases1[$h][$event->id]['typecode']=$event->type_code; + $cases2[$h][$event->id]['typecode']=$event->type_code; break; } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 08f384612f7..0233706928c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -804,8 +804,10 @@ class Form // Construct $out and $outarray $out.= '