Ok, thanks for that. I’ll took a look, but it seems there it’s just importing the file without assigning any managers to the submission, right?
I noticed that when a user submitted via Fidus Writer, the submission would not automatically get an editor assigned, whereas a traditional submission would. I guess the difference lies in this:
// Manager and assistant roles -- for each assigned to this
// stage in setup, iff there is only one user for the group,
// automatically assign the user to the stage.
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
$submissionStageGroups = $userGroupDao->getUserGroupsByStage($this->submission->getContextId(), WORKFLOW_STAGE_ID_SUBMISSION);
$managerFound = false;
while ($userGroup = $submissionStageGroups->next()) {
// Only handle manager and assistant roles
if (!in_array($userGroup->getRoleId(), array(ROLE_ID_MANAGER, ROLE_ID_ASSISTANT))) continue;
$users = $userGroupDao->getUsersById($userGroup->getId(), $this->submission->getContextId());
if($users->getCount() == 1) {
$user = $users->next();
$stageAssignmentDao->build($this->submission->getId(), $userGroup->getId(), $user->getId(), $userGroup->getRecommendOnly());
if ($userGroup->getRoleId() == ROLE_ID_MANAGER) $managerFound = true;
}
}
And then I started looking more at that and it seemed like there are more assignments happening there (sub editors) and after that, in SubmissionSubmitStep4Form, there are notifications about the submission being sent (Notifications = emails to author and various editors, managers, etc., right?).
Coming from the Python/JavaScript world, I am just surprised that there isn’t a function defined somewhere that basically is used to “add submission with the following attributes to the database + add default user rights and send all relevant notifications”. It just feels like I copy a lot of code that I would assume would be be available in just one function to ensure that everyone executes it in the same way.
Btw, while I’m at it, as part of the code I need to copy, I see that the notificationmanager related calls and some others need the request as an argument. I am trying to understand what it needs the request for, because in our case it won’t come from the browser and so it won’t hold specific post variables or login tokens/cookies or whatever it may expect browsers to send in their requests at step 4.