Skip to content

Commit

Permalink
- New: Home page of project area shows list of draft project (like other
Browse files Browse the repository at this point in the history
main page).
- New: Can search on project ref or string from project main page (like
other main page).
  • Loading branch information
eldy committed Jul 16, 2014
1 parent 8a8a90d commit 92a5ebc
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 32 deletions.
5 changes: 4 additions & 1 deletion ChangeLog
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions htdocs/core/lib/project.lib.php
Expand Up @@ -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;

Expand All @@ -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";
Expand Down Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions htdocs/langs/en_US/projects.lang
Expand Up @@ -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
50 changes: 33 additions & 17 deletions htdocs/projet/index.php
@@ -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
Expand Down Expand Up @@ -45,7 +45,7 @@

/*
* View
*/
*/

$socstatic=new Societe($db);
$projectstatic=new Project($db);
Expand Down Expand Up @@ -73,8 +73,24 @@

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">';
Expand Down
5 changes: 5 additions & 0 deletions htdocs/projet/liste.php
Expand Up @@ -61,6 +61,7 @@
$search_ref=GETPOST("search_ref");
$search_label=GETPOST("search_label");
$search_societe=GETPOST("search_societe");
$search_all=GETPOST("search_all");


/*
Expand Down Expand Up @@ -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);

Expand Down
33 changes: 21 additions & 12 deletions htdocs/projet/tasks/time.php
Expand Up @@ -50,7 +50,7 @@

/*
* Actions
*/
*/

if ($action == 'addtimespent' && $user->rights->projet->creer)
{
Expand All @@ -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
Expand Down

0 comments on commit 92a5ebc

Please sign in to comment.