';
print '';
-
foreach($remainingdata as $datar)
{
$father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>'');
diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php
index 143ebc627f8..830b323545f 100644
--- a/htdocs/admin/modulehelp.php
+++ b/htdocs/admin/modulehelp.php
@@ -269,7 +269,7 @@ if ($objMod->isCoreOrExternalModule() == 'external')
$modulename=$objMod->getName();
$moduledesc=$objMod->getDesc();
$moduleauthor=$objMod->getPublisher();
-
+$moduledir=strtolower(preg_replace('/^mod/i','',get_class($objMod)));
print '';
@@ -449,11 +449,28 @@ if ($mode == 'feature')
$text.='
';
$text.='
'.$langs->trans("AddTriggers").': ';
+ $moreinfoontriggerfile='';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
- $text.=$langs->trans("Yes");
+ $yesno='Yes';
}
- else $text.=$langs->trans("No");
+ else
+ {
+ $yesno='No';
+ }
+ require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
+ $interfaces = new Interfaces($db);
+ $triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external')?'/'.$moduledir:'').'/core/triggers'));
+ foreach($triggers as $triggercursor)
+ {
+ if ($triggercursor['module'] == $moduledir)
+ {
+ $yesno='Yes';
+ $moreinfoontriggerfile=' ('.$triggercursor['relpath'].')';
+ }
+ }
+
+ $text.=$langs->trans($yesno).$moreinfoontriggerfile;
$text.='
';
diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php
index 516d9e41bb2..ac520ce22b3 100644
--- a/htdocs/admin/tools/listevents.php
+++ b/htdocs/admin/tools/listevents.php
@@ -260,11 +260,11 @@ if ($result)
print '
';
- print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("Code",$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("IP",$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("User",$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("Description",$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre('');
print " \n";
diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php
index c57a78974ed..6106fbe8dd8 100644
--- a/htdocs/admin/tools/listsessions.php
+++ b/htdocs/admin/tools/listsessions.php
@@ -128,12 +128,12 @@ if ($savehandler == 'files')
{
print '
';
print '';
- print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"login","","",'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("SessionId"),$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("DateModification"),$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Age"),$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Raw"),$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"login","","",'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("SessionId",$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("DateModification",$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("Age",$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("Raw",$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre('');
print " \n";
@@ -141,7 +141,7 @@ if ($savehandler == 'files')
foreach ($listofsessions as $key => $sessionentry)
{
-
+
print '';
diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php
index 5236315daf3..016d1ff8bb1 100644
--- a/htdocs/admin/translation.php
+++ b/htdocs/admin/translation.php
@@ -235,10 +235,10 @@ if ($mode == 'overwrite')
print '';
print '';
- print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("NewTranslationStringToShow"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
- //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
+ print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
+ print_liste_field_titre("Key",$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
+ print_liste_field_titre("NewTranslationStringToShow",$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
+ //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print ' ';
print " \n";
@@ -393,10 +393,10 @@ if ($mode == 'searchkey')
print '';
print '';
- print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'';
- print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("CurrentTranslationString"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
- //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
+ print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'';
+ print_liste_field_titre("Key",$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
+ print_liste_field_titre("CurrentTranslationString",$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
+ //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print ' ';
print " \n";
diff --git a/htdocs/api/index.php b/htdocs/api/index.php
index 905d560f9c2..9f734c9e24d 100644
--- a/htdocs/api/index.php
+++ b/htdocs/api/index.php
@@ -238,6 +238,7 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
{
$classfile = str_replace('_', '', $module);
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
+ if ($module == 'supplierorders') $classfile = 'supplier_orders';
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
$classname=ucwords($module);
diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php
index a192076e88a..c9387561837 100644
--- a/htdocs/bookmarks/list.php
+++ b/htdocs/bookmarks/list.php
@@ -101,19 +101,19 @@ if ($resql)
if ($optioncss != '') $param ='&optioncss='.$optioncss;
$moreforfilter='';
-
+
print '';
print '
'."\n";
-
+
print "";
//print " ";
- print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Link"),'','');
- print_liste_field_titre($langs->trans("Target"),'','','','','align="center"');
- print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre("Link",'','');
+ print_liste_field_titre("Target",'','','','','align="center"');
+ print_liste_field_titre("Owner",$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
+ print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
+ print_liste_field_titre("Position",$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print " \n";
@@ -122,7 +122,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
-
+
print '';
// Id
@@ -209,7 +209,7 @@ if ($resql)
}
print "
";
print '
';
-
+
$db->free($resql);
}
else
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 14ab91a2f31..16bb308c966 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -38,11 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
-if (! empty($conf->projet->enabled))
-{
- require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
- require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
-}
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
@@ -585,6 +582,8 @@ if ($action == 'mupdate')
* View
*/
+$formproject=new FormProjets($db);
+
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
@@ -786,8 +785,6 @@ if ($action == 'create')
// Project
if (! empty($conf->projet->enabled))
{
- $formproject=new FormProjets($db);
-
// Projet associe
$langs->load("projects");
@@ -1133,8 +1130,6 @@ if ($id > 0)
// Project
if (! empty($conf->projet->enabled))
{
- $formproject=new FormProjets($db);
-
$langs->load("projects");
print ''.$langs->trans("Project").' ';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 70b2acb86b7..f6d6b4a0975 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1194,7 +1194,7 @@ class ActionComm extends CommonObject
{
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
}
- $result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend;
+ $result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'class="valigntextbottom"':'class="classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1).$linkend;
}
if ($withpicto==1) $result.=' ';
$result.=$linkstart.$libelleshort.$linkend;
@@ -1498,5 +1498,22 @@ class ActionComm extends CommonObject
return $this->datep && ($this->datep < ($now - $conf->agenda->warning_delay));
}
+
+ /**
+ * Send reminders by emails
+ * CAN BE A CRON TASK
+ *
+ * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
+ */
+ public function sendEmailsReminder()
+ {
+ global $conf, $langs;
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+
+ return 0;
+ }
+
}
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index 59755728e81..c77c4279439 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -394,17 +394,17 @@ if ($resql)
print " \n";
print '';
- print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
- print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
- if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre($langs->trans("LinkedObject"),$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
+ print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
+ print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
+ print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
+ if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("");
print " \n";
diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php
index cd96a4fa8ad..b10ab8dc05b 100644
--- a/htdocs/comm/action/pertype.php
+++ b/htdocs/comm/action/pertype.php
@@ -30,15 +30,17 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
-if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
-$filter = GETPOST("filter",'',3);
+$filter = GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
@@ -55,7 +57,7 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page","int");
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
-$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
+$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec";
@@ -82,9 +84,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3);
-$status=GETPOST("status");
-$type=GETPOST("type");
-$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
+$status=GETPOST("status",'alpha');
+$type=GETPOST("type",'alpha');
+$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array'))
{
@@ -93,22 +95,22 @@ if (GETPOST('actioncode','array'))
}
else
{
- $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
+ $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
-$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
+$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
if ($dateselect > 0)
{
- $day=GETPOST('dateselectday');
- $month=GETPOST('dateselectmonth');
- $year=GETPOST('dateselectyear');
+ $day=GETPOST('dateselectday','int');
+ $month=GETPOST('dateselectmonth','int');
+ $year=GETPOST('dateselectyear','int');
}
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
$tmparray=explode('-',$tmp);
-$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
-$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
+$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
+$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
if ($end_h < 1 || $end_h > 24) $end_h = 18;
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
@@ -124,13 +126,13 @@ if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $ac
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
$action='show_month'; $day='';
} // View by month
-if (GETPOST('viewweek') || $action == 'show_week') {
+if (GETPOST('viewweek','alpha') || $action == 'show_week') {
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
} // View by week
-if (GETPOST('viewday') || $action == 'show_day') {
+if (GETPOST('viewday','alpha') || $action == 'show_day') {
$action='show_day'; $day=($day?$day:date("d"));
} // View by day
-if (GETPOST('viewyear') || $action == 'show_year') {
+if (GETPOST('viewyear','alpha') || $action == 'show_year') {
$action='show_year';
} // View by year
@@ -161,12 +163,12 @@ if ($action =='delete_action')
* View
*/
-$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
-llxHeader('',$langs->trans("Agenda"),$help_url);
-
$form=new Form($db);
$companystatic=new Societe($db);
+$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
+llxHeader('',$langs->trans("Agenda"),$help_url);
+
$now=dol_now();
$nowarray=dol_getdate($now);
$nowyear=$nowarray['year'];
@@ -354,7 +356,7 @@ $sql.= ' a.datep2,';
$sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
-$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
+$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
$sql.= ' ca.code, ca.color';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@@ -456,11 +458,14 @@ if ($resql)
continue;
}
+ $datep=$db->jdate($obj->datep);
+ $datep2=$db->jdate($obj->datep2);
+
// Create a new object action
$event=new ActionComm($db);
$event->id=$obj->id;
- $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
- $event->datef=$db->jdate($obj->datep2);
+ $event->datep=$datep; // datep and datef are GMT date
+ $event->datef=$datep2;
$event->type_code=$obj->code;
$event->type_color=$obj->color;
//$event->libelle=$obj->label; // deprecated
@@ -469,12 +474,13 @@ if ($resql)
//$event->author->id=$obj->fk_user_author; // user id of creator
$event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner
- $event->fetch_userassigned(); // This load $event->userassigned
$event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location;
$event->transparency=$obj->transparency;
+ $event->fk_project=$obj->fk_project;
+
$event->socid=$obj->fk_soc;
$event->contactid=$obj->fk_contact;
//$event->societe->id=$obj->fk_soc; // deprecated
@@ -487,15 +493,15 @@ if ($resql)
// They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0)
{
- $event->date_start_in_calendar=$event->datep;
- if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
- else $event->date_end_in_calendar=$event->datep;
+ $event->date_start_in_calendar=$datep;
+ if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
+ else $event->date_end_in_calendar=$datep;
}
else
- {
- $event->date_start_in_calendar=$event->datep;
- if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
- else $event->date_end_in_calendar=$event->datep;
+ {
+ $event->date_start_in_calendar=$datep;
+ if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
+ else $event->date_end_in_calendar=$datep;
}
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
@@ -508,10 +514,14 @@ if ($resql)
$event->date_start_in_calendar >= $lastdaytoshow)
{
// This record is out of visible range
+ unset($event);
}
else
{
- if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
+ //print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').' '."\n";
+ $event->fetch_userassigned(); // This load $event->userassigned
+
+ if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
// Add an entry in actionarray for each day
@@ -881,11 +891,37 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
$cases1[$h][$event->id]['string'].=' - '.$event->label;
$cases1[$h][$event->id]['typecode']=$event->type_code;
- if ($event->socid)
- {
- //$cases1[$h][$event->id]['string'].='xxx';
- }
$cases1[$h][$event->id]['color']=$color;
+ if ($event->fk_project > 0)
+ {
+ if (empty($cache_project[$event->fk_project]))
+ {
+ $tmpproj=new Project($db);
+ $tmpproj->fetch($event->fk_project);
+ $cache_project[$event->fk_project]=$tmpproj;
+ }
+ $cases1[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
+ }
+ if ($event->socid > 0)
+ {
+ if (empty($cache_thirdparty[$event->socid]))
+ {
+ $tmpthirdparty=new Societe($db);
+ $tmpthirdparty->fetch($event->socid);
+ $cache_thirdparty[$event->socid]=$tmpthirdparty;
+ }
+ $cases1[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
+ }
+ if ($event->contactid > 0)
+ {
+ if (empty($cache_contact[$event->contactid]))
+ {
+ $tmpcontact=new Contact($db);
+ $tmpcontact->fetch($event->contactid);
+ $cache_contact[$event->contactid]=$tmpcontact;
+ }
+ $cases1[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
+ }
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
{
@@ -901,11 +937,37 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
$cases2[$h][$event->id]['string'].=' - '.$event->label;
$cases2[$h][$event->id]['typecode']=$event->type_code;
- if ($event->socid)
- {
- //$cases2[$h][$event->id]['string'].='xxx';
- }
$cases2[$h][$event->id]['color']=$color;
+ if ($event->fk_project > 0)
+ {
+ if (empty($cache_project[$event->fk_project]))
+ {
+ $tmpproj=new Project($db);
+ $tmpproj->fetch($event->fk_project);
+ $cache_project[$event->fk_project]=$tmpproj;
+ }
+ $cases2[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
+ }
+ if ($event->socid > 0)
+ {
+ if (empty($cache_thirdparty[$event->socid]))
+ {
+ $tmpthirdparty=new Societe($db);
+ $tmpthirdparty->fetch($event->socid);
+ $cache_thirdparty[$event->socid]=$tmpthirdparty;
+ }
+ $cases2[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
+ }
+ if ($event->contactid > 0)
+ {
+ if (empty($cache_contact[$event->contactid]))
+ {
+ $tmpcontact=new Contact($db);
+ $tmpcontact->fetch($event->contactid);
+ $cache_contact[$event->contactid]=$tmpcontact;
+ }
+ $cases2[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
+ }
}
}
else
@@ -928,6 +990,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
}
+ // Now output $casesX
for ($h = $begin_h; $h < $end_h; $h++)
{
$color1='';$color2='';
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 7453b84d477..792d4f9760d 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -30,15 +30,17 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
-if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
-$filter = GETPOST("filter",'',3);
+$filter = GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
@@ -55,7 +57,7 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page","int");
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
-$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
+$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec";
@@ -82,9 +84,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3);
-$status=GETPOST("status");
-$type=GETPOST("type");
-$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
+$status=GETPOST("status",'alpha');
+$type=GETPOST("type",'alpha');
+$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array'))
{
@@ -93,29 +95,30 @@ if (GETPOST('actioncode','array'))
}
else
{
- $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
+ $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
-$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
+
+$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
if ($dateselect > 0)
{
- $day=GETPOST('dateselectday');
- $month=GETPOST('dateselectmonth');
- $year=GETPOST('dateselectyear');
+ $day=GETPOST('dateselectday','int');
+ $month=GETPOST('dateselectmonth','int');
+ $year=GETPOST('dateselectyear','int');
}
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
$tmparray=explode('-',$tmp);
-$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
-$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
+$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
+$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
if ($end_h < 1 || $end_h > 24) $end_h = 18;
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
$tmparray=explode('-',$tmp);
-$begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
-$end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5);
+$begin_d = GETPOST('begin_d','int')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
+$end_d = GETPOST('end_d','int')?GETPOST('end_d','int'):($tmparray[1] != '' ? $tmparray[1] : 5);
if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
if ($end_d < 1 || $end_d > 7) $end_d = 7;
if ($end_d < $begin_d) $end_d = $begin_d + 1;
@@ -123,13 +126,13 @@ if ($end_d < $begin_d) $end_d = $begin_d + 1;
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
-if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
+if (GETPOST('viewcal','alpha') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
$action='show_month'; $day='';
} // View by month
-if (GETPOST('viewweek') || $action == 'show_week') {
+if (GETPOST('viewweek','alpha') || $action == 'show_week') {
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
} // View by week
-if (GETPOST('viewday') || $action == 'show_day') {
+if (GETPOST('viewday','alpha') || $action == 'show_day') {
$action='show_day'; $day=($day?$day:date("d"));
} // View by day
@@ -160,12 +163,12 @@ if ($action =='delete_action')
* View
*/
-$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
-llxHeader('',$langs->trans("Agenda"),$help_url);
-
$form=new Form($db);
$companystatic=new Societe($db);
+$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
+llxHeader('',$langs->trans("Agenda"),$help_url);
+
$now=dol_now();
$nowarray=dol_getdate($now);
$nowyear=$nowarray['year'];
@@ -361,7 +364,7 @@ $sql.= ' a.datep2,';
$sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
-$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
+$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
$sql.= ' ca.code, ca.color';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@@ -418,14 +421,14 @@ else
{
// To limit array
$sql.= " AND (";
- $sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; // Start 7 days before
- $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; // End 7 days after + 3 to go from 28 to 31
+ $sql.= " (a.datep BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'"; // Start 2 day before $firstdaytoshow
+ $sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')"; // End 2 day after $lastdaytoshow
$sql.= " OR ";
- $sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
- $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
+ $sql.= " (a.datep2 BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
+ $sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
$sql.= " OR ";
- $sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
- $sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
+ $sql.= " (a.datep < '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
+ $sql.= " AND a.datep2 > '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
$sql.= ')';
}
if ($type) $sql.= " AND ca.id = ".$type;
@@ -444,13 +447,14 @@ if ($filtert > 0 || $usergroup > 0)
}
// Sort on date
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
-//print $sql;
+//print $sql;exit;
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
+
$i=0;
while ($i < $num)
{
@@ -463,11 +467,14 @@ if ($resql)
continue;
}
+ $datep=$db->jdate($obj->datep);
+ $datep2=$db->jdate($obj->datep2);
+
// Create a new object action
$event=new ActionComm($db);
$event->id=$obj->id;
- $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
- $event->datef=$db->jdate($obj->datep2);
+ $event->datep=$datep; // datep and datef are GMT date
+ $event->datef=$datep2;
$event->type_code=$obj->code;
$event->type_color=$obj->color;
//$event->libelle=$obj->label; // deprecated
@@ -476,12 +483,13 @@ if ($resql)
//$event->author->id=$obj->fk_user_author; // user id of creator
$event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner
- $event->fetch_userassigned(); // This load $event->userassigned
$event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location;
$event->transparency=$obj->transparency;
+ $event->fk_project=$obj->fk_project;
+
$event->socid=$obj->fk_soc;
$event->contactid=$obj->fk_contact;
//$event->societe->id=$obj->fk_soc; // deprecated
@@ -494,15 +502,15 @@ if ($resql)
// They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0)
{
- $event->date_start_in_calendar=$event->datep;
- if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
- else $event->date_end_in_calendar=$event->datep;
+ $event->date_start_in_calendar=$datep;
+ if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
+ else $event->date_end_in_calendar=$datep;
}
else
{
- $event->date_start_in_calendar=$event->datep;
- if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
- else $event->date_end_in_calendar=$event->datep;
+ $event->date_start_in_calendar=$datep;
+ if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
+ else $event->date_end_in_calendar=$datep;
}
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
@@ -515,10 +523,14 @@ if ($resql)
$event->date_start_in_calendar >= $lastdaytoshow)
{
// This record is out of visible range
+ unset($event);
}
else
{
- if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
+ //print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').' '."\n";
+ $event->fetch_userassigned(); // This load $event->userassigned
+
+ if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
// Add an entry in actionarray for each day
@@ -548,6 +560,7 @@ if ($resql)
$i++;
}
+ $db->free($resql);
}
else
{
@@ -865,11 +878,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
global $theme_datacolor; // Array with a list of different we can use (come from theme)
global $cachethirdparties, $cachecontacts, $colorindexused;
global $begin_h, $end_h;
+ global $cache_project, $cache_thirdparty, $cache_contact;
$cases1 = array(); // Color first half hour
$cases2 = array(); // Color second half hour
- $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
+ $curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0);
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
@@ -980,13 +994,39 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
else $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
}
- $cases1[$h][$event->id]['string'].=' - '.$event->label;
+ if ($event->label) $cases1[$h][$event->id]['string'].=' - '.$event->label;
$cases1[$h][$event->id]['typecode']=$event->type_code;
- if ($event->socid)
- {
- //$cases1[$h][$event->id]['string'].='xxx';
- }
$cases1[$h][$event->id]['color']=$color;
+ if ($event->fk_project > 0)
+ {
+ if (empty($cache_project[$event->fk_project]))
+ {
+ $tmpproj=new Project($db);
+ $tmpproj->fetch($event->fk_project);
+ $cache_project[$event->fk_project]=$tmpproj;
+ }
+ $cases1[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
+ }
+ if ($event->socid > 0)
+ {
+ if (empty($cache_thirdparty[$event->socid]))
+ {
+ $tmpthirdparty=new Societe($db);
+ $tmpthirdparty->fetch($event->socid);
+ $cache_thirdparty[$event->socid]=$tmpthirdparty;
+ }
+ $cases1[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
+ }
+ if ($event->contactid > 0)
+ {
+ if (empty($cache_contact[$event->contactid]))
+ {
+ $tmpcontact=new Contact($db);
+ $tmpcontact->fetch($event->contactid);
+ $cache_contact[$event->contactid]=$tmpcontact;
+ }
+ $cases1[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
+ }
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
{
@@ -1000,13 +1040,39 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
else $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
}
- $cases2[$h][$event->id]['string'].=' - '.$event->label;
+ if ($event->label) $cases2[$h][$event->id]['string'].=' - '.$event->label;
$cases2[$h][$event->id]['typecode']=$event->type_code;
- if ($event->socid)
- {
- //$cases2[$h][$event->id]['string'].='xxx';
- }
$cases2[$h][$event->id]['color']=$color;
+ if ($event->fk_project > 0)
+ {
+ if (empty($cache_project[$event->fk_project]))
+ {
+ $tmpproj=new Project($db);
+ $tmpproj->fetch($event->fk_project);
+ $cache_project[$event->fk_project]=$tmpproj;
+ }
+ $cases2[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
+ }
+ if ($event->socid > 0)
+ {
+ if (empty($cache_thirdparty[$event->socid]))
+ {
+ $tmpthirdparty=new Societe($db);
+ $tmpthirdparty->fetch($event->socid);
+ $cache_thirdparty[$event->socid]=$tmpthirdparty;
+ }
+ $cases2[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
+ }
+ if ($event->contactid > 0)
+ {
+ if (empty($cache_contact[$event->contactid]))
+ {
+ $tmpcontact=new Contact($db);
+ $tmpcontact->fetch($event->contactid);
+ $cache_contact[$event->contactid]=$tmpcontact;
+ }
+ $cases2[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
+ }
}
}
else
@@ -1029,6 +1095,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
}
+ // Now output $casesX
for ($h = $begin_h; $h < $end_h; $h++)
{
$color1='';$color2='';
diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php
index a13ffe61c76..5c160bfab16 100644
--- a/htdocs/comm/contact.php
+++ b/htdocs/comm/contact.php
@@ -126,14 +126,14 @@ if ($resql)
print_barre_liste($title.($label?" (".$label.")":""),$page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,"",$num);
print '';
-
+
$db->free($resql);
}
else
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 6c580cc93d6..a2743246560 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -184,12 +184,12 @@ if ($object->fetch($id) >= 0)
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
-
+
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '';
print '
';
-
+
print '
';
print ''.$langs->trans("MailTitle").' '.$object->titre.' ';
@@ -221,7 +221,7 @@ if ($object->fetch($id) >= 0)
print "";
dol_fiche_end();
-
+
$allowaddtarget=($object->statut == 0);
@@ -232,7 +232,7 @@ if ($object->fetch($id) >= 0)
//print '';
print '';
-
+
//print '
';
print '';
//print '
'.$langs->trans("RecipientSelectionModules").' ';
@@ -245,11 +245,11 @@ if ($object->fetch($id) >= 0)
print '
';
//print "
\n";
print '
';
-
+
clearstatcache();
$var = true;
-
+
foreach ($modulesdir as $dir)
{
$modulenames=array();
@@ -324,7 +324,7 @@ if ($object->fetch($id) >= 0)
print $obj->getDesc();
//print '';
print '';
-
+
try {
$nbofrecipient=$obj->getNbOfRecipients('');
}
@@ -345,7 +345,7 @@ if ($object->fetch($id) >= 0)
}
//print '';
print '';
-
+
//print '';
print '';
if ($allowaddtarget)
@@ -362,7 +362,7 @@ if ($object->fetch($id) >= 0)
}
//print '
';
print '';
-
+
//print '';
print '';
if ($allowaddtarget)
@@ -377,10 +377,10 @@ if ($object->fetch($id) >= 0)
}
//print '
';
print '';
-
+
if ($allowaddtarget) print '';
else print '';
-
+
//print "\n";
// print ''."\n";
}
@@ -389,7 +389,7 @@ if ($object->fetch($id) >= 0)
//print '
';
print '';
-
+
print ' ';
}
@@ -412,11 +412,11 @@ if ($object->fetch($id) >= 0)
}
//$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
$sql .= $db->plimit($limit+1, $offset);
-
+
$resql=$db->query($sql);
if ($resql)
{
-
+
$num = $db->num_rows($resql);
$param = "&id=".$object->id;
@@ -436,7 +436,7 @@ if ($object->fetch($id) >= 0)
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'id.'" class="button reposition">'.$langs->trans("TargetsReset").' ';
}
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
-
+
print '';
print "\n\n";
@@ -447,12 +447,12 @@ if ($object->fetch($id) >= 0)
print ' ';
print ' ';
print ' ';
-
+
if ($page) $param.= "&page=".$page;
-
+
print '';
-
+
// Ligne des champs de filtres
print '';
// EMail
@@ -475,7 +475,7 @@ if ($object->fetch($id) >= 0)
print '';
print ' ';
print ' ';
-
+
// Date sending
print '';
print ' ';
@@ -490,13 +490,13 @@ if ($object->fetch($id) >= 0)
print $searchpicto;
print ' ';
print ' ';
-
+
print '';
- print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
+ print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("Lastname",$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("Firstname",$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("OtherInformations",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre("Source",$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sending
if ($object->statut < 2)
{
@@ -504,9 +504,9 @@ if ($object->fetch($id) >= 0)
}
else
{
- print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
+ print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
- print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
+ print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print ' ';
@@ -590,7 +590,7 @@ if ($object->fetch($id) >= 0)
}
else
{
- if ($object->statut < 2)
+ if ($object->statut < 2)
{
print '';
print $langs->trans("NoTargetYet");
diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php
index b0d970248eb..a0744fcfa04 100644
--- a/htdocs/comm/mailing/class/advtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/advtargetemailing.class.php
@@ -124,7 +124,7 @@ class AdvanceTargetingMailing extends CommonObject
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->fk_mailing."'").",";
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
$sql.= " ".$user->id.",";
- $sql.= " ".$this->db->idate(dol_now()).",";
+ $sql.= " '".$this->db->idate(dol_now())."',";
$sql.= " ".$user->id;
diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php
index fb513c99b9b..82cb53fdfbf 100644
--- a/htdocs/comm/mailing/list.php
+++ b/htdocs/comm/mailing/list.php
@@ -109,7 +109,7 @@ if ($result)
$param = "&sall=".urlencode($sall);
if ($filteremail) $param.='&filteremail='.urlencode($filteremail);
-
+
print '