Skip to content
Snippets Groups Projects
Commit f232ae91 authored by aspangaro's avatar aspangaro
Browse files

Fix Expense report | VAT disable in Dolibarr, traduction of code_libelle & presentation

parent dd2e4375
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * 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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -831,6 +831,7 @@ if ($action == "addline" && $user->rights->expensereport->creer) ...@@ -831,6 +831,7 @@ if ($action == "addline" && $user->rights->expensereport->creer)
$object_ligne = new ExpenseReportLine($db); $object_ligne = new ExpenseReportLine($db);
$vatrate = GETPOST('vatrate');
$object_ligne->comments = GETPOST('comments'); $object_ligne->comments = GETPOST('comments');
$qty = GETPOST('qty','int'); $qty = GETPOST('qty','int');
if (empty($qty)) $qty=1; if (empty($qty)) $qty=1;
...@@ -843,10 +844,13 @@ if ($action == "addline" && $user->rights->expensereport->creer) ...@@ -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_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->vatrate = price2num($vatrate);
$object_ligne->fk_projet = $fk_projet; $object_ligne->fk_projet = $fk_projet;
if (! GETPOST('fk_c_type_fees') > 0) if (! GETPOST('fk_c_type_fees') > 0)
{ {
...@@ -854,10 +858,11 @@ if ($action == "addline" && $user->rights->expensereport->creer) ...@@ -854,10 +858,11 @@ if ($action == "addline" && $user->rights->expensereport->creer)
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$action=''; $action='';
} }
if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '')
if ($vatrate < 0 || $vatrate == '')
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors');
$action=''; $action='';
} }
...@@ -1096,7 +1101,7 @@ if ($action == 'create') ...@@ -1096,7 +1101,7 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tbody>'; print '<tbody>';
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td>'; print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("DateStart").'</td>';
print '<td>'; print '<td>';
$form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1); $form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1);
print '</td>'; print '</td>';
...@@ -1211,7 +1216,7 @@ else ...@@ -1211,7 +1216,7 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref // 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 $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>'; print '</td></tr>';
...@@ -1374,7 +1379,7 @@ else ...@@ -1374,7 +1379,7 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref // 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 $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>'; print '</td></tr>';
...@@ -1683,7 +1688,8 @@ else ...@@ -1683,7 +1688,8 @@ else
} }
print '</td>'; 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:left;">'.$objp->comments.'</td>';
print '<td style="text-align:right;">'.vatrate($objp->vatrate,true).'</td>'; print '<td style="text-align:right;">'.vatrate($objp->vatrate,true).'</td>';
print '<td style="text-align:right;">'.price($objp->value_unit).'</td>'; print '<td style="text-align:right;">'.price($objp->value_unit).'</td>';
...@@ -1789,7 +1795,7 @@ else ...@@ -1789,7 +1795,7 @@ else
print '<td align="center">'.$langs->trans('Date').'</td>'; print '<td align="center">'.$langs->trans('Date').'</td>';
if (! empty($conf->projet->enabled)) print '<td>'.$langs->trans('Project').'</td>'; if (! empty($conf->projet->enabled)) print '<td>'.$langs->trans('Project').'</td>';
print '<td align="center">'.$langs->trans('Type').'</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('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUTTC').'</td>'; print '<td align="right">'.$langs->trans('PriceUTTC').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>'; print '<td align="right">'.$langs->trans('Qty').'</td>';
...@@ -1807,7 +1813,7 @@ else ...@@ -1807,7 +1813,7 @@ else
// Select project // Select project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<td>'; print '<td align="center">';
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1); $formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1);
print '</td>'; print '</td>';
} }
...@@ -1818,7 +1824,7 @@ else ...@@ -1818,7 +1824,7 @@ else
print '</td>'; print '</td>';
// Add comments // Add comments
print '<td>'; print '<td colspan="2">';
print '<textarea class="flat_ndf centpercent" name="comments">'.$comments.'</textarea>'; print '<textarea class="flat_ndf centpercent" name="comments">'.$comments.'</textarea>';
print '</td>'; print '</td>';
......
...@@ -40,7 +40,7 @@ $result = restrictedArea($user, 'expensereport', $id, ''); ...@@ -40,7 +40,7 @@ $result = restrictedArea($user, 'expensereport', $id, '');
* View * View
*/ */
llxHeader(); llxHeader('', $langs->trans("ExpenseReport"));
if ($id) if ($id)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment