From 870395b69cce46967f4e015b9cfdb6245636050e Mon Sep 17 00:00:00 2001 From: DaBootO <71572790+DaBootO@users.noreply.github.com> Date: Mon, 12 Feb 2024 05:46:50 +0100 Subject: [PATCH] CLOSE #27048 add form to globally set "VARIANT_ALLOW_STOCK_MOVEMENT_ON_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 --- htdocs/langs/en_US/products.lang | 4 ++++ htdocs/variants/admin/admin.php | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index c3064e23f35dd..cec42e8ba8e58 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -433,4 +433,8 @@ ModifyValueExtrafields = Modify value of an extrafield OrProductsWithCategories=Or products with tags/categories WarningTransferBatchStockMouvToGlobal = If you want to deserialize this product, all its serialized stock will be transformed into global stock WarningConvertFromBatchToSerial=If you currently have a quantity higher or equal to 2 for the product, switching to this choice means you will still have a product with different objects of the same batch (while you want a unique serial number). The duplicate will remain until an inventory or a manual stock movement to fix this is done. + +AllowStockMovementVariantParent=Allow stock movements on the variant parent + ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?
The quantities currently set in the inventory will be reset. + diff --git a/htdocs/variants/admin/admin.php b/htdocs/variants/admin/admin.php index 0d96d52822b27..ca2ac29d0847f 100644 --- a/htdocs/variants/admin/admin.php +++ b/htdocs/variants/admin/admin.php @@ -50,6 +50,11 @@ $error++; } + if (!dolibarr_set_const($db, 'VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT', GETPOST('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT'), 'chaine', 0, '', $conf->entity)) { + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); + $error++; + } + if (!$error) { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } @@ -83,6 +88,9 @@ } print ''; +print ''.$langs->trans('AllowStockMovementVariantParent').''; +print $form->selectyesno("VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT", getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT'), 1).''; + print ''; print '
';