New: works with variants:
- If product is variant disable prices modify - Add function isVariant for knowing if product is a Variant
This commit is contained in:
parent
f65df9e541
commit
e40ee879dc
@ -331,6 +331,7 @@ NbProducts=No. of products
|
|||||||
ParentProduct=Parent product
|
ParentProduct=Parent product
|
||||||
HideChildProducts=Hide variant products
|
HideChildProducts=Hide variant products
|
||||||
ShowChildProducts=Show variant products
|
ShowChildProducts=Show variant products
|
||||||
|
NoEditVariants=Go to Parent product card and edit variants price impact in the variants tab
|
||||||
ConfirmCloneProductCombinations=Would you like to copy all the product variants to the other parent product with the given reference?
|
ConfirmCloneProductCombinations=Would you like to copy all the product variants to the other parent product with the given reference?
|
||||||
CloneDestinationReference=Destination product reference
|
CloneDestinationReference=Destination product reference
|
||||||
ErrorCopyProductCombinations=There was an error while copying the product variants
|
ErrorCopyProductCombinations=There was an error while copying the product variants
|
||||||
|
|||||||
@ -3529,6 +3529,36 @@ class Product extends CommonObject
|
|||||||
return $nb;
|
return $nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if loaded product is a variant
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function isVariant()
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
if (!empty($conf->variants->enabled)) {
|
||||||
|
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_attribute_combination WHERE fk_product_child = " . $this->id . " AND entity IN (" . getEntity('product') . ")";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($query) {
|
||||||
|
if (!$this->db->num_rows($query)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all parent products for current product (first level only)
|
* Return all parent products for current product (first level only)
|
||||||
*
|
*
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014-2018 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2014-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2014-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
@ -1109,30 +1109,33 @@ if (! $action || $action == 'delete' || $action == 'showlog_customer_price' || $
|
|||||||
{
|
{
|
||||||
print "\n" . '<div class="tabsAction">' . "\n";
|
print "\n" . '<div class="tabsAction">' . "\n";
|
||||||
|
|
||||||
if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
if ($object->isVariant()) {
|
||||||
{
|
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEditVariants")).'">'.$langs->trans("UpdateDefaultPrice").'</a></div>';
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&id=' . $object->id . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
|
}
|
||||||
}
|
} else {
|
||||||
}
|
if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||||
|
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&id=' . $object->id . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||||
{
|
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||||
{
|
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&id=' . $object->id . '">' . $langs->trans("UpdateLevelPrices") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&id=' . $object->id . '">' . $langs->trans("UpdateLevelPrices") . '</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user