diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index ec52ebd46e3..78a5bb1fa2b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2005 Marc Bariley / Ocebo * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Claudio Aschieri + * Copyright (C) 2015 Claudio Aschieri * * 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 @@ -74,6 +74,9 @@ $search_sale=GETPOST('search_sale','int'); $day = GETPOST('day','int'); $month = GETPOST('month','int'); $year = GETPOST('year','int'); +$sday = GETPOST('sday','int'); +$smonth = GETPOST('smonth','int'); +$syear = GETPOST('syear','int'); if ($search_status == '') $search_status=-1; // -1 or 1 @@ -92,6 +95,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $day=""; $month=""; $year=""; + $sday=""; + $smonth=""; + $syear=""; } /* @@ -139,6 +145,19 @@ if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } +if ($smonth > 0) +{ + if ($syear > 0 && empty($sday)) + $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($syear,$smonth,false))."' AND '".$db->idate(dol_get_last_day($syear,$smonth,false))."'"; + else if ($syear > 0 && ! empty($sday)) + $sql.= " AND p.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'"; + else + $sql.= " AND date_format(p.datee, '%m') = '".$smonth."'"; +} +else if ($syear > 0) +{ + $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($syear,1,false))."' AND '".$db->idate(dol_get_last_day($syear,12,false))."'"; +} if ($month > 0) { if ($year > 0 && empty($day)) @@ -235,7 +254,8 @@ if ($resql) print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,"",$sortfield,$sortorder); + if (! empty($conf->global->PROJECT_LIST_SHOW_STARTDATE)) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder); print ' '; @@ -251,9 +271,19 @@ if ($resql) print ''; print ''; print ''; + // Sale representative print ' '; - - print ''; + // Start date + if (! empty($conf->global->PROJECT_LIST_SHOW_STARTDATE)) + { + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($syear?$syear:-1,'syear',1, 20, 5); + print ''; + } + // End date + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year?$year:-1,'year',1, 20, 5); @@ -271,102 +301,107 @@ if ($resql) print ''; print ''; - while ($i < $num) - { - $objp = $db->fetch_object($resql); + while ($i < $num) + { + $objp = $db->fetch_object($resql); - $projectstatic->id = $objp->projectid; - $projectstatic->user_author_id = $objp->fk_user_creat; - $projectstatic->public = $objp->public; + $projectstatic->id = $objp->projectid; + $projectstatic->user_author_id = $objp->fk_user_creat; + $projectstatic->public = $objp->public; - $userAccess = $projectstatic->restrictedProjectArea($user); + $userAccess = $projectstatic->restrictedProjectArea($user); - if ($userAccess >= 0) - { - $var=!$var; - print ""; + if ($userAccess >= 0) + { + $var=!$var; + print ""; - // Project url - print ""; - $projectstatic->ref = $objp->ref; - print $projectstatic->getNomUrl(1); - print ""; + // Project url + print ""; + $projectstatic->ref = $objp->ref; + print $projectstatic->getNomUrl(1); + print ""; - // Title - print ''; - print dol_trunc($objp->title,24); - print ''; + // Title + print ''; + print dol_trunc($objp->title,80); + print ''; - // Company - print ''; - if ($objp->socid) - { - $socstatic->id=$objp->socid; - $socstatic->name=$objp->name; - print $socstatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; + // Company + print ''; + if ($objp->socid) + { + $socstatic->id=$objp->socid; + $socstatic->name=$objp->name; + print $socstatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; - // Sales Rapresentatives - print ''; - if($objp->socid) - { - $listsalesrepresentatives=$socstatic->getSalesRepresentatives($user); - $nbofsalesrepresentative=count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 3) // We print only number - { - print ''; - print $nbofsalesrepresentative; - print ''; - } - else if ($nbofsalesrepresentative > 0) - { - $userstatic=new User($db); - $j=0; - foreach($listsalesrepresentatives as $val) - { - $userstatic->id=$val['id']; - $userstatic->lastname=$val['lastname']; - $userstatic->firstname=$val['firstname']; - print $userstatic->getNomUrl(1); - $j++; - if ($j < $nbofsalesrepresentative) print ', '; - } - } - else print $langs->trans("NoSalesRepresentativeAffected"); - } - else - { - print ' '; - } - print ''; + // Sales Rapresentatives + print ''; + if($objp->socid) + { + $listsalesrepresentatives=$socstatic->getSalesRepresentatives($user); + $nbofsalesrepresentative=count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 3) // We print only number + { + print ''; + print $nbofsalesrepresentative; + print ''; + } + else if ($nbofsalesrepresentative > 0) + { + $userstatic=new User($db); + $j=0; + foreach($listsalesrepresentatives as $val) + { + $userstatic->id=$val['id']; + $userstatic->lastname=$val['lastname']; + $userstatic->firstname=$val['firstname']; + print $userstatic->getNomUrl(1); + $j++; + if ($j < $nbofsalesrepresentative) print ', '; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } + else + { + print ' '; + } + print ''; - // Date end - print ''; - print dol_print_date($db->jdate($objp->date_end),'day'); - print ''; + // Date start + print ''; + print dol_print_date($db->jdate($objp->date_start),'day'); + print ''; - // Visibility - print ''; - if ($objp->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print ''; + // Date end + print ''; + print dol_print_date($db->jdate($objp->date_end),'day'); + print ''; - // Status - $projectstatic->statut = $objp->fk_statut; - print ''.$projectstatic->getLibStatut(5).''; + // Visibility + print ''; + if ($objp->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print ''; - print "\n"; + // Status + $projectstatic->statut = $objp->fk_statut; + print ''.$projectstatic->getLibStatut(5).''; - } + print "\n"; - $i++; - } + } + + $i++; + } $db->free($resql); }