diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index cbd22856e4c..1d9ffd61a99 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -812,6 +812,8 @@ foreach ($listofreferent as $key => $value) $warning=''; if (empty($value['disableamount'])) { + $total_ht_by_line=null; + $othermessage=''; if ($tablename == 'don') $total_ht_by_line=$element->amount; elseif ($tablename == 'projet_task') { @@ -828,7 +830,7 @@ foreach ($listofreferent as $key => $value) } else { - print $langs->trans("ModuleDisabled"); + $othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); } } else @@ -836,9 +838,13 @@ foreach ($listofreferent as $key => $value) $total_ht_by_line=$element->total_ht; } print ''; - if (! $qualifiedfortotal) print ''; - print (isset($total_ht_by_line)?price($total_ht_by_line):' '); - if (! $qualifiedfortotal) print ''; + if ($othermessage) print $othermessage; + if (isset($total_ht_by_line)) + { + if (! $qualifiedfortotal) print ''; + print price($total_ht_by_line); + if (! $qualifiedfortotal) print ''; + } if ($warning) print ' '.img_warning($warning); print ''; } @@ -847,20 +853,33 @@ foreach ($listofreferent as $key => $value) // Amount inc tax if (empty($value['disableamount'])) { + $total_ttc_by_line=null; if ($tablename == 'don') $total_ttc_by_line=$element->amount; elseif ($tablename == 'projet_task') { - $defaultvat = get_default_tva($mysoc, $mysoc); - $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + if (! empty($conf->salaries->enabled)) + { + // TODO Permission to read daily rate + $defaultvat = get_default_tva($mysoc, $mysoc); + $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + } + else + { + $othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); + } } else { $total_ttc_by_line=$element->total_ttc; } print ''; - if (! $qualifiedfortotal) print ''; - print (isset($total_ttc_by_line)?price($total_ttc_by_line):' '); - if (! $qualifiedfortotal) print ''; + if ($othermessage) print $othermessage; + if (isset($total_ttc_by_line)) + { + if (! $qualifiedfortotal) print ''; + print price($total_ttc_by_line); + if (! $qualifiedfortotal) print ''; + } if ($warning) print ' '.img_warning($warning); print ''; } @@ -923,15 +942,25 @@ foreach ($listofreferent as $key => $value) if ($breakline) print $breakline; + // Total print ''.$langs->trans("Number").': '.$i.''; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("TotalHT").' : '.price($total_ht).''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''.$langs->trans("Total").' : '.price($total_ht).''; - if (empty($value['disableamount'])) print ''.$langs->trans("TotalHT").' : '.price($total_ht).''; - else print ''; + print ''; + if (empty($value['disableamount'])) + { + if (! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); + } + print ''; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; - else print ''; + print ''; + if (empty($value['disableamount'])) + { + + if (! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); + } + print ''; print ' '; print ''; }