Missing changes of PR #3927
This commit is contained in:
parent
8eb74b5bd4
commit
7f0d81d255
@ -431,13 +431,34 @@ $titre = $langs->trans("CardProduct" . $object->type);
|
|||||||
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||||
dol_fiche_head($head, 'price', $titre, 0, $picto);
|
dol_fiche_head($head, 'price', $titre, 0, $picto);
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<tr>';
|
||||||
|
print '<td width="20%">' . $langs->trans("Ref") . '</td><td colspan="2">';
|
||||||
|
print $form->showrefnav($object, 'ref', '', 1, 'ref');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
// Label
|
||||||
|
print '<tr><td>' . $langs->trans("Label") . '</td><td colspan="2">' . $object->label . '</td>';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
$isphoto = $object->is_photo_available($conf->product->multidir_output [$object->entity]);
|
||||||
print '<table class="border tableforfield" width="100%">';
|
|
||||||
|
$nblignes = 5;
|
||||||
|
if ($isphoto) {
|
||||||
|
// Photo
|
||||||
|
print '<td valign="middle" align="center" width="30%" rowspan="' . $nblignes . '">';
|
||||||
|
print $object->show_photos($conf->product->multidir_output [$object->entity], 1, 1, 0, 0, 0, 80);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Status (to sell)
|
||||||
|
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')</td><td colspan="2">';
|
||||||
|
print $object->getLibStatut(2, 0);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// MultiPrix
|
// MultiPrix
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
@ -450,7 +471,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
$soc->fetch($socid);
|
$soc->fetch($socid);
|
||||||
|
|
||||||
// Selling price
|
// Selling price
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("SellingPrice") . '</td>';
|
print '<tr>' . $langs->trans("SellingPrice") . '</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
if ($object->multiprices_base_type[$soc->price_level] == 'TTC') {
|
if ($object->multiprices_base_type[$soc->price_level] == 'TTC') {
|
||||||
print price($object->multiprices_ttc[$soc->price_level]);
|
print price($object->multiprices_ttc[$soc->price_level]);
|
||||||
@ -491,12 +512,12 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||||
{
|
{
|
||||||
// We show only vat for level 1
|
// We show only vat for level 1
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>';
|
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TVA
|
// TVA
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_titre"><td style="text-align: center">'.$langs->trans("PriceLevel").'</td><td style="text-align: center">'.$langs->trans("SellingPrice").'</td><td style="text-align: center">'.$langs->trans("MinPrice").'</td></tr>';
|
print '<tr class="liste_titre"><td style="text-align: center">'.$langs->trans("PriceLevel").'</td><td style="text-align: center">'.$langs->trans("SellingPrice").'</td><td style="text-align: center">'.$langs->trans("MinPrice").'</td></tr>';
|
||||||
@ -613,7 +634,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TVA
|
// TVA
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||||
|
|
||||||
// Price
|
// Price
|
||||||
print '<tr><td>' . $langs->trans("SellingPrice") . '</td><td>';
|
print '<tr><td>' . $langs->trans("SellingPrice") . '</td><td>';
|
||||||
@ -711,10 +732,6 @@ else
|
|||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
print '<div style="clear:both"></div>';
|
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
@ -793,7 +810,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se
|
|||||||
print '<br></form><br>';
|
print '<br></form><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'edit_price' && $object->getRights()->creer)
|
||||||
{
|
{
|
||||||
print load_fiche_titre($langs->trans("NewPrice"), '');
|
print load_fiche_titre($langs->trans("NewPrice"), '');
|
||||||
|
|
||||||
@ -809,7 +826,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">';
|
||||||
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
|
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -817,7 +834,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
print '<tr><td width="20%">';
|
print '<tr><td width="20%">';
|
||||||
print $langs->trans('PriceBase');
|
print $langs->trans('PriceBase');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td colspan="2">';
|
||||||
print $form->selectPriceBaseType($object->price_base_type, "price_base_type");
|
print $form->selectPriceBaseType($object->price_base_type, "price_base_type");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -825,7 +842,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
// Only show price mode and expression selector if module is enabled
|
// Only show price mode and expression selector if module is enabled
|
||||||
if (! empty($conf->dynamicprices->enabled)) {
|
if (! empty($conf->dynamicprices->enabled)) {
|
||||||
// Price mode selector
|
// Price mode selector
|
||||||
print '<tr><td>'.$langs->trans("PriceMode").'</td><td>';
|
print '<tr><td>'.$langs->trans("PriceMode").'</td><td colspan="2">';
|
||||||
$price_expression = new PriceExpression($db);
|
$price_expression = new PriceExpression($db);
|
||||||
$price_expression_list = array(0 => $langs->trans("PriceNumeric")); //Put the numeric mode as first option
|
$price_expression_list = array(0 => $langs->trans("PriceNumeric")); //Put the numeric mode as first option
|
||||||
foreach ($price_expression->list_price_expression() as $entry) {
|
foreach ($price_expression->list_price_expression() as $entry) {
|
||||||
@ -835,17 +852,18 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
print $form->selectarray('eid', $price_expression_list, $price_expression_preselection);
|
print $form->selectarray('eid', $price_expression_list, $price_expression_preselection);
|
||||||
print ' <div id="expression_editor" class="button">'.$langs->trans("PriceExpressionEditor").'</div>';
|
print ' <div id="expression_editor" class="button">'.$langs->trans("PriceExpressionEditor").'</div>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// This code hides the numeric price input if is not selected, loads the editor page if editor button is pressed
|
// This code hides the numeric price input if is not selected, loads the editor page if editor button is pressed
|
||||||
print '<script type="text/javascript">
|
?>
|
||||||
jQuery(document).ready(run);
|
|
||||||
function run() {
|
<script type="text/javascript">
|
||||||
jQuery("#expression_editor").click(on_click);
|
jQuery(document).ready(function() {
|
||||||
|
jQuery("#expression_editor").click(function() {
|
||||||
|
window.location = "<?php echo DOL_URL_ROOT ?>/product/dynamic_price/editor.php?id=<?php echo $id ?>&tab=price&eid=" + $("#eid").attr("value");
|
||||||
|
});
|
||||||
jQuery("#eid").change(on_change);
|
jQuery("#eid").change(on_change);
|
||||||
on_change();
|
on_change();
|
||||||
}
|
});
|
||||||
function on_click() {
|
|
||||||
window.location = "'.DOL_URL_ROOT.'/product/dynamic_price/editor.php?id='.$id.'&tab=price&eid=" + $("#eid").attr("value");
|
|
||||||
}
|
|
||||||
function on_change() {
|
function on_change() {
|
||||||
if ($("#eid").attr("value") == 0) {
|
if ($("#eid").attr("value") == 0) {
|
||||||
jQuery("#price_numeric").show();
|
jQuery("#price_numeric").show();
|
||||||
@ -853,7 +871,8 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
jQuery("#price_numeric").hide();
|
jQuery("#price_numeric").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>';
|
</script>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
// Price
|
// Price
|
||||||
@ -862,7 +881,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
print '<tr id="price_numeric"><td width="20%">';
|
print '<tr id="price_numeric"><td width="20%">';
|
||||||
$text = $langs->trans('SellingPrice');
|
$text = $langs->trans('SellingPrice');
|
||||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||||
print '</td><td>';
|
print '</td><td colspan="2">';
|
||||||
if ($object->price_base_type == 'TTC') {
|
if ($object->price_base_type == 'TTC') {
|
||||||
print '<input name="price" size="10" value="' . price($product->price_ttc) . '">';
|
print '<input name="price" size="10" value="' . price($product->price_ttc) . '">';
|
||||||
} else {
|
} else {
|
||||||
@ -874,16 +893,21 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
$text = $langs->trans('MinPrice');
|
$text = $langs->trans('MinPrice');
|
||||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||||
|
print '</td><td';
|
||||||
|
if (empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) {
|
||||||
|
print ' colspan="2"';
|
||||||
|
}
|
||||||
|
print '>';
|
||||||
if ($object->price_base_type == 'TTC') {
|
if ($object->price_base_type == 'TTC') {
|
||||||
print '<td><input name="price_min" size="10" value="' . price($object->price_min_ttc) . '">';
|
print '<input name="price_min" size="10" value="' . price($object->price_min_ttc) . '">';
|
||||||
} else {
|
} else {
|
||||||
print '<td><input name="price_min" size="10" value="' . price($object->price_min) . '">';
|
print '<input name="price_min" size="10" value="' . price($object->price_min) . '">';
|
||||||
}
|
}
|
||||||
if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
|
if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
|
||||||
{
|
{
|
||||||
print '<td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
|
print '</td><td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -927,65 +951,72 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
|
print '<input type="hidden" name="action" value="update_price">';
|
||||||
|
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||||
|
|
||||||
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) {
|
||||||
{
|
print $langs->trans('UseMultipriceRules'). ' <input type="checkbox" id="usePriceRules" name="usePriceRules" '.($object->price_autogen ? 'checked' : '').'><br><br>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($i > 1) print '<br>';
|
print '<table class="noborder">';
|
||||||
elseif (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) {
|
print '<tr class="liste_titre">
|
||||||
print $langs->trans('UseMultipriceRules'). ' <input type="checkbox" id="usePriceRules" name="usePriceRules" '.($object->price_autogen ? 'checked' : '').'><br><br>';
|
<td style="text-align: center">'.$langs->trans("PriceLevel").'</td>';
|
||||||
}
|
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<td style="text-align: center">'.$langs->trans("VATRate").'</td>';
|
||||||
print '<input type="hidden" name="action" value="update_price">';
|
}
|
||||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
print '<td style="text-align: center">'.$langs->trans("SellingPrice").'</td>
|
||||||
if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL))
|
<td style="text-align: center">'.$langs->trans("MinPrice").'</td>';
|
||||||
{
|
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) {
|
||||||
print '<input type="hidden" name="tva_tx[' . $i . ']" value="' . $object->tva_tx . '">';
|
print '<td></td>';
|
||||||
}
|
}
|
||||||
|
print '</tr>';
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) {
|
||||||
|
$var = !$var;
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->textwithpicto($langs->trans('SellingPrice') . ' ' . $i, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // This option is kept for backward compatibility but has no sense
|
if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {
|
||||||
{
|
print '<input type="hidden" name="tva_tx[' . $i . ']" value="' . $object->tva_tx . '">';
|
||||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
} else {
|
||||||
|
// This option is kept for backward compatibility but has no sense
|
||||||
|
print '<td style="text-align: center">';
|
||||||
print $form->load_tva("tva_tx[" . $i.']', $object->multiprices_tva_tx[$i], $mysoc, '', $object->id);
|
print $form->load_tva("tva_tx[" . $i.']', $object->multiprices_tva_tx[$i], $mysoc, '', $object->id);
|
||||||
print '</td></tr>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selling price
|
// Selling price
|
||||||
print '<tr><td width="20%">';
|
print '<td style="text-align: center">';
|
||||||
$text = $langs->trans('SellingPrice') . ' ' . $i;
|
|
||||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
|
||||||
print '</td><td>';
|
|
||||||
if ($object->multiprices_base_type [$i] == 'TTC') {
|
if ($object->multiprices_base_type [$i] == 'TTC') {
|
||||||
print '<input name="price[' . $i . ']" size="10" value="' . price($object->multiprices_ttc [$i]) . '">';
|
print '<input name="price[' . $i . ']" size="10" value="' . price($object->multiprices_ttc [$i]) . '">';
|
||||||
} else {
|
} else {
|
||||||
print '<input name="price[' . $i . ']" size="10" value="' . price($object->multiprices [$i]) . '">';
|
print '<input name="price[' . $i . ']" size="10" value="' . price($object->multiprices [$i]) . '">';
|
||||||
}
|
}
|
||||||
print ' '.$form->selectPriceBaseType($object->multiprices_base_type [$i], "multiprices_base_type[" . $i."]");
|
print ' '.$form->selectPriceBaseType($object->multiprices_base_type [$i], "multiprices_base_type[" . $i."]");
|
||||||
print '</td></tr>';
|
print '</td>';
|
||||||
|
|
||||||
// Min price
|
// Min price
|
||||||
print '<tr><td>';
|
print '<td style="text-align: center">';
|
||||||
$text = $langs->trans('MinPrice') . ' ' . $i;
|
|
||||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
|
||||||
if ($object->multiprices_base_type [$i] == 'TTC') {
|
if ($object->multiprices_base_type [$i] == 'TTC') {
|
||||||
print '<td><input name="price_min[' . $i . ']" size="10" value="' . price($object->multiprices_min_ttc [$i]) . '">';
|
print '<input name="price_min[' . $i . ']" size="10" value="' . price($object->multiprices_min_ttc [$i]) . '">';
|
||||||
} else {
|
} else {
|
||||||
print '<td><input name="price_min[' . $i . ']" size="10" value="' . price($object->multiprices_min [$i]) . '">';
|
print '<input name="price_min[' . $i . ']" size="10" value="' . price($object->multiprices_min [$i]) . '">';
|
||||||
}
|
}
|
||||||
if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
|
if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
|
||||||
{
|
{
|
||||||
print '<td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
|
print '<td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td>';
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br><div style="text-align: center">';
|
print '</table><br><div style="text-align: center">';
|
||||||
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
|
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user