Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Yes/No Form to Variations Module to globally set "VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT" variable - concerns Issue #26965 #27048

Closed
DaBootO opened this issue Dec 11, 2023 · 0 comments · Fixed by #27049
Labels
Feature request This is a feature request

Comments

@DaBootO
Copy link
Contributor

DaBootO commented Dec 11, 2023

Feature Request

In Issue #26965 the missing check for the Variable "VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT" was discussed and fixed in the PR #26967

Now I propose a change in the Variants module settings page to allow the user to set this global variable. This would also be the first and only way to set this variable via an option.

Use case

When a user activates the variations module and checks the possible options inside the module the user will be able to see that there is a possibility to allow the stock movements for the variant parent products as well.

Suggested implementation

Use the same syntax as with the "HideProductCombinations":

print '<tr class="oddeven"><td>'.$langs->trans('HideProductCombinations').'</td><td>';
print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD", getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD'), 1).'</td></tr>';

Generally add a form with a yes/no option to the options page

$form->selectyesno()

Together with a similar syntax as in the Lines 40-56 one could implement and set the variable globally:

if ($action) {
$value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD');
if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
$error++;
}
if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
$error++;
}
if (!$error) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
}
}

Suggested steps

  • add Option to variants/admin/admin.php via $form->selectyesno()
  • add translationkey for new option to langs/en_US
@DaBootO DaBootO added the Feature request This is a feature request label Dec 11, 2023
DaBootO added a commit to DaBootO/dolibarr that referenced this issue Dec 11, 2023
…VEMENT_ON_VARIANT_PARENT" variable

This commit adds another option to the variants module to set the global variable "VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT".
This variable allows the variant parent product to be used in stock movements.
eldy added a commit that referenced this issue Feb 12, 2024
…N_VARIANT_PARENT" variable (#27049)

This commit adds another option to the variants module to set the global variable "VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT".
This variable allows the variant parent product to be used in stock movements.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request This is a feature request
Projects
None yet
1 participant