Merge remote-tracking branch 'origin/3.5' into develop

This commit is contained in:
Laurent Destailleur 2014-05-10 19:53:06 +02:00
commit 2bac66fd52
23 changed files with 80 additions and 50 deletions

View File

@ -123,6 +123,8 @@ Fix: [ bug #1353 ] Email notifications, wrong URL.
Fix: [ bug #1362 ] Note is not saved.
Fix: tr/td balance.
Fix: [ bug #1360 ] note indicator for member tab.
Fix: Nb of notes and doc not visible onto tasks.
Fix: [ bug #1372 ] Margin calculation does not work in proposals
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
Fix: Can't add user for a task.

View File

@ -428,7 +428,7 @@ if ($object->id > 0)
/*
* Withdrawal request
*/
*/
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$sql .= " , pfd.date_traite as date_traite";
@ -462,12 +462,13 @@ if ($object->id > 0)
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("MakeWithdrawRequest").'</a>';
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("MakeWithdrawRequest").'</a>';
if ($num == 0) print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPayed")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
print "</div><br>\n";

View File

@ -479,11 +479,11 @@ class FormOther
$numlines=count($lines);
for ($i = 0 ; $i < $numlines ; $i++)
{
if ($lines[$i]->fk_parent == $parent)
if ($lines[$i]->fk_parent == $parent)
{
$var = !$var;
//var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id);
//var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines
// Break on a new project
if ($parent == 0) // We are on a task at first level
@ -514,7 +514,7 @@ class FormOther
$newdisablechildoftaskid=$disablechildoftaskid;
// Print task
if ($lines[$i]->id >= 0)
if (isset($lines[$i]->id)) // We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0
{
// Check if we must disable entry
$disabled=0;

View File

@ -2560,7 +2560,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
if ($picto == 'setup') $picto='title.png';
if (!empty($conf->browser->ie) && $picto=='title.png') $picto='title.gif';
if ($num > $conf->liste_limit or $num == -1)
if (($num > $conf->liste_limit) || ($num == -1))
{
$nextpage = 1;
}

View File

@ -142,18 +142,24 @@ function task_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'task');
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
/*$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$listoffiles=dol_dir_list($filesdir,'files',1);
$head[$h][1] = (count($listoffiles)?$langs->trans('DocumentsNb',count($listoffiles)):$langs->trans('Documents'));*/
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'task_document';
$h++;
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;
if(!empty($object->note_private)) $nbNote++;
if(!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
$head[$h][1] = $langs->trans('Notes');
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
$head[$h][2] = 'task_notes';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'task_notes';
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$listoffiles=dol_dir_list($filesdir,'files',1,'','thumbs');
$head[$h][1] = (count($listoffiles)?$langs->trans('DocumentsNb',count($listoffiles)):$langs->trans('Documents'));
$head[$h][2] = 'task_document';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove');

View File

@ -252,8 +252,10 @@ if (! empty($usemargins) && $user->rights->margins->creer)
var remise = $("input[name='remise_percent']:first");
var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '')
return true;
if (! $.isNumeric(rate.val().replace(',','.')))
{
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
@ -274,12 +276,13 @@ if (! empty($usemargins) && $user->rights->margins->creer)
if (remisejs != 100)
{
if (remisejs == '') remisejs=0;
bpjs=price2numjs(buying_price.val());
ratejs=price2numjs(rate.val());
if (npRate == "marginRate")
if (npRate == "np_marginRate")
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
else if (npRate == "markRate")
else if (npRate == "np_markRate")
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
}
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
@ -291,6 +294,8 @@ if (! empty($usemargins) && $user->rights->margins->creer)
/* Function similar to price2num in PHP */
function price2numjs(num)
{
if (num == '') return '';
<?php
$dec=','; $thousand=' ';
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");

View File

@ -298,6 +298,8 @@ if (! empty($usemargins) && $user->rights->margins->creer)
/* Function similar to price2num in PHP */
function price2numjs(num)
{
if (num == '') return '';
<?php
$dec=','; $thousand=' ';
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");

View File

@ -177,7 +177,7 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
// Customer
print "<tr><td>".$langs->trans("Company")."</td>";
print "<tr><td>".$langs->trans("ThirdParty")."</td>";
print '<td colspan="3">';
if ($object->societe->id > 0) print $object->societe->getNomUrl(1);
else print '&nbsp;';
@ -202,7 +202,7 @@ if ($id > 0 || ! empty($ref))
{
$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
if ($res) break;
}
}
}
else
{

View File

@ -123,7 +123,7 @@ if ($object->id > 0)
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($object->societe->id)) print $object->societe->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';

View File

@ -114,7 +114,7 @@ print '</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$project->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($project->societe->id)) print $project->societe->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';

View File

@ -544,7 +544,7 @@ else
print '<td><input size="30" name="title" value="'.$object->title.'"></td></tr>';
// Customer
print '<tr><td>'.$langs->trans("Thirdparty").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
$text=$form->select_company($object->societe->id,'socid','',1,1);
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
@ -615,7 +615,7 @@ else
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
// Third party
print '<tr><td>'.$langs->trans("Thirdparty").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($object->societe->id > 0) print $object->societe->getNomUrl(1);
else print'&nbsp;';
print '</td></tr>';

View File

@ -122,7 +122,7 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($object->societe->id)) print $object->societe->getNomUrl(1);
else print '&nbsp;';
print '</td>';
@ -161,7 +161,7 @@ if ($user->rights->projet->all->creer || $user->rights->projet->creer)
}
else
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NoPermission").'">'.$langs->trans('AddTask').'</a>';
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
}
print '</div>';

View File

@ -126,7 +126,7 @@ if ($resql)
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"","",'align="right"',$sortfield,$sortorder);
print "</tr>\n";

View File

@ -104,7 +104,7 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
// Third party
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($object->societe->id > 0) print $object->societe->getNomUrl(1);
else print'&nbsp;';
print '</td></tr>';

View File

@ -215,7 +215,7 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($object->societe->id)) print $object->societe->getNomUrl(1);
else print '&nbsp;';
print '</td>';
@ -369,7 +369,7 @@ else
}
else
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NoPermission").'">'.$langs->trans('AddTask').'</a>';
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
}
print '</div>';

View File

@ -157,6 +157,8 @@ if ($id > 0 || ! empty($ref))
$result=$projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
$object->project = dol_clone($projectstatic);
$userWrite = $projectstatic->restrictedProjectArea($user,'write');
if ($withproject)
@ -185,7 +187,7 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td>';
@ -247,7 +249,7 @@ if ($id > 0 || ! empty($ref))
print '</td></tr>';
// Customer
print "<tr><td>".$langs->trans("Company")."</td>";
print "<tr><td>".$langs->trans("ThirdParty")."</td>";
print '<td colspan="3">';
if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
@ -281,7 +283,7 @@ if ($id > 0 || ! empty($ref))
{
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
print '<td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td>'.$langs->trans("ProjectContact").'</td>';
print '<td>'.$langs->trans("ContactType").'</td>';
print '<td colspan="3">&nbsp;</td>';
@ -365,7 +367,7 @@ if ($id > 0 || ! empty($ref))
// Liste des contacts lies
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
print '<td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td>'.$langs->trans("ProjectContact").'</td>';
print '<td>'.$langs->trans("ContactType").'</td>';
print '<td align="center">'.$langs->trans("Status").'</td>';

View File

@ -151,7 +151,7 @@ if ($object->id > 0)
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td>';
@ -214,7 +214,7 @@ if ($object->id > 0)
print '</td></tr>';
// Third party
print '<td>'.$langs->trans("Company").'</td><td colspan="3">';
print '<td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';

View File

@ -52,6 +52,8 @@ if ($id > 0 || ! empty($ref))
{
$projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
$object->project = dol_clone($projectstatic);
}
else
{
@ -131,7 +133,7 @@ if ($object->id > 0)
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td>';
@ -183,7 +185,7 @@ if ($object->id > 0)
print '</td></tr>';
// Third party
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1);
else print'&nbsp;';
print '</td></tr>';

View File

@ -198,6 +198,8 @@ if ($id > 0 || ! empty($ref))
$result=$projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
$object->project = dol_clone($projectstatic);
$userWrite = $projectstatic->restrictedProjectArea($user,'write');
if (! empty($withproject))
@ -226,7 +228,7 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td>';
@ -266,7 +268,7 @@ if ($id > 0 || ! empty($ref))
}
else
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NoPermission").'">'.$langs->trans('AddTask').'</a>';
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
}
print '</div>';
@ -309,7 +311,7 @@ if ($id > 0 || ! empty($ref))
print '</td></tr>';
// Third party
print '<td>'.$langs->trans("Company").'</td><td colspan="3">';
print '<td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';
@ -403,7 +405,7 @@ if ($id > 0 || ! empty($ref))
print '</td></tr>';
// Third party
print '<td>'.$langs->trans("Company").'</td><td colspan="3">';
print '<td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';

View File

@ -187,6 +187,8 @@ if ($id > 0 || ! empty($ref))
$result=$projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
$object->project = dol_clone($projectstatic);
$userWrite = $projectstatic->restrictedProjectArea($user,'write');
if ($withproject)
@ -217,7 +219,7 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
// Thirdparty
print '<tr><td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td>';
@ -281,7 +283,7 @@ if ($id > 0 || ! empty($ref))
print '</td></tr>';
// Third party
print '<td>'.$langs->trans("Company").'</td><td>';
print '<td>'.$langs->trans("ThirdParty").'</td><td>';
if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';

View File

@ -226,7 +226,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
$allmessage.= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices").($usehtml?"<br>\n":"\n");
}
$allmessage.= $message.($usehtml?"<br>\n":"\n");
$allmessage.= $langs->trans("Total")." = ".price($total,0,0,-1,$conf->currency).($usehtml?"<br>\n":"\n");
$allmessage.= $langs->trans("Total")." = ".price($total,0,$newlangs,0,0,-1,$conf->currency).($usehtml?"<br>\n":"\n");
if (! empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER))
{
$allmessage.=$conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER;

View File

@ -36,7 +36,10 @@ if ($langs->defaultlang != 'en_US')
print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
exit;
}
if (! empty($conf->google->enabled))
{
print "Warning: Google module should not be enabled.\n";
}
if (empty($user->id))
{
print "Load permissions for admin user nb 1\n";

View File

@ -76,7 +76,10 @@ class FactureTest extends PHPUnit_Framework_TestCase
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (! empty($conf->ecotaxdeee->enabled)) { print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(); }
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n";
}