function execute($verbose = false) { global $Conf, $Now, $Opt; if (count($this->errors_) || !count($this->assigners)) { if ($verbose && count($this->errors_)) { $this->report_errors(); } else { if ($verbose) { $Conf->warnMsg("Nothing to assign."); } } return count($this->errors_) == 0; // true means no errors } // mark activity now to avoid DB errors later $this->contact->mark_activity(); // create new contacts outside the lock $locks = array("ContactInfo" => "read", "Paper" => "read", "PaperConflict" => "read"); $Conf->save_logs(true); foreach ($this->assigners as $assigner) { if ($assigner->contact && $assigner->contact->contactId < 0) { $assigner->contact = $this->cmap->register_contact($assigner->contact); $assigner->cid = $assigner->contact->contactId; } $assigner->add_locks($locks); } // execute assignments $tables = array(); foreach ($locks as $t => $type) { $tables[] = "{$t} {$type}"; } Dbl::qe("lock tables " . join(", ", $tables)); foreach ($this->assigners as $assigner) { $assigner->execute($this); } Dbl::qe("unlock tables"); $Conf->save_logs(false); // confirmation message if ($verbose) { if ($Conf->setting("pcrev_assigntime") == $Now) { $Conf->confirmMsg("Assignments saved! You may want to <a href=\"" . hoturl("mail", "template=newpcrev") . "\">send mail about the new assignments</a>."); } else { $Conf->confirmMsg("Assignments saved!"); } } // clean up $Conf->update_rev_tokens_setting(false); $Conf->update_paperlead_setting(); $pids = array(); foreach ($this->assigners as $assigner) { $assigner->cleanup($this); if ($assigner->pid > 0 && $assigner->notify_tracker()) { $pids[$assigner->pid] = true; } } if (count($pids) && opt("trackerCometSite")) { MeetingTracker::contact_tracker_comet(array_keys($pids)); } return true; }