Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0

This commit is contained in:
Laurent Destailleur 2016-08-04 10:12:34 +02:00
commit f14ef7b50f
4 changed files with 25 additions and 14 deletions

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
@ -831,6 +831,7 @@ if ($action == "addline" && $user->rights->expensereport->creer)
$object_ligne = new ExpenseReportLine($db);
$vatrate = GETPOST('vatrate');
$object_ligne->comments = GETPOST('comments');
$qty = GETPOST('qty','int');
if (empty($qty)) $qty=1;
@ -843,10 +844,13 @@ if ($action == "addline" && $user->rights->expensereport->creer)
$object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees');
$object_ligne->fk_c_tva = GETPOST('fk_c_tva');
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
if (empty($vatrate)) $vatrate = "0.000";
$object_ligne->vatrate = price2num($vatrate);
$object_ligne->fk_projet = $fk_projet;
if (! GETPOST('fk_c_type_fees') > 0)
{
@ -854,10 +858,11 @@ if ($action == "addline" && $user->rights->expensereport->creer)
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$action='';
}
if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '')
if ($vatrate < 0 || $vatrate == '')
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors');
$action='';
}
@ -1096,7 +1101,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
print '<tbody>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td>';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("DateStart").'</td>';
print '<td>';
$form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1);
print '</td>';
@ -1211,7 +1216,7 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
@ -1374,7 +1379,7 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="2">';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="2">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
@ -1683,7 +1688,8 @@ else
}
print '</td>';
}
print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).'</td>';
// print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).'</td>';
print '<td style="text-align:center;">'.($langs->trans(($objp->type_fees_code)) == $objp->type_fees_code ? $objp->type_fees_libelle : $langs->trans(($objp->type_fees_code))).'</td>';
print '<td style="text-align:left;">'.$objp->comments.'</td>';
print '<td style="text-align:right;">'.vatrate($objp->vatrate,true).'</td>';
print '<td style="text-align:right;">'.price($objp->value_unit).'</td>';
@ -1789,7 +1795,7 @@ else
print '<td align="center">'.$langs->trans('Date').'</td>';
if (! empty($conf->projet->enabled)) print '<td>'.$langs->trans('Project').'</td>';
print '<td align="center">'.$langs->trans('Type').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td colspan="2">'.$langs->trans('Description').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUTTC').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
@ -1807,7 +1813,7 @@ else
// Select project
if (! empty($conf->projet->enabled))
{
print '<td>';
print '<td align="center">';
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1);
print '</td>';
}
@ -1818,7 +1824,7 @@ else
print '</td>';
// Add comments
print '<td>';
print '<td colspan="2">';
print '<textarea class="flat_ndf centpercent" name="comments">'.$comments.'</textarea>';
print '</td>';

View File

@ -40,7 +40,7 @@ $result = restrictedArea($user, 'expensereport', $id, '');
* View
*/
llxHeader();
llxHeader('', $langs->trans("ExpenseReport"));
if ($id)
{

View File

@ -50,6 +50,7 @@ if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.datef";
$object = new Societe($db);
if ($socid > 0) $object->fetch($socid);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('thirdpartymargins','globalcard'));
@ -72,8 +73,10 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
$invoicestatic=new Facture($db);
$form = new Form($db);
$title=$langs->trans("ThirdParty").' - '.$langs->trans("Margins");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files");
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Margins"),$help_url);
llxHeader('',$title,$help_url);
if ($socid > 0)
{

View File

@ -57,8 +57,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
$form = new Form($db);
$title=$langs->trans("ThirdParty").' - '.$langs->trans("Notes");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files");
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Notes"),$help_url);
llxHeader('',$title,$help_url);
if ($id > 0)
{