Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Maxime Kohlhaas 2014-08-07 12:27:46 +02:00
commit 3b14fa2b35
12 changed files with 184 additions and 631 deletions

View File

@ -512,6 +512,7 @@ Fix: Add a limit into list to avoid browser to hang when database is too large.
Fix: [ bug #1212 ] 'jqueryFileTree.php' directory traversal vulnerability Fix: [ bug #1212 ] 'jqueryFileTree.php' directory traversal vulnerability
Fix: Agenda and Banks module were not working with multicompany module Fix: Agenda and Banks module were not working with multicompany module
Fix: [ bug #1317 ] Removing a category does not remove all child categories Fix: [ bug #1317 ] Removing a category does not remove all child categories
Fix: [ bug #1380 ] Customer invoices are not grouped in company results report.
***** ChangeLog for 3.4.2 compared to 3.4.1 ***** ***** ChangeLog for 3.4.2 compared to 3.4.1 *****
Fix: field's problem into company's page (RIB). Fix: field's problem into company's page (RIB).

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3899,7 +3899,7 @@ class Form
} }
elseif ($typehour=='text') elseif ($typehour=='text')
{ {
print '<input type="text" size="3" name="'.$prefix.'hour" class="flat" value="'.((int) $hourSelected).'">'; print '<input type="text" size="3" name="'.$prefix.'hour"'.($disabled?' disabled="disabled"':'').' class="flat" value="'.((int) $hourSelected).'">';
} }
print $langs->trans('Hours'); print $langs->trans('Hours');

View File

@ -449,10 +449,11 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
* @param int &$level ? * @param int &$level ?
* @param string &$projectsrole ? * @param string &$projectsrole ?
* @param string &$tasksrole ? * @param string &$tasksrole ?
* @param int $mytask 0 or 1 to enable only if task is a task i am affected to * @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc * @return $inc
*/ */
function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0) function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
{ {
global $user, $bc, $langs; global $user, $bc, $langs;
global $form, $projectstatic, $taskstatic; global $form, $projectstatic, $taskstatic;
@ -475,6 +476,9 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
$lastprojectid=$lines[$i]->fk_project; $lastprojectid=$lines[$i]->fk_project;
} }
// If we want all or we have a role on task, we show it
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
{
print "<tr ".$bc[$var].">\n"; print "<tr ".$bc[$var].">\n";
// Project // Project
@ -546,8 +550,8 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
$disabledproject=0; $disabledproject=0;
$disabledtask=0; $disabledtask=0;
} }
// If mytask and no role on task // If $restricteditformytask is on and I have no role on task, i disable edit
if ($mytask && empty($tasksrole[$lines[$i]->id])) if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
{ {
$disabledtask=1; $disabledtask=1;
} }
@ -565,9 +569,11 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
}
$inc++; $inc++;
$level++; $level++;
if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mytask); if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
$level--; $level--;
} }
else else

View File

@ -114,8 +114,6 @@ $title=$langs->trans("TimeSpent");
if ($mine) $title=$langs->trans("MyTimeSpent"); if ($mine) $title=$langs->trans("MyTimeSpent");
llxHeader("",$title,"");
//$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1); //$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
@ -129,8 +127,21 @@ $tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsL
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($user,0,($project->id?$project->id:$projectsListId),0); $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($user,0,($project->id?$project->id:$projectsListId),0);
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$user,($project->id?$project->id:$projectsListId),0); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$user,($project->id?$project->id:$projectsListId),0);
llxHeader("",$title,"");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
// Filter on user
/* dol_fiche_head('');
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
print '<td>';
if ($mine) print $user->getLoginUrl(1);
print '</td>';
print '</tr></table>';
dol_fiche_end();
*/
print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$project->id.'">'; print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$project->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addtime">'; print '<input type="hidden" name="action" value="addtime">';
@ -148,8 +159,18 @@ print '<td align="right">'.$langs->trans("Progress").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>'; print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print '<td colspan="2">'.$langs->trans("AddDuration").'</td>'; print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
print "</tr>\n"; print "</tr>\n";
projectLinesb($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine);
// By default, we can edit only tasks we are assigned to
$restricteditformytask=(empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS)?1:0);
if (count($tasksarray) > 0)
{
projectLinesb($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
}
else
{
print '<tr><td colspan="10">'.$langs->trans("NoTasks").'</td></tr>';
}
print "</table>"; print "</table>";
print '</form>'; print '</form>';

View File

@ -65,7 +65,8 @@ if ($action == 'addtimespent' && $user->rights->projet->creer)
} }
if (empty($_POST["userid"])) if (empty($_POST["userid"]))
{ {
setEventMessage($langs->trans('ErrorUserNotAffectedToTask'),'errors'); $langs->load("errors");
setEventMessage($langs->trans('ErrorUserNotAssignedToTask'),'errors');
$error++; $error++;
} }
@ -344,9 +345,13 @@ if ($id > 0 || ! empty($ref))
// Contributor // Contributor
print '<td class="nowrap">'; print '<td class="nowrap">';
$contactoftask=$object->getListContactId('internal'); $restrictaddtimetocontactoftask=0;
if (empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS))
{
$restrictaddtimetocontactoftask=$object->getListContactId('internal');
}
print img_object('','user'); print img_object('','user');
print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$contactoftask); print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$restrictaddtimetocontactoftask); // Note: If user is not allowed it will be disabled into combo list and userid not posted
print '</td>'; print '</td>';
// Note // Note

View File

@ -127,7 +127,7 @@ class SqlTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testBank * testSql
* *
* @return string * @return string
*/ */
@ -162,4 +162,38 @@ class SqlTest extends PHPUnit_Framework_TestCase
return; return;
} }
/**
* testInitData
*
* @return string
*/
public function testInitData()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdata');
foreach($filesarray as $key => $file)
{
if (! preg_match('/\.sql$/',$file)) continue;
print 'Check sql file '.$file."\n";
$filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/../dev/initdata/'.$file);
$result=strpos($filecontent,'@gmail.com');
print __METHOD__." Result for checking we don't have personal data = ".$result."\n";
$this->assertTrue($result===false, 'Found a bad key into file '.$file);
$result=strpos($filecontent,'eldy@');
print __METHOD__." Result for checking we don't have personal data = ".$result."\n";
$this->assertTrue($result===false, 'Found a bad key into file '.$file);
}
return;
}
} }