Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When only one plugin is available and "Allow quick checkout" is enabled, the following error occurs: The job has no provider assigned.
Steps to reproduce:
- Install Drupal 8.0.5 standard profile, tmgmt, tmgmt_microsoft
- Enable "Allow quick checkout" on admin/tmgmt/settings
- Configure Microsoft plugin (make sure there is only ONE plugin available)
- Add some languages
- Make article translatable
- Click translate tab
- Choose a language and click "Request translation"
- Error occurs: Drupal\tmgmt\TMGMTException: The job has no provider assigned. in Drupal\tmgmt\Entity\Job->getTranslator() (line 482 of /modules/tmgmt/src/Entity/Job.php).
Comment | File | Size | Author |
---|---|---|---|
#19 | tmgmt-2690201-19.patch | 744 bytes | thalles |
| |||
#17 | Screenshot from 2020-10-29 10-00-28.png | 111.31 KB | thalles |
#5 | the_job_has_no_provider-2690201-5.patch | 428 bytes | mbovan |
|
Comments
Comment #2
miro_dietikerIs this really that minor? ;-)
Comment #3
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedGood point, it is a fatal error so normally I'd go for critical as it breaks functionality. But you can easily circumvent it by disabling "Allow quick checkout" or by adding a second provider so it's not blocking.
How about "Normal"?
Comment #4
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedComment #5
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedDebugged this, I can confirm that problem appears with Microsoft translator.
Providing a quick fix/patch here. It looks like this is a problem since we started to implement Continuous support for translators.
In case quick checkout setting is active, we are trying to find a translator with no-checkout-settings support and assigning it to a job. At that point, job isn't saved with a newly assigned translator. In order to not repeat code, we moved all the logic for requesting translation into
MicrosoftTranslator::requestJobItemsTranslation()
in #2680203: Implement ContinuousTranslatorInterface. AsJob
object fromMicrosoftTranslator::requestTranslation()
is not passed further torequestJobItemsTranslation()
method, there we have to get/load a newJob
instance which of course doesn't contain attached translator.We can change
ContinuousTranslatorInterface
API too, and addJob
as a second parameter ofrequestJobItemsTranslation()
, but one moresave()
looks like a less-breakable solution.I didn't manage to do this with test_translator, so maybe we can test this in tmgmt_microsoft module?
Comment #6
AmeXio CreditAttribution: AmeXio commentedThe patch prevents the error from occurring.
Comment #7
miro_dietikerThe quick checkout offering is a core offering and needs test coverage in tmgmt core.
Sure it is possible that the test translator needs improvement to cover the case. We possibly need multiple test translators with varying support.
Comment #8
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedNot sure yet why but the patch in #5 no longer works for 8.x-1.4.
Comment #9
BerdirThat's because the whole function is now deprecated and no longer used, there is a new one instead.
I might have seen a related problem caused by this, should have test coverage.
Comment #10
mpp CreditAttribution: mpp as a volunteer and at AmeXio commented@Berdir, see #2942209 for steps to reproduce. You'll need 2 providers as it only occurs when changing the provider during checkout.
Comment #11
thallesHello everyone!
This problem has already occurred in a project I'm working on.
I noticed that they occur in Drupal Lightning, so it seems to me to be an incompatibility between TMGMT and some module of Drupal Lightning.
Comment #12
BerdirIf it's the same problem then you need to reroll the patch above, as mentioned, that function has been deprecated, the new code is in a new place in a service.
Comment #13
thallesI add the line
$job->save();
in Drupal\tmgmt\JobCheckoutManager::needsCheckoutForm, but this don't works to meComment #14
thallesIn my case, entering this if:
in Drupal\tmgmt\JobCheckoutManager::needsCheckoutForm
if I comment this "if" works
Comment #15
Berdircomment what exactly? and how many translators do you have?
Comment #16
Berdirand what kind of translator.
Comment #17
thallesI have three translators
When I comment on the pointed "if"
Comment #18
thallesas a matter of fact looks that some data at form don't are being saved(translator).
Comment #19
thallesFollow a patch that looks solve this issue
Comment #20
BerdirI don't understand the fix. This will interfere with certain features that we have, like allowing translators to control how things are saved. I've never seen a problem like this, so will need more details. What translators are you using, what exactly is the problem?
Comment #21
thallesThe translator is: https://globallink.translations.com/
The site use also Acquia site studio(Cohesion)