Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ NEW: Add conf PDF_HIDE_LINKED_OBJECT_IN_PUBLIC_NOTE to hide linked object in pub
NEW: Add MULTICURRENCY_SHOW_ALSO_MAIN_CURRENCY_ON_PDF for legal requirement that need both currencies on PDF
NEW: Add note public and private on order export
NEW: Finish dev for API_ENABLE_COUNT_CALLS (count of API use is visible on user API key field)
NEW: Add option PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST to show product variants by default in the products list

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouter la date ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le ChangeLog Dolibarr ne date pas les lignes individuelles (regroupement par version). J'ai plutôt tagué l'entrée comme backport, conforme aux autres (backport ...) du fichier : ... (backport ATM #757, native in Dolibarr 24.0). Corrigé.


For developers:
---------------
Expand Down
3 changes: 3 additions & 0 deletions htdocs/langs/en_US/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ ProductCombinationAlreadyUsed=There was an error while deleting the variant. Ple
ProductCombinations=Variants
PropagateVariant=Propagate variants
HideProductCombinations=Hide products variant in the products selector
# BACKPORT ATM #757 - keys natives dès Dolibarr 24.0, à retirer après upgrade vers 24+
ShowProductCombinationsInList=Show product variants by default in the products list
ShowProductCombinationsInListHelp=When enabled, the "Show child products" checkbox of the products list is ticked by default, so product variants are visible without having to tick it manually. Users can still untick it to hide them.
ProductCombination=Variant
NewProductCombination=New variant
EditProductCombination=Editing variant
Expand Down
3 changes: 3 additions & 0 deletions htdocs/langs/es_ES/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ ProductCombinationAlreadyUsed=Ha ocurrido un error al eliminar la variante. Comp
ProductCombinations=Variantes
PropagateVariant=Propagar variantes
HideProductCombinations=Ocultar las variantes en el selector de productos
# BACKPORT ATM #757 - keys natives dès Dolibarr 24.0, à retirer après upgrade vers 24+
ShowProductCombinationsInList=Mostrar las variantes por defecto en la lista de productos
ShowProductCombinationsInListHelp=Cuando está activado, la casilla «Mostrar productos hijos» de la lista de productos está marcada por defecto, de modo que las variantes son visibles sin tener que marcarla manualmente. Los usuarios pueden desmarcarla para ocultarlas.
ProductCombination=Variante
NewProductCombination=Nueva variante
EditProductCombination=Editando variante
Expand Down
3 changes: 3 additions & 0 deletions htdocs/langs/fr_FR/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ ProductCombinationAlreadyUsed=Une erreur s'est produite lors de la suppression d
ProductCombinations=Variantes
PropagateVariant=Propager les variantes
HideProductCombinations=Cacher les variantes dans les listes de sélection des produits
# BACKPORT ATM #757 - keys natives dès Dolibarr 24.0, à retirer après upgrade vers 24+
ShowProductCombinationsInList=Afficher les variantes par défaut dans la liste des produits
ShowProductCombinationsInListHelp=Lorsque cette option est activée, la case « Afficher les produits enfants » de la liste des produits est cochée par défaut, afin que les variantes soient visibles sans avoir à la cocher manuellement. Les utilisateurs peuvent toujours la décocher pour les masquer.
ProductCombination=Variante
NewProductCombination=Nouvelle variante
EditProductCombination=Editer les variantes
Expand Down
24 changes: 19 additions & 5 deletions htdocs/product/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,22 @@
$search_units = GETPOST('search_units', 'int');
$type = GETPOST("type", 'alpha');

// >>> BACKPORT ATM #757 (PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST) - natif dès Dolibarr 24.0, à retirer après upgrade vers 24+
// Show/hide child product variants
// The default state is driven by the option PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST (0 = hidden, 1 = shown).
// An unchecked checkbox is not posted, so we rely on GETPOSTISSET and the search button to tell apart a
// fresh page load (apply default) from a form voluntarily submitted with the box unchecked (respect off).
$show_childproducts = 0;
if (isModEnabled('variants')) {
$show_childproducts = GETPOST('search_show_childproducts');
if (GETPOSTISSET('search_show_childproducts')) {
$show_childproducts = GETPOSTINT('search_show_childproducts');
} elseif (GETPOST('button_search', 'alpha') || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha')) {
$show_childproducts = 0; // form submitted with the box unchecked -> respect off
} else {
$show_childproducts = getDolGlobalInt('PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST'); // fresh page load -> default
}
}
// <<< BACKPORT ATM #757

$diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id;

Expand Down Expand Up @@ -400,7 +411,7 @@
$search_finished = '';
//$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.

$show_childproducts = '';
$show_childproducts = getDolGlobalInt('PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST'); // BACKPORT ATM #757 - natif dès Dolibarr 24.0 (défaut au lieu de '')
$search_import_key = '';
$search_stockable_product = '';
$search_accountancy_code_sell = '';
Expand Down Expand Up @@ -826,9 +837,12 @@
if ($fourn_id > 0) {
$param .= "&fourn_id=".urlencode((string) ($fourn_id));
}
if ($show_childproducts) {
$param .= ($show_childproducts ? "&search_show_childproducts=".urlencode($show_childproducts) : "");
// >>> BACKPORT ATM #757 - natif dès Dolibarr 24.0, à retirer après upgrade vers 24+
if (isModEnabled('variants')) {
// Always carry the state (0 or 1) so pagination and sorting preserve an explicit "off" even when the default is "on"
$param .= "&search_show_childproducts=".urlencode((string) ($show_childproducts ? 1 : 0));
}
// <<< BACKPORT ATM #757
if ($type != '') {
$param .= '&type='.urlencode((string) ($type));
}
Expand Down Expand Up @@ -984,7 +998,7 @@
// Show/hide child variant products
if (isModEnabled('variants')) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts" value="1"'.($show_childproducts ? ' checked="checked"' : '').'>'; // BACKPORT ATM #757 - value="1" natif dès Dolibarr 24.0 (sinon case cochée soumet "on" -> GETPOSTINT=0)
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';
$moreforfilter .= '</div>';
}
Expand Down
11 changes: 11 additions & 0 deletions htdocs/variants/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
$error++;
}

// BACKPORT ATM #757 - natif dès Dolibarr 24.0, à retirer après upgrade vers 24+
if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST', GETPOST('PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST'), 'chaine', 0, '', $conf->entity)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manque du second paramètre de getpost, mais on passe car backport

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouté : GETPOST('PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST', 'int') (la valeur vient d'un selectyesno -> 0/1).

setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
$error++;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport Start et End ou équivalent

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fait : bloc encadré par // >>> BACKPORT ATM #757 / // <<< BACKPORT ATM #757, comme le bloc d'affichage plus bas.

if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
$error++;
Expand Down Expand Up @@ -94,6 +100,11 @@
print '<tr class="oddeven"><td>'.$langs->trans('HideProductCombinations').'</td><td>';
print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD", getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD'), 1).'</td></tr>';

// >>> BACKPORT ATM #757 - natif dès Dolibarr 24.0, à retirer après upgrade vers 24+
print '<tr class="oddeven"><td>'.$form->textwithpicto($langs->trans('ShowProductCombinationsInList'), $langs->trans('ShowProductCombinationsInListHelp')).'</td><td>';
print $form->selectyesno("PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST", getDolGlobalString('PRODUIT_ATTRIBUTES_SHOWCHILD_IN_LIST'), 1).'</td></tr>';
Comment thread
atm-vincent-p marked this conversation as resolved.
// <<< BACKPORT ATM #757

print '<tr class="oddeven"><td>'.$langs->trans('CombinationsSeparator').'</td>';

$separator = getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR', '_');
Expand Down
Loading