Fix: Debug of feature PRODUIT_CUSTOMER_PRICES_BY_QTY. Dev seems to not
be finished. We keep it as development status.
This commit is contained in:
parent
c6bb5904e7
commit
0b6ff8f9bc
@ -1749,7 +1749,7 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Price by quantity
|
// Price by quantity
|
||||||
if (!empty($objp->quantity) && $objp->quantity >= 1 && $conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)
|
if (!empty($objp->quantity) && $objp->quantity >= 1 && ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||||
{
|
{
|
||||||
$found = 1;
|
$found = 1;
|
||||||
$outqty=$objp->quantity;
|
$outqty=$objp->quantity;
|
||||||
|
|||||||
@ -198,7 +198,7 @@ HelpAddThisServiceCard=This option allows you to create or clone a service if it
|
|||||||
CurrentProductPrice=Current price
|
CurrentProductPrice=Current price
|
||||||
AlwaysUseNewPrice=Always use current price of product/service
|
AlwaysUseNewPrice=Always use current price of product/service
|
||||||
AlwaysUseFixedPrice=Use the fixed price
|
AlwaysUseFixedPrice=Use the fixed price
|
||||||
PriceByQuantity=Price by quantity
|
PriceByQuantity=Different prices by quantity
|
||||||
PriceByQuantityRange=Quantity range
|
PriceByQuantityRange=Quantity range
|
||||||
ProductsDashboard=Products/Services summary
|
ProductsDashboard=Products/Services summary
|
||||||
UpdateOriginalProductLabel=Modify original label
|
UpdateOriginalProductLabel=Modify original label
|
||||||
@ -234,9 +234,9 @@ DefinitionOfBarCodeForThirdpartyNotComplete=Definition of type or value of bar c
|
|||||||
BarCodeDataForProduct=Barcode information of product %s :
|
BarCodeDataForProduct=Barcode information of product %s :
|
||||||
BarCodeDataForThirdparty=Barcode information of thirdparty %s :
|
BarCodeDataForThirdparty=Barcode information of thirdparty %s :
|
||||||
ResetBarcodeForAllRecords=Define barcode value for all records (this will also reset barcode value already defined with new values)
|
ResetBarcodeForAllRecords=Define barcode value for all records (this will also reset barcode value already defined with new values)
|
||||||
PriceByCustomer=Price by customer
|
PriceByCustomer=Different price for each customer
|
||||||
PriceCatalogue=Unique price per product/service
|
PriceCatalogue=Unique price per product/service
|
||||||
PricingRule=Pricing Rules
|
PricingRule=Rules for customer prices
|
||||||
AddCustomerPrice=Add price by customers
|
AddCustomerPrice=Add price by customers
|
||||||
ForceUpdateChildPriceSoc=Set same price on customer subsidiaries
|
ForceUpdateChildPriceSoc=Set same price on customer subsidiaries
|
||||||
PriceByCustomerLog=Price by customer log
|
PriceByCustomerLog=Price by customer log
|
||||||
|
|||||||
@ -44,13 +44,13 @@ $value = GETPOST('value','alpha');
|
|||||||
|
|
||||||
// Pricing Rules
|
// Pricing Rules
|
||||||
$select_pricing_rules=array(
|
$select_pricing_rules=array(
|
||||||
'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price
|
'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price
|
||||||
'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level
|
'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level
|
||||||
'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer') // Different price for each customer
|
'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer
|
||||||
);
|
);
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL==2)
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity');
|
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity'); // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice
|
||||||
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity');
|
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,14 +58,16 @@ $price_by_qty_rowid = GETPOST('pbq', 'int');
|
|||||||
dol_syslog(join(',', $_GET));
|
dol_syslog(join(',', $_GET));
|
||||||
// print_r($_GET);
|
// print_r($_GET);
|
||||||
|
|
||||||
if (! empty($action) && $action == 'fetch' && ! empty($id)) {
|
if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||||
|
{
|
||||||
require DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
|
|
||||||
$outjson = array();
|
$outjson = array();
|
||||||
|
|
||||||
$object = new Product($db);
|
$object = new Product($db);
|
||||||
$ret = $object->fetch($id);
|
$ret = $object->fetch($id);
|
||||||
if ($ret > 0) {
|
if ($ret > 0)
|
||||||
|
{
|
||||||
$outref = $object->ref;
|
$outref = $object->ref;
|
||||||
$outlabel = $object->label;
|
$outlabel = $object->label;
|
||||||
$outdesc = $object->description;
|
$outdesc = $object->description;
|
||||||
@ -76,9 +78,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id)) {
|
|||||||
$found = false;
|
$found = false;
|
||||||
|
|
||||||
// Price by qty
|
// Price by qty
|
||||||
if (! empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))) // If we need a
|
if (! empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))) // If we need a particular price related to qty
|
||||||
// particular price related
|
|
||||||
// to qty
|
|
||||||
{
|
{
|
||||||
$sql = "SELECT price, unitprice, quantity, remise_percent";
|
$sql = "SELECT price, unitprice, quantity, remise_percent";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_price_by_qty ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "product_price_by_qty ";
|
||||||
|
|||||||
@ -430,12 +430,13 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Price by quantity
|
// Price by quantity
|
||||||
if ($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) {
|
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||||
|
{
|
||||||
print '<tr><td>' . $langs->trans("PriceByQuantity") . ' ' . $i;
|
print '<tr><td>' . $langs->trans("PriceByQuantity") . ' ' . $i;
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|
||||||
if ($object->prices_by_qty [$i] == 1) {
|
if ($object->prices_by_qty [$i] == 1) {
|
||||||
print '<table width="50%" class="noborder">';
|
print '<table width="50%" class="border" summary="List of quantities">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans("PriceByQuantityRange") . ' ' . $i . '</td>';
|
print '<td>' . $langs->trans("PriceByQuantityRange") . ' ' . $i . '</td>';
|
||||||
@ -445,30 +446,30 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
foreach ($object->prices_by_qty_list [$i] as $ii => $prices) {
|
foreach ($object->prices_by_qty_list [$i] as $ii => $prices) {
|
||||||
if ($action == 'edit_price_by_qty' && $rowid == $prices ['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
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="action" value="update_price_by_qty">';
|
print '<input type="hidden" name="action" value="update_price_by_qty">';
|
||||||
print '<input type="hidden" name="priceid" value="' . $object->prices_by_qty_id [$i] . '">';
|
print '<input type="hidden" name="priceid" value="' . $object->prices_by_qty_id[$i] . '">';
|
||||||
print '<input type="hidden" value="' . $prices ['rowid'] . '" name="rowid">';
|
print '<input type="hidden" value="' . $prices['rowid'] . '" name="rowid">';
|
||||||
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
||||||
print '<td><input size="5" type="text" value="' . $prices ['quantity'] . '" name="quantity"></td>';
|
print '<td><input size="5" type="text" value="' . $prices['quantity'] . '" name="quantity"></td>';
|
||||||
print '<td align="right" colspan="2"><input size="10" type="text" value="' . $prices ['price'] . '" name="price"> ' . $object->price_base_type . '</td>';
|
print '<td align="right" colspan="2"><input size="10" type="text" value="' . price2num($prices['price'], 'MU') . '" name="price"> ' . $object->price_base_type . '</td>';
|
||||||
// print '<td align="right"> </td>';
|
// print '<td align="right"> </td>';
|
||||||
print '<td align="right"><input size="5" type="text" value="' . $prices ['remise_percent'] . '" name="remise_percent"> %</td>';
|
print '<td align="right"><input size="5" type="text" value="' . $prices['remise_percent'] . '" name="remise_percent"> %</td>';
|
||||||
print '<td align="center"><input type="submit" value="' . $langs->trans("Modify") . '" class="button"></td>';
|
print '<td align="center"><input type="submit" value="' . $langs->trans("Modify") . '" class="button"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
||||||
print '<td>' . $prices ['quantity'] . '</td>';
|
print '<td>' . $prices ['quantity'] . '</td>';
|
||||||
print '<td align="right">' . price($prices ['price']) . '</td>';
|
print '<td align="right">' . price($prices['price']) . '</td>';
|
||||||
print '<td align="right">' . price($prices ['unitprice']) . '</td>';
|
print '<td align="right">' . price($prices['unitprice']) . '</td>';
|
||||||
print '<td align="right">' . price($prices ['remise_percent']) . ' %</td>';
|
print '<td align="right">' . price($prices['remise_percent']) . ' %</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if (($user->rights->produit->creer || $user->rights->service->creer)) {
|
if (($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit_price_by_qty&rowid=' . $prices ["rowid"] . '">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit_price_by_qty&rowid=' . $prices["rowid"] . '">';
|
||||||
print img_edit() . '</a>';
|
print img_edit() . '</a>';
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete_price_by_qty&rowid=' . $prices ["rowid"] . '">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete_price_by_qty&rowid=' . $prices["rowid"] . '">';
|
||||||
print img_delete() . '</a>';
|
print img_delete() . '</a>';
|
||||||
} else {
|
} else {
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -480,7 +481,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
if ($action != 'edit_price_by_qty' && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
if ($action != 'edit_price_by_qty' && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
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="action" value="update_price_by_qty">';
|
print '<input type="hidden" name="action" value="update_price_by_qty">';
|
||||||
print '<input type="hidden" name="priceid" value="' . $object->prices_by_qty_id [$i] . '">';
|
print '<input type="hidden" name="priceid" value="' . $object->prices_by_qty_id[$i] . '">';
|
||||||
print '<input type="hidden" value="0" name="rowid">';
|
print '<input type="hidden" value="0" name="rowid">';
|
||||||
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
||||||
print '<td><input size="5" type="text" value="1" name="quantity"></td>';
|
print '<td><input size="5" type="text" value="1" name="quantity"></td>';
|
||||||
@ -524,7 +525,8 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Price by quantity
|
// Price by quantity
|
||||||
if ($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) {
|
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||||
|
{
|
||||||
print '<tr><td>' . $langs->trans("PriceByQuantity");
|
print '<tr><td>' . $langs->trans("PriceByQuantity");
|
||||||
if ($object->prices_by_qty [0] == 0) {
|
if ($object->prices_by_qty [0] == 0) {
|
||||||
print ' <a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=activate_price_by_qty&level=1">' . $langs->trans("Activate");
|
print ' <a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=activate_price_by_qty&level=1">' . $langs->trans("Activate");
|
||||||
@ -532,7 +534,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|
||||||
if ($object->prices_by_qty [0] == 1) {
|
if ($object->prices_by_qty [0] == 1) {
|
||||||
print '<table width="50%" class="noborder">';
|
print '<table width="50%" class="border" summary="List of quantities">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans("PriceByQuantityRange") . '</td>';
|
print '<td>' . $langs->trans("PriceByQuantityRange") . '</td>';
|
||||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||||
@ -540,31 +542,33 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
print '<td align="right">' . $langs->trans("Discount") . '</td>';
|
print '<td align="right">' . $langs->trans("Discount") . '</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
foreach ($object->prices_by_qty_list [0] as $ii => $prices) {
|
foreach ($object->prices_by_qty_list [0] as $ii => $prices)
|
||||||
if ($action == 'edit_price_by_qty' && $rowid == $prices ['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
{
|
||||||
|
if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
|
{
|
||||||
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="action" value="update_price_by_qty">';
|
print '<input type="hidden" name="action" value="update_price_by_qty">';
|
||||||
print '<input type="hidden" name="priceid" value="' . $object->prices_by_qty_id [0] . '">';
|
print '<input type="hidden" name="priceid" value="' . $object->prices_by_qty_id[0] . '">';
|
||||||
print '<input type="hidden" value="' . $prices ['rowid'] . '" name="rowid">';
|
print '<input type="hidden" value="' . $prices['rowid'] . '" name="rowid">';
|
||||||
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
||||||
print '<td><input size="5" type="text" value="' . $prices ['quantity'] . '" name="quantity"></td>';
|
print '<td><input size="5" type="text" value="' . $prices['quantity'] . '" name="quantity"></td>';
|
||||||
print '<td align="right" colspan="2"><input size="10" type="text" value="' . $prices ['price'] . '" name="price"> ' . $object->price_base_type . '</td>';
|
print '<td align="right" colspan="2"><input size="10" type="text" value="' . price2num($prices['price'], 'MU') . '" name="price"> ' . $object->price_base_type . '</td>';
|
||||||
// print '<td align="right"> </td>';
|
// print '<td align="right"> </td>';
|
||||||
print '<td align="right"><input size="5" type="text" value="' . $prices ['remise_percent'] . '" name="remise_percent"> %</td>';
|
print '<td align="right"><input size="5" type="text" value="' . $prices['remise_percent'] . '" name="remise_percent"> %</td>';
|
||||||
print '<td align="center"><input type="submit" value="' . $langs->trans("Modify") . '" class="button"></td>';
|
print '<td align="center"><input type="submit" value="' . $langs->trans("Modify") . '" class="button"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
|
||||||
print '<td>' . $prices ['quantity'] . '</td>';
|
print '<td>' . $prices['quantity'] . '</td>';
|
||||||
print '<td align="right">' . price($prices ['price']) . '</td>';
|
print '<td align="right">' . price($prices['price']) . '</td>';
|
||||||
print '<td align="right">' . price($prices ['unitprice']) . '</td>';
|
print '<td align="right">' . price($prices['unitprice']) . '</td>';
|
||||||
print '<td align="right">' . price($prices ['remise_percent']) . ' %</td>';
|
print '<td align="right">' . price($prices['remise_percent']) . ' %</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if (($user->rights->produit->creer || $user->rights->service->creer)) {
|
if (($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit_price_by_qty&rowid=' . $prices ["rowid"] . '">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit_price_by_qty&rowid=' . $prices["rowid"] . '">';
|
||||||
print img_edit() . '</a>';
|
print img_edit() . '</a>';
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete_price_by_qty&rowid=' . $prices ["rowid"] . '">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete_price_by_qty&rowid=' . $prices["rowid"] . '">';
|
||||||
print img_delete() . '</a>';
|
print img_delete() . '</a>';
|
||||||
} else {
|
} else {
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -803,7 +807,8 @@ if ($result) {
|
|||||||
print '<td align="center">' . $objp->price_level . "</td>";
|
print '<td align="center">' . $objp->price_level . "</td>";
|
||||||
}
|
}
|
||||||
// Price by quantity
|
// Price by quantity
|
||||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||||
|
{
|
||||||
$type = ($objp->price_by_qty == 1) ? 'PriceByQuantity' : 'Standard';
|
$type = ($objp->price_by_qty == 1) ? 'PriceByQuantity' : 'Standard';
|
||||||
print '<td align="center">' . $langs->trans($type) . "</td>";
|
print '<td align="center">' . $langs->trans($type) . "</td>";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user