- 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).
This commit is contained in:
Laurent Destailleur 2014-07-17 01:28:01 +02:00
parent 8a8a90de78
commit 92a5ebc459
6 changed files with 77 additions and 32 deletions

View File

@ -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

View File

@ -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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
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 "</tr>\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";

View File

@ -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

View File

@ -1,21 +1,21 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/projet/index.php
@ -45,7 +45,7 @@ $sortorder = GETPOST("sortorder",'alpha');
/*
* View
*/
*/
$socstatic=new Societe($db);
$projectstatic=new Project($db);
@ -73,8 +73,24 @@ else
print '<div class="fichecenter"><div class="fichethirdleft">';
// Search project
if (! empty($conf->projet->enabled) && $user->rights->projet->lire)
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/projet/liste.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProject").'</td></tr>';
print '<tr '.$bc[$var].'>';
print '<td class="nowrap"><label for="sf_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_ref" id="sf_ref" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap"><label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="search_all" id="search_all" size="18"></td>';
print '</tr>';
print "</table></form>\n";
print "<br>\n";
}
print_projecttasks_array($db,$socid,$projectsListId);
print_projecttasks_array($db,$socid,$projectsListId,0,0);
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';

View File

@ -61,6 +61,7 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0;
$search_ref=GETPOST("search_ref");
$search_label=GETPOST("search_label");
$search_societe=GETPOST("search_societe");
$search_all=GETPOST("search_all");
/*
@ -97,6 +98,10 @@ if ($search_societe)
{
$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);

View File

@ -50,7 +50,7 @@ $projectstatic = new Project($db);
/*
* Actions
*/
*/
if ($action == 'addtimespent' && $user->rights->projet->creer)
{
@ -72,22 +72,31 @@ if ($action == 'addtimespent' && $user->rights->projet->creer)
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