Skip to content

Commit

Permalink
New: Add constant to set label for level prices.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed May 1, 2014
1 parent 9dd605b commit fc9c491
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
14 changes: 6 additions & 8 deletions htdocs/comm/fiche.php
@@ -1,6 +1,6 @@
<?php
/* 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) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
Expand Down Expand Up @@ -187,9 +187,6 @@
dol_print_error($db,$object->error);
}

/*
* Affichage onglets
*/

$head = societe_prepare_head($object);

Expand Down Expand Up @@ -397,7 +394,6 @@
print '</tr>';
}


// Multiprice level
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
Expand All @@ -410,7 +406,11 @@
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
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>';
}

Expand Down Expand Up @@ -887,11 +887,9 @@
}

print '</div>';
print "<br>\n";

if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
{
print '<br>';
// List of contacts
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
}
Expand Down
30 changes: 21 additions & 9 deletions htdocs/product/price.php
@@ -1,6 +1,6 @@
<?php
/* 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-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
Expand Down Expand Up @@ -59,14 +59,17 @@
$result = $object->fetch($id);

// MultiPrix
if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
$newprice = '';
$newprice_min = '';
$newpricebase = '';
$newvat = '';

for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) {
if (isset($_POST ["price_" . $i])) {
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
{
if (isset($_POST ["price_" . $i]))
{
$level = $i;
$newprice = price2num($_POST ["price_" . $i], 'MU');
$newprice_min = price2num($_POST ["price_min_" . $i], 'MU');
Expand Down Expand Up @@ -129,8 +132,8 @@
// $newminprice=price2num(GETPOST("price_min"),'MU'); // TODO : Add min price management
$quantity = GETPOST('quantity');
$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)) {
$error ++;
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Qty")) . '</div>';
Expand Down Expand Up @@ -327,15 +330,24 @@

// TVA
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
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("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') {
print '<td>' . price($object->multiprices_ttc ["$i"]);
Expand Down

0 comments on commit fc9c491

Please sign in to comment.