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

Default selection of packages does not work anymore #4229

Open
AdrienSICKLO opened this issue Apr 30, 2024 · 1 comment
Open

Default selection of packages does not work anymore #4229

AdrienSICKLO opened this issue Apr 30, 2024 · 1 comment

Comments

@AdrienSICKLO
Copy link

Some time ago, it had been done a super useful small thing which was that when only one package was created in a package set, it was selected by default in the form when creating a delivery.

This doesn't work anymore (it's been not working for a while now). I stopped saving multiple times 2 clicks a day!

image

@Atala
Copy link
Member

Atala commented May 2, 2024

PHP code

$form->add('packages', CollectionType::class, [
'entry_type' => PackageWithQuantityType::class,
'entry_options' => [
'label' => false,
'package_set' => $options['with_package_set'],
],
'label' => 'form.delivery.packages.label',
'mapped' => false,
'allow_add' => true,
'allow_delete' => true,
'attr' => [
'data-packages-required' => var_export($options['with_packages_required'], true),
],
'prototype_name' => '__package__'
]);
$form->get('packages')->setData($data);
}

should be doable to automatically select package around here

function createPackageForm(name, $list, cb) {

in createPackagesWidget or createPackageForm but code is knd of hairy so it has to be well thought

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants