New: Add constant to set label for level prices.

This commit is contained in:
Laurent Destailleur 2014-05-01 12:19:24 +02:00
parent 9dd605bd8a
commit fc9c491d15
2 changed files with 27 additions and 17 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@ -187,9 +187,6 @@ if ($id > 0)
dol_print_error($db,$object->error); dol_print_error($db,$object->error);
} }
/*
* Affichage onglets
*/
$head = societe_prepare_head($object); $head = societe_prepare_head($object);
@ -397,7 +394,6 @@ if ($id > 0)
print '</tr>'; print '</tr>';
} }
// Multiprice level // Multiprice level
if (! empty($conf->global->PRODUIT_MULTIPRICES)) if (! empty($conf->global->PRODUIT_MULTIPRICES))
{ {
@ -410,7 +406,11 @@ if ($id > 0)
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>'; print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
} }
print '</td></tr></table>'; print '</td></tr></table>';
print '</td><td colspan="3">'.$object->price_level."</td>"; print '</td><td colspan="3">';
print $object->price_level;
$keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$object->price_level;
if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
print "</td>";
print '</tr>'; print '</tr>';
} }
@ -887,11 +887,9 @@ if ($id > 0)
} }
print '</div>'; print '</div>';
print "<br>\n";
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
{ {
print '<br>';
// List of contacts // List of contacts
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -59,14 +59,17 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit-
$result = $object->fetch($id); $result = $object->fetch($id);
// MultiPrix // MultiPrix
if (! empty($conf->global->PRODUIT_MULTIPRICES)) { if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
$newprice = ''; $newprice = '';
$newprice_min = ''; $newprice_min = '';
$newpricebase = ''; $newpricebase = '';
$newvat = ''; $newvat = '';
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
if (isset($_POST ["price_" . $i])) { {
if (isset($_POST ["price_" . $i]))
{
$level = $i; $level = $i;
$newprice = price2num($_POST ["price_" . $i], 'MU'); $newprice = price2num($_POST ["price_" . $i], 'MU');
$newprice_min = price2num($_POST ["price_min_" . $i], 'MU'); $newprice_min = price2num($_POST ["price_min_" . $i], 'MU');
@ -129,8 +132,8 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu
// $newminprice=price2num(GETPOST("price_min"),'MU'); // TODO : Add min price management // $newminprice=price2num(GETPOST("price_min"),'MU'); // TODO : Add min price management
$quantity = GETPOST('quantity'); $quantity = GETPOST('quantity');
$remise_percent = price2num(GETPOST('remise_percent')); $remise_percent = price2num(GETPOST('remise_percent'));
$remise = 0; // TODO : allow dicsount by amount when available on documents $remise = 0; // TODO : allow discount by amount when available on documents
if (empty($quantity)) { if (empty($quantity)) {
$error ++; $error ++;
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Qty")) . '</div>'; $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Qty")) . '</div>';
@ -327,15 +330,24 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
// TVA // TVA
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->multiprices_tva_tx ["$soc->price_level"], true) . '</td></tr>'; print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->multiprices_tva_tx ["$soc->price_level"], true) . '</td></tr>';
} else { }
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { else
{
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
{
// TVA // TVA
if ($i == 1) // We show only price for level 1 if ($i == 1) // We show only price for level 1
{ {
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>'; print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>';
} }
print '<tr><td>' . $langs->trans("SellingPrice") . ' ' . $i . '</td>'; print '<tr>';
// Label of price
print '<td>' . $langs->trans("SellingPrice") . ' ' . $i;
$keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i;
if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
print '</td>';
if ($object->multiprices_base_type ["$i"] == 'TTC') { if ($object->multiprices_base_type ["$i"] == 'TTC') {
print '<td>' . price($object->multiprices_ttc ["$i"]); print '<td>' . price($object->multiprices_ttc ["$i"]);