diff --git a/ChangeLog b/ChangeLog index 1d5dc78636c9e..dedb228131ef3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,7 +20,10 @@ For users: - New: Add country into table of thirdparties type. This will allow to provide a list of thirdparty types specific to a country (like argentina that need type A or B). -- New: Can force a specific bank account onto an invoice/order... +- New: Can force a specific bank account onto an invoice/order. +- New: First changes for accessibility. +- New: Home page of project area shows list of draft project (like other main page). +- New: Can search on project ref or string from project main page (like other main page). - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 4ebf543b7b1eb..e4ecb884a1ce0 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -623,9 +623,10 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) * @param int $socid Id thirdparty * @param int $projectsListId Id of project i have permission on * @param int $mytasks Limited to task i am contact to + * @param int $statut -1=No filter on statut, 0 or 1 = Filter on status * @return void */ -function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0) +function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $statut=-1) { global $langs,$conf,$user,$bc; @@ -636,9 +637,13 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0) $sortfield=''; $sortorder=''; + $title=$langs->trans("Project"); + if ($statut == 0) $title=$langs->trans("ProjectDraft"); + if ($statut == 1) $title=$langs->trans("Project").' ('.$langs->trans("Validated").')'; + print ''; print ''; - print_liste_field_titre($langs->trans("Project"),"index.php","","","","",$sortfield,$sortorder); + print_liste_field_titre($title,"index.php","","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder); print "\n"; @@ -666,6 +671,10 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0) $sql.= " AND ctc.element = 'project_task'"; $sql.= " AND ec.fk_socpeople = ".$user->id; } + if ($statut >= 0) + { + $sql.= " AND p.fk_statut = ".$statut; + } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; $sql.= " ORDER BY p.title, p.ref"; diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index a37e9651bcc94..28795fee5edfd 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -125,3 +125,6 @@ DocumentModelBaleine=A complete project's report model (logo...) PlannedWorkload = Planned workload WorkloadOccupation= Workload affectation ProjectReferers=Refering objects +SearchAProject=Search a project +ProjectMustBeValidatedFirst=Project must be validated first +ProjectDraft=Projets brouillons diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 035ceaf59246e..7ea2a0af1e91b 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -1,21 +1,21 @@ * Copyright (C) 2004-2010 Laurent Destailleur -* Copyright (C) 2005-2010 Regis Houssin -* -* 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 -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * Copyright (C) 2005-2010 Regis Houssin + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/projet/index.php @@ -45,7 +45,7 @@ /* * View -*/ + */ $socstatic=new Societe($db); $projectstatic=new Project($db); @@ -73,8 +73,24 @@ print '
'; +// Search project +if (! empty($conf->projet->enabled) && $user->rights->projet->lire) +{ + $var=false; + print '
'; + print ''; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
'.$langs->trans("SearchAProject").'
:
:
\n"; + print "
\n"; +} -print_projecttasks_array($db,$socid,$projectsListId); +print_projecttasks_array($db,$socid,$projectsListId,0,0); print '
'; diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index 3dab05c1826d8..a7404e5c23b15 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -61,6 +61,7 @@ $search_ref=GETPOST("search_ref"); $search_label=GETPOST("search_label"); $search_societe=GETPOST("search_societe"); +$search_all=GETPOST("search_all"); /* @@ -97,6 +98,10 @@ { $sql .= natural_search('s.nom', $search_societe); } +if ($search_all) +{ + $sql .= natural_search(array('p.ref','p.title','s.nom'), $search_all); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f6430ff4f559d..19a0bd5f99f35 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -50,7 +50,7 @@ /* * Actions -*/ + */ if ($action == 'addtimespent' && $user->rights->projet->creer) { @@ -72,22 +72,31 @@ if (! $error) { $object->fetch($id); + $object->fetch_projet(); - $object->timespent_note = $_POST["timespent_note"]; - $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds - $object->timespent_duration+= $_POST["timespent_durationmin"]*60; // We store duration in seconds - $object->timespent_date = dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); - $object->timespent_fk_user = $_POST["userid"]; - - $result=$object->addTimeSpent($user); - if ($result >= 0) + if (empty($object->projet->statut)) { - setEventMessage($langs->trans("RecordSaved")); + setEventMessage($langs->trans("ProjectMustBeValidatedFirst"),'errors'); + $error++; } else { - setEventMessage($langs->trans($object->error),'errors'); - $error++; + $object->timespent_note = $_POST["timespent_note"]; + $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds + $object->timespent_duration+= $_POST["timespent_durationmin"]*60; // We store duration in seconds + $object->timespent_date = dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); + $object->timespent_fk_user = $_POST["userid"]; + + $result=$object->addTimeSpent($user); + if ($result >= 0) + { + setEventMessage($langs->trans("RecordSaved")); + } + else + { + setEventMessage($langs->trans($object->error),'errors'); + $error++; + } } } else