Skip to content

Commit

Permalink
Merge pull request #5575 from aspangaro/4.0-p36
Browse files Browse the repository at this point in the history
Fix Expense report | if VAT disable in Dolibarr, traduction of code_libelle & presentation
  • Loading branch information
Juanjo Menent committed Aug 3, 2016
2 parents abbe204 + f232ae9 commit 51a4f9e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
28 changes: 17 additions & 11 deletions htdocs/expensereport/card.php
Expand Up @@ -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
Expand Down Expand Up @@ -831,6 +831,7 @@

$object_ligne = new ExpenseReportLine($db);

$vatrate = GETPOST('vatrate');
$object_ligne->comments = GETPOST('comments');
$qty = GETPOST('qty','int');
if (empty($qty)) $qty=1;
Expand All @@ -843,21 +844,25 @@

$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)
{
$error++;
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='';
}

Expand Down Expand Up @@ -1096,7 +1101,7 @@
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>';
Expand Down Expand Up @@ -1211,7 +1216,7 @@
$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>';

Expand Down Expand Up @@ -1374,7 +1379,7 @@
$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>';

Expand Down Expand Up @@ -1683,7 +1688,8 @@
}
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>';
Expand Down Expand Up @@ -1789,7 +1795,7 @@
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>';
Expand All @@ -1807,7 +1813,7 @@
// 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>';
}
Expand All @@ -1818,7 +1824,7 @@
print '</td>';

// Add comments
print '<td>';
print '<td colspan="2">';
print '<textarea class="flat_ndf centpercent" name="comments">'.$comments.'</textarea>';
print '</td>';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/expensereport/info.php
Expand Up @@ -40,7 +40,7 @@
* View
*/

llxHeader();
llxHeader('', $langs->trans("ExpenseReport"));

if ($id)
{
Expand Down
5 changes: 4 additions & 1 deletion htdocs/margin/tabs/thirdpartyMargins.php
Expand Up @@ -50,6 +50,7 @@
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'));
Expand All @@ -72,8 +73,10 @@
$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)
{
Expand Down
4 changes: 3 additions & 1 deletion htdocs/societe/note.php
Expand Up @@ -57,8 +57,10 @@

$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)
{
Expand Down

0 comments on commit 51a4f9e

Please sign in to comment.