Merge pull request #2538 from marcosgdf/units

NEW [ task 977 ] New option to manage product unit Migrated code from GPCSolutions/dolibarr:3.2-units branch and adapted for 3.8 with some improvements
This commit is contained in:
Laurent Destailleur
2015-04-21 11:14:50 +02:00
55 changed files with 1112 additions and 131 deletions

View File

@@ -8,6 +8,7 @@
* Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
*
* 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
@@ -2719,6 +2720,11 @@ abstract class CommonObject
// Qty
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td align="left" width="50">'.$langs->trans('Unit').'</td>';
}
// Reduction short
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
@@ -2918,7 +2924,7 @@ abstract class CommonObject
*/
function printOriginLinesList()
{
global $langs, $hookmanager;
global $langs, $hookmanager, $conf;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
@@ -2926,6 +2932,10 @@ abstract class CommonObject
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td align="left">'.$langs->trans('Unit').'</td>';
}
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
$num = count($this->lines);
@@ -2966,7 +2976,7 @@ abstract class CommonObject
*/
function printOriginLine($line,$var)
{
global $conf,$langs,$bc;
global $conf,$langs,$bc, $conf;
//var_dump($line);
if (!empty($line->date_start))
@@ -3053,6 +3063,7 @@ abstract class CommonObject
$this->tpl['vat_rate'] = vatrate($line->tva_tx, true);
$this->tpl['price'] = price($line->subprice);
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : '&nbsp;';
if($conf->global->PRODUCT_USE_UNITS) $this->tpl['unit'] = $line->get_unit_label('long');
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : '&nbsp;';
// Output template part (modules that overwrite templates must declare this into descriptor)