public function process(&$global_success) { $global_success = true; $this->fetchData(); foreach ($this->settings as $field => &$setting) { $success = false; if (!is_null($setting)) { $this->values[$field] = $setting->value($this, $field, Post::v($field, ''), $success); } else { $success = true; $this->values[$field] = Post::v($field, ''); } $this->errors[$field] = !$success; $global_success = $global_success && $success; } if ($global_success) { if ($this->checkChanges()) { /* Save changes atomically to avoid inconsistent state * in case of error. */ if (!XDB::runTransaction(array($this, 'saveData'))) { $global_success = false; return PlWizard::CURRENT_PAGE; } $this->markChange(); } // XXX: removes this code once all merge related issues have been fixed. static $issues = array(0 => array('name', 'promo', 'phone', 'education'), 1 => array('address'), 2 => array('job')); if (isset($issues[Post::i('valid_page')])) { foreach ($issues[Post::i('valid_page')] as $issue) { XDB::execute("UPDATE profile_merge_issues\n SET issues = REPLACE(issues, {?}, '')\n WHERE pid = {?}", $issue, $this->pid()); } } return Post::has('next_page') ? PlWizard::NEXT_PAGE : PlWizard::CURRENT_PAGE; } $text = "Certains champs n'ont pas pu être validés, merci de corriger les informations " . (S::user()->isMe($this->owner) ? "de ton profil et de revalider ta demande." : "du profil et de revalider ta demande."); Platal::page()->trigError($text); return PlWizard::CURRENT_PAGE; }