diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index e5615aa66ba..2fc860cb116 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -592,7 +592,7 @@ if ($id > 0)
if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) {
print " ".img_warning();
}
- print '
'.dol_print_date($db->jdate($objp->dp),'day')." | \n";
+ print ''.dol_print_date($db->jdate($objp->dp),'day')." | \n";
print ''.price($objp->total_ht).' | ';
print ''.$propal_static->LibStatut($objp->fk_statut,5).' | ';
$i++;
@@ -673,7 +673,7 @@ if ($id > 0)
$commande_static->total_tva = $objp->total_tva;
$commande_static->total_ttc = $objp->total_ttc;
print $commande_static->getNomUrl(1);
- print ''.dol_print_date($db->jdate($objp->dc),'day')." | \n";
+ print ''.dol_print_date($db->jdate($objp->dc),'day')." | \n";
print ''.price($objp->total_ht).' | ';
print ''.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).' | ';
$i++;
@@ -737,7 +737,7 @@ if ($id > 0)
print $sendingstatic->getNomUrl(1);
print '';
if ($objp->date_creation > 0) {
- print ''.dol_print_date($db->jdate($objp->date_creation),'day').' | ';
+ print ''.dol_print_date($db->jdate($objp->date_creation),'day').' | ';
} else {
print '!!! | ';
}
@@ -797,8 +797,8 @@ if ($id > 0)
print $contrat->getNomUrl(1,12);
print "\n";
print ''.dol_trunc($objp->refsup,12)." | \n";
- print ''.dol_print_date($db->jdate($objp->dc),'day')." | \n";
- print ''.dol_print_date($db->jdate($objp->dcon),'day')." | \n";
+ print ''.dol_print_date($db->jdate($objp->dc),'day')." | \n";
+ print ''.dol_print_date($db->jdate($objp->dcon),'day')." | \n";
print ' | ';
print '';
$contrat->fetch_lines();
@@ -855,9 +855,9 @@ if ($id > 0)
print " | ";
print '| '.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.' | '."\n";
- //print ''.dol_print_date($db->jdate($objp->startdate)).' | '."\n";
- print ''.convertSecondToTime($objp->duration).' | '."\n";
- print ''.$fichinter_static->getLibStatut(5).' | '."\n";
+ //print ''.dol_print_date($db->jdate($objp->startdate)).' | '."\n";
+ print ''.convertSecondToTime($objp->duration).' | '."\n";
+ print ''.$fichinter_static->getLibStatut(5).' | '."\n";
print '
';
$var=!$var;
$i++;
@@ -907,7 +907,7 @@ if ($id > 0)
$tableaushown=1;
print '';
- print '| '.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllBills").' '.$num.' | ';
+ print ' | ';
print ' ';
@@ -929,15 +929,24 @@ if ($id > 0)
print '';
if ($objp->df > 0)
{
- print ''.dol_print_date($db->jdate($objp->df),'day').' | ';
+ print ''.dol_print_date($db->jdate($objp->df),'day').' | ';
}
else
{
print '!!! | ';
}
- print ''.price($objp->total_ht).' | ';
+ print '';
+ print price($objp->total_ht);
+ print ' | ';
- print ''.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am)).' | ';
+ if (! empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
+ {
+ print '';
+ print price($objp->total_ttc);
+ print ' | ';
+ }
+
+ print ''.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am)).' | ';
print "\n";
$i++;
}
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 517cd95e536..237cd9c0c29 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -9,6 +9,7 @@
* Copyright (C) 2015 Frederic France
* Copyright (C) 2015 Marcos García
* Copyright (C) 2015 Jean-François Ferry
+ * Copyright (C) 2016 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,8 +45,10 @@ $langs->load('companies');
$orderyear=GETPOST("orderyear","int");
$ordermonth=GETPOST("ordermonth","int");
+$orderday=GETPOST("orderday","int");
$deliveryyear=GETPOST("deliveryyear","int");
$deliverymonth=GETPOST("deliverymonth","int");
+$deliveryday=GETPOST("deliveryday","int");
$search_product_category=GETPOST('search_product_category','int');
$search_ref=GETPOST('search_ref','alpha')!=''?GETPOST('search_ref','alpha'):GETPOST('sref','alpha');
$search_ref_customer=GETPOST('search_ref_customer','alpha');
@@ -87,7 +90,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_total_ht='';
$orderyear='';
$ordermonth='';
- $deliverymonth='';
+ $orderday='';
+ $deliveryday='';
+ $deliverymonth='';
$deliveryyear='';
}
@@ -168,10 +173,10 @@ if ($viewstatut <> '')
}
if ($ordermonth > 0)
{
- if ($orderyear > 0 && empty($day))
+ if ($orderyear > 0 && empty($orderday))
$sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,$ordermonth,false))."' AND '".$db->idate(dol_get_last_day($orderyear,$ordermonth,false))."'";
- else if ($orderyear > 0 && ! empty($day))
- $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $day, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $day, $orderyear))."'";
+ else if ($orderyear > 0 && ! empty($orderday))
+ $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $orderday, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $orderday, $orderyear))."'";
else
$sql.= " AND date_format(c.date_commande, '%m') = '".$ordermonth."'";
}
@@ -181,10 +186,10 @@ else if ($orderyear > 0)
}
if ($deliverymonth > 0)
{
- if ($deliveryyear > 0 && empty($day))
+ if ($deliveryyear > 0 && empty($deliveryday))
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,$deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,$deliverymonth,false))."'";
- else if ($deliveryyear > 0 && ! empty($day))
- $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $day, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $day, $deliveryyear))."'";
+ else if ($deliveryyear > 0 && ! empty($deliveryday))
+ $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $deliveryday, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $deliveryday, $deliveryyear))."'";
else
$sql.= " AND date_format(c.date_livraison, '%m') = '".$deliverymonth."'";
}
@@ -240,8 +245,10 @@ if ($resql)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
+ if ($orderday) $param.='&orderday='.$orderday;
if ($ordermonth) $param.='&ordermonth='.$ordermonth;
if ($orderyear) $param.='&orderyear='.$orderyear;
+ if ($deliveryday) $param.='&deliveryday='.$deliveryday;
if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth;
if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear;
if ($search_ref) $param.='&search_ref='.$search_ref;
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 2581bb382ca..772abae8362 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -10,7 +10,7 @@
* Copyright (C) 2013 Florian Henry
* Copyright (C) 2013 Cédric Salvador
* Copyright (C) 2015 Jean-François Ferry
- * Copyright (C) 2015 Ferran Marcet
+ * Copyright (C) 2015-2016 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -119,7 +119,6 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
- $search_categ='';
$search_user='';
$search_sale='';
$search_product_category='';
@@ -132,6 +131,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$day='';
$year='';
$month='';
+ $day_lim='';
+ $year_lim='';
+ $month_lim='';
}
@@ -261,13 +263,18 @@ if ($resql)
}
$param='&socid='.$socid;
+ if ($day) $param.='&day='.$day;
if ($month) $param.='&month='.$month;
if ($year) $param.='&year=' .$year;
+ if ($day_lim) $param.='&day_lim='.$day_lim;
+ if ($month_lim) $param.='&month_lim='.$month_lim;
+ if ($year_lim) $param.='&year_lim=' .$year_lim;
if ($search_ref) $param.='&search_ref=' .$search_ref;
if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer;
if ($search_societe) $param.='&search_societe=' .$search_societe;
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
if ($search_user > 0) $param.='&search_user=' .$search_user;
+ if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category;
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
if ($search_status != '') $param.='&search_status='.$search_status;
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index 12470310ae4..29651b84344 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -591,7 +591,7 @@ function listOfSessions()
//$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f";dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920";dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";';
if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session
- (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity
+ (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity
preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name
{
$tmp=explode('_', $file);
@@ -982,21 +982,29 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
//var_dump($objMod->dictionaries['tabname']);
$taborder[] = 0;
$tabfieldcheck[] = array(); $tabhelp[] = array();
+ $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp=0;
foreach($objMod->dictionaries['tabname'] as $val)
{
$taborder[] = count($tabname)+1;
+ $nbtabname++;
$tabname[] = $val;
}
- foreach($objMod->dictionaries['tablib'] as $val) $tablib[] = $val;
- foreach($objMod->dictionaries['tabsql'] as $val) $tabsql[] = $val;
- foreach($objMod->dictionaries['tabsqlsort'] as $val) $tabsqlsort[] = $val;
- foreach($objMod->dictionaries['tabfield'] as $val) $tabfield[] = $val;
- foreach($objMod->dictionaries['tabfieldvalue'] as $val) $tabfieldvalue[] = $val;
- foreach($objMod->dictionaries['tabfieldinsert'] as $val) $tabfieldinsert[] = $val;
- foreach($objMod->dictionaries['tabrowid'] as $val) $tabrowid[] = $val;
- foreach($objMod->dictionaries['tabcond'] as $val) $tabcond[] = $val;
- if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) $tabfieldcheck[] = $val;
- if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) $tabhelp[] = $val;
+ foreach($objMod->dictionaries['tablib'] as $val) { $nbtablib++; $tablib[] = $val; }
+ foreach($objMod->dictionaries['tabsql'] as $val) { $nbtabsql++; $tabsql[] = $val; }
+ foreach($objMod->dictionaries['tabsqlsort'] as $val) { $nbtabsqlsort++; $tabsqlsort[] = $val; }
+ foreach($objMod->dictionaries['tabfield'] as $val) { $nbtabfield++; $tabfield[] = $val; }
+ foreach($objMod->dictionaries['tabfieldvalue'] as $val) { $nbtabfieldvalue++; $tabfieldvalue[] = $val; }
+ foreach($objMod->dictionaries['tabfieldinsert'] as $val) { $nbtabfieldinsert++; $tabfieldinsert[] = $val; }
+ foreach($objMod->dictionaries['tabrowid'] as $val) { $nbtabrowid++; $tabrowid[] = $val; }
+ foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; }
+ if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; }
+ if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; }
+
+ if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort)
+ {
+ print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
+ //print "$const_name: $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp\n";
+ }
//foreach($objMod->dictionaries['tabsqlsort'] as $val) $tablib[] = $val;
//$tabname = array_merge ($tabname, $objMod->dictionaries['tabname']);
//var_dump($tabcond);
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index a2b48c253df..a02f2f78440 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -8,7 +8,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2015 juanjo Menent
* Copyright (C) 2015 Abbes Bahfir
- * Copyright (C) 2015 Ferran Marcet
+ * Copyright (C) 2015-2016 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -93,6 +93,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_status="";
$year="";
$month="";
+ $day="";
+ $year_lim="";
+ $month_lim="";
+ $day_lim="";
}
/*
@@ -230,8 +234,12 @@ if ($resql)
}
$param='&socid='.$socid;
+ if ($day) $param.='&day='.urlencode($day);
if ($month) $param.='&month='.urlencode($month);
if ($year) $param.='&year=' .urlencode($year);
+ if ($day_lim) $param.='&day_lim='.urlencode($day_lim);
+ if ($month_lim) $param.='&month_lim='.urlencode($month_lim);
+ if ($year_lim) $param.='&year_lim=' .urlencode($year_lim);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_ref_supplier) $param.='&search_ref_supplier'.urlencode($search_ref_supplier);
if ($search_label) $param.='&search_label='.urlencode($search_label);
diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php
index 39f728263ad..31c1e950ea7 100644
--- a/htdocs/projet/activity/index.php
+++ b/htdocs/projet/activity/index.php
@@ -46,9 +46,14 @@ $langs->load("projects");
*/
$now = dol_now();
+$tmp=dol_getdate($now);
+$day=$tmp['mday'];
+$month=$tmp['mon'];
+$year=$tmp['year'];
$projectstatic=new Project($db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // Return all projects I have permission on because I want my tasks and some of my task may be on a public projet that is not my project
+$taskstatic=new Task($db);
$tasktmp=new Task($db);
$title=$langs->trans("Activities");
@@ -125,7 +130,7 @@ if ( $resql )
$projectstatic->title=$row->title;
print $projectstatic->getNomUrl(1, '', 1);
print '';
- print ''.convertSecondToTime($row->nb).' | ';
+ print ''.convertSecondToTime($row->nb, 'allhourmin').' | ';
print "\n";
$total += $row->nb;
}
@@ -138,7 +143,7 @@ else
}
print '';
print '| '.$langs->trans('Total').' | ';
-print ''.convertSecondToTime($total).' | ';
+print ''.convertSecondToTime($total, 'allhourmin').' | ';
print " \n";
print " ";
@@ -181,7 +186,7 @@ if ($db->type != 'pgsql')
$projectstatic->title=$row->title;
print $projectstatic->getNomUrl(1, '', 1);
print ' | ';
- print ''.convertSecondToTime($row->nb).' | ';
+ print ''.convertSecondToTime($row->nb, 'allhourmin').' | ';
print "
\n";
$total += $row->nb;
}
@@ -194,71 +199,74 @@ if ($db->type != 'pgsql')
}
print '';
print '| '.$langs->trans('Total').' | ';
- print ''.convertSecondToTime($total).' | ';
+ print ''.convertSecondToTime($total, 'allhourmin').' | ';
print "
\n";
print "";
}
-// TODO Do not use week function to be compatible with all database
+/*
if ($db->type != 'pgsql')
{
+ print '
';
+
+ // Affichage de la liste des projets de la semaine
+ print '';
+ print '';
+ print '| '.$langs->trans("ActivityOnProjectThisWeek").' | ';
+ print ''.$langs->trans("Time").' | ';
+ print "
\n";
+
+ $sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb";
+ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
+ $sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
+ $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
+ $sql.= " WHERE t.fk_projet = p.rowid";
+ $sql.= " AND p.entity = ".$conf->entity;
+ $sql.= " AND tt.fk_task = t.rowid";
+ $sql.= " AND tt.fk_user = ".$user->id;
+ $sql.= " AND task_date >= '".$db->idate(dol_get_first_day($year, $month)).'" AND ...";
+ $sql.= " AND p.rowid in (".$projectsListId.")";
+ $sql.= " GROUP BY p.rowid, p.ref, p.title";
+
+ $resql = $db->query($sql);
+ if ( $resql )
+ {
+ $total = 0;
+ $var=true;
+
+ while ($row = $db->fetch_object($resql))
+ {
+ $var=!$var;
+ print "";
+ print '| ';
+ $projectstatic->id=$row->rowid;
+ $projectstatic->ref=$row->ref;
+ $projectstatic->title=$row->title;
+ print $projectstatic->getNomUrl(1, '', 1);
+ print ' | ';
+ print ''.convertSecondToTime($row->nb, 'allhourmin').' | ';
+ print "
\n";
+ $total += $row->nb;
+ }
+
+ $db->free($resql);
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+ print '';
+ print '| '.$langs->trans('Total').' | ';
+ print ''.convertSecondToTime($total, 'allhourmin').' | ';
+ print "
\n";
+ print "
";
+
+}
+*/
+
print '
';
-/* Affichage de la liste des projets de la semaine */
-print '';
-print '';
-print '| '.$langs->trans("ActivityOnProjectThisWeek").' | ';
-print ''.$langs->trans("Time").' | ';
-print "
\n";
-
-$sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb";
-$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
-$sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
-$sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
-$sql.= " WHERE t.fk_projet = p.rowid";
-$sql.= " AND p.entity = ".$conf->entity;
-$sql.= " AND tt.fk_task = t.rowid";
-$sql.= " AND tt.fk_user = ".$user->id;
-$sql.= " AND week(task_date) = '".strftime("%W",time())."'";
-$sql.= " AND p.rowid in (".$projectsListId.")";
-$sql.= " GROUP BY p.rowid, p.ref, p.title";
-
-$resql = $db->query($sql);
-if ( $resql )
-{
- $total = 0;
- $var=true;
-
- while ($row = $db->fetch_object($resql))
- {
- $var=!$var;
- print "";
- print '| ';
- $projectstatic->id=$row->rowid;
- $projectstatic->ref=$row->ref;
- $projectstatic->title=$row->title;
- print $projectstatic->getNomUrl(1, '', 1);
- print ' | ';
- print ''.convertSecondToTime($row->nb).' | ';
- print "
\n";
- $total += $row->nb;
- }
-
- $db->free($resql);
-}
-else
-{
- dol_print_error($db);
-}
-print '';
-print '| '.$langs->trans('Total').' | ';
-print ''.convertSecondToTime($total).' | ';
-print "
\n";
-print "
";
-
-}
-
/* Affichage de la liste des projets du mois */
print '';
print '';
@@ -274,13 +282,15 @@ $sql.= " WHERE t.fk_projet = p.rowid";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND tt.fk_task = t.rowid";
$sql.= " AND tt.fk_user = ".$user->id;
-$sql.= " AND date_format(task_date,'%y-%m') = '".strftime("%y-%m",$now)."'";
+$sql.= " AND task_date BETWEEN '".$db->idate(dol_get_first_day($year, $month))."' AND '".$db->idate(dol_get_last_day($year, $month))."'";
$sql.= " AND p.rowid in (".$projectsListId.")";
$sql.= " GROUP BY p.rowid, p.ref, p.title";
$resql = $db->query($sql);
if ( $resql )
{
+ $total = 0;
+
$var=false;
while ($row = $db->fetch_object($resql))
@@ -292,9 +302,10 @@ if ( $resql )
$projectstatic->title=$row->title;
print $projectstatic->getNomUrl(1, '', 1);
print '';
- print '| '.convertSecondToTime($row->nb).' | ';
+ print ''.convertSecondToTime($row->nb, 'allhourmin').' | ';
print "
\n";
$var=!$var;
+ $total += $row->nb;
}
$db->free($resql);
}
@@ -304,7 +315,7 @@ else
}
print '';
print '| '.$langs->trans('Total').' | ';
-print ''.convertSecondToTime($total).' | ';
+print ''.convertSecondToTime($total, 'allhourmin').' | ';
print "
\n";
print "
";
@@ -342,7 +353,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
$projectstatic->title=$row->title;
print $projectstatic->getNomUrl(1, '', 1);
print '';
- print ''.convertSecondToTime($row->nb).' | ';
+ print ''.convertSecondToTime($row->nb, 'allhourmin').' | ';
print "\n";
$var=!$var;
}
@@ -354,7 +365,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
}
print '';
print '| '.$langs->trans('Total').' | ';
- print ''.convertSecondToTime($total).' | ';
+ print ''.convertSecondToTime($total, 'allhourmin').' | ';
print "
\n";
print "";
}
@@ -364,8 +375,40 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
print '';
-if (empty($conf->global->PROJECT_HIDE_TASKS))
+if (empty($conf->global->PROJECT_HIDE_TASKS) && empty($conf->global->PROJECT_HIDE_LIST_HOME_AREA))
{
+ // Get id of types of contacts for projects (This list never contains a lot of elements)
+ $listofprojectcontacttype=array();
+ $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
+ $sql.= " WHERE ctc.element = '" . $projectstatic->element . "'";
+ $sql.= " AND ctc.source = 'internal'";
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ while($obj = $db->fetch_object($resql))
+ {
+ $listofprojectcontacttype[$obj->rowid]=$obj->code;
+ }
+ }
+ else dol_print_error($db);
+ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found
+ // Get id of types of contacts for tasks (This list never contains a lot of elements)
+ $listoftaskcontacttype=array();
+ $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
+ $sql.= " WHERE ctc.element = '" . $taskstatic->element . "'";
+ $sql.= " AND ctc.source = 'internal'";
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ while($obj = $db->fetch_object($resql))
+ {
+ $listoftaskcontacttype[$obj->rowid]=$obj->code;
+ }
+ }
+ else dol_print_error($db);
+ if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found
+
+
// Tasks for all resources of all opened projects and time spent for each task/resource
$max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA);
@@ -376,8 +419,16 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid";
+ if ($mine)
+ {
+ $sql.= ", " . MAIN_DB_PREFIX . "element_contact as ect";
+ }
$sql.= " WHERE p.entity = ".$conf->entity;
- if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")";
+ if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; // project i have permission on
+ if ($mine) // this may duplicate record if we are contact twice
+ {
+ $sql.= " AND ect.fk_c_type_contact IN (".join(',',array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$user->id;
+ }
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
$sql.= " AND p.fk_statut=1";
$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee";
@@ -451,13 +502,13 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
print '
'.dol_print_date($db->jdate($obj->dateo),'day').' | ';
print '
'.dol_print_date($db->jdate($obj->datee),'day').' | ';
print '
';
- print convertSecondToTime($obj->planned_workload, 'all');
+ print convertSecondToTime($obj->planned_workload, 'allhourmin');
print ' | ';
print '
';
print ($obj->taskid>0)?$obj->progress.'%':'';
print ' | ';
print '
';
- print convertSecondToTime($obj->timespent, 'all');
+ print convertSecondToTime($obj->timespent, 'allhourmin');
print ' | ';
print '
';
if (! empty($obj->taskid))
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index b376a8c2765..4bad452110b 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -763,7 +763,7 @@ else
* Creation
*/
$private=GETPOST("private","int");
- if (! empty($conf->global->MAIN_THIRPARTY_CREATION_INDIVIDUAL) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1;
+ if (! empty($conf->global->MAIN_THIRDPARTY_CREATION_INDIVIDUAL) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1;
if (empty($private)) $private=0;
// Load object modCodeTiers
|