Make some product fields hidable
This commit allows to hide some more fields in the product card (e.g. you can hide SIZE but not WEIGHT). To allow the product card to be customized a bit better, following new variables can be set to hide the corresponding fields: PRODUCT_DISABLE_PUBLIC_URL PRODUCT_DISABLE_STOCK_LEVELS PRODUCT_DISABLE_NATURE PRODUCT_DISABLE_WEIGHT PRODUCT_DISABLE_PRICES PRODUCT_DISABLE_ACCOUNTING The documentation has to be adapted accordingly.
This commit is contained in:
parent
ac6bbc1914
commit
3134f5be8f
@ -1188,11 +1188,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) {
|
||||||
// Public URL
|
// Public URL
|
||||||
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td>';
|
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td>';
|
||||||
print img_picto('', 'globe', 'class="pictofixedwidth"');
|
print img_picto('', 'globe', 'class="pictofixedwidth"');
|
||||||
print '<input type="text" name="url" class="quatrevingtpercent" value="'.GETPOST('url').'">';
|
print '<input type="text" name="url" class="quatrevingtpercent" value="'.GETPOST('url').'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($type != 1 && !empty($conf->stock->enabled)) {
|
if ($type != 1 && !empty($conf->stock->enabled)) {
|
||||||
// Default warehouse
|
// Default warehouse
|
||||||
@ -1205,6 +1207,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_STOCK_LEVELS)) {
|
||||||
// Stock min level
|
// Stock min level
|
||||||
print '<tr><td>'.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).'</td><td>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).'</td><td>';
|
||||||
print '<input name="seuil_stock_alerte" class="maxwidth50" value="'.GETPOST('seuil_stock_alerte').'">';
|
print '<input name="seuil_stock_alerte" class="maxwidth50" value="'.GETPOST('seuil_stock_alerte').'">';
|
||||||
@ -1216,10 +1219,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<tr><td>'.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).'</td><td>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).'</td><td>';
|
||||||
print '<input name="desiredstock" class="maxwidth50" value="'.GETPOST('desiredstock').'">';
|
print '<input name="desiredstock" class="maxwidth50" value="'.GETPOST('desiredstock').'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_STOCK_LEVELS)) {
|
||||||
print '<input name="seuil_stock_alerte" type="hidden" value="0">';
|
print '<input name="seuil_stock_alerte" type="hidden" value="0">';
|
||||||
print '<input name="desiredstock" type="hidden" value="0">';
|
print '<input name="desiredstock" type="hidden" value="0">';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if ($type == 1) {
|
if ($type == 1) {
|
||||||
@ -1230,17 +1236,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($type != 1) { // Nature, Weight and volume only applies to products and not to services
|
if ($type != 1) { // Nature, Weight and volume only applies to products and not to services
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_NATURE)) {
|
||||||
// Nature
|
// Nature
|
||||||
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
||||||
$statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
$statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||||
print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1);
|
print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) {
|
||||||
// Brut Weight
|
// Brut Weight
|
||||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||||
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
|
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
|
||||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
|
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Brut Length
|
// Brut Length
|
||||||
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
||||||
@ -1349,6 +1359,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
|
|
||||||
print '<hr>';
|
print '<hr>';
|
||||||
|
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_PRICES)) {
|
||||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||||
// We do no show price array on create when multiprices enabled.
|
// We do no show price array on create when multiprices enabled.
|
||||||
// We must set them on prices tab.
|
// We must set them on prices tab.
|
||||||
@ -1385,11 +1396,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Accountancy codes
|
// Accountancy codes
|
||||||
print '<!-- accountancy codes -->'."\n";
|
print '<!-- accountancy codes -->'."\n";
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) {
|
||||||
if (!empty($conf->accounting->enabled)) {
|
if (!empty($conf->accounting->enabled)) {
|
||||||
// Accountancy_code_sell
|
// Accountancy_code_sell
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||||
@ -1514,6 +1527,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy_export" value="'.$object->accountancy_code_buy_export.'">';
|
print '<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy_export" value="'.$object->accountancy_code_buy_export.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
@ -1708,9 +1722,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
// Public Url
|
// Public Url
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) {
|
||||||
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td>';
|
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td>';
|
||||||
print '<input type="text" name="url" class="quatrevingtpercent" value="'.$object->url.'">';
|
print '<input type="text" name="url" class="quatrevingtpercent" value="'.$object->url.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Stock
|
// Stock
|
||||||
if ($object->isProduct() && !empty($conf->stock->enabled)) {
|
if ($object->isProduct() && !empty($conf->stock->enabled)) {
|
||||||
@ -1743,16 +1759,20 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1);
|
print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
} else {
|
} else {
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_NATURE)) {
|
||||||
// Nature
|
// Nature
|
||||||
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
||||||
print $formproduct->selectProductNature('finished', $object->finished);
|
print $formproduct->selectProductNature('finished', $object->finished);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) {
|
||||||
// Brut Weight
|
// Brut Weight
|
||||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||||
print '<input name="weight" size="5" value="'.$object->weight.'"> ';
|
print '<input name="weight" size="5" value="'.$object->weight.'"> ';
|
||||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
|
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
||||||
// Brut Length
|
// Brut Length
|
||||||
@ -1867,6 +1887,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
|
|
||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) {
|
||||||
if (!empty($conf->accounting->enabled)) {
|
if (!empty($conf->accounting->enabled)) {
|
||||||
// Accountancy_code_sell
|
// Accountancy_code_sell
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||||
@ -1943,6 +1964,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<td><input name="accountancy_code_buy_export" class="maxwidth200" value="'.$object->accountancy_code_buy_export.'">';
|
print '<td><input name="accountancy_code_buy_export" class="maxwidth200" value="'.$object->accountancy_code_buy_export.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
@ -2170,9 +2192,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).'</td></tr>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).'</td></tr>';
|
||||||
|
|
||||||
// Public URL
|
// Public URL
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) {
|
||||||
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td>';
|
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td>';
|
||||||
print dol_print_url($object->url);
|
print dol_print_url($object->url);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Default warehouse
|
// Default warehouse
|
||||||
if ($object->isProduct() && !empty($conf->stock->enabled)) {
|
if ($object->isProduct() && !empty($conf->stock->enabled)) {
|
||||||
@ -2218,12 +2242,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
} else {
|
} else {
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_NATURE)) {
|
||||||
// Nature
|
// Nature
|
||||||
print '<tr><td class="titlefield">'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
print '<tr><td class="titlefield">'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
||||||
print $object->getLibFinished();
|
print $object->getLibFinished();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Brut Weight
|
// Brut Weight
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) {
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Weight").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Weight").'</td><td>';
|
||||||
if ($object->weight != '') {
|
if ($object->weight != '') {
|
||||||
print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units);
|
print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units);
|
||||||
@ -2231,6 +2258,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
||||||
// Brut Length
|
// Brut Length
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user