public function pre_save() { $this->pre_operation = $this->bean->operation; $this->pre_quantity = $this->bean->quantity; $this->pre_xinventory_id = $this->bean->xinventory_id; parent::pre_save(); }
public function pre_save() { require_once 'include/upload_file.php'; $upload_file = new UploadFile('filename_file'); if (isset($_FILES['filename_file']) && $upload_file->confirm_upload()) { $filename = $upload_file->get_stored_file_name(); $file_ext = $upload_file->file_ext; if (empty($this->bean->id)) { $this->bean->id = create_guid(); $this->bean->new_with_id = true; } $account = null; if (isset($_POST['xphotobucketaccount_id'])) { $account = BeanFactory::getBean('xPhotobucketAccounts', $_POST['xphotobucketaccount_id']); } // $resp = $account->upload_media('image', $upload_file->temp_file_location, "{$this->bean->id}.{$file_ext}", $_POST['name']); $resp = $account->upload_media('base64', base64_encode(file_get_contents($upload_file->temp_file_location)), "{$this->bean->id}.{$file_ext}", $_POST['name']); $this->bean->browse_url = $resp['browseurl']; $this->bean->image_url = $resp['url']; $this->bean->thumb_url = $resp['thumb']; } else { echo "Upload file error"; sugar_cleanup(true); } parent::pre_save(); }
public function testpre_save() { $SugarController = new SugarController(); $SugarController->setModule('Users'); $SugarController->loadBean(); //execute the method and check if it either works or throws an mysql exception. //Fail if it throws any other exception. try { $SugarController->pre_save(); } catch (Exception $e) { $this->assertStringStartsWith('mysqli_query()', $e->getMessage()); } $this->assertTrue(true); }
public function pre_save() { if (!empty($_REQUEST['session_id'])) { $x = new FetchToken(); $res = $x->dispatchCall(array('SessionID' => $_REQUEST['session_id'])); if ($res !== false) { $this->bean->ebay_auth_token = $res['AuthToken']; $this->bean->hard_expiration_time = $res['ExpireTime']; } else { sugar_cleanup(true); } } parent::pre_save(); }
public function pre_save() { parent::pre_save(); require_once 'modules/Workflows/includes/WorkflowBaseAction.php'; if (isset($this->bean->accion) && isset($this->record)) { $accion = WorkflowBaseAction::obtener_accion_por_nombre($this->bean->accion); try { $accion->verificar_parametros($this->bean->parametros); } catch (Exception $e) { sugar_set_message("No se encontraron los parametros: " . implode(', ', $accion->parametros_requeridos()) . "; para la acción: {$accion->nombre}. No se Guardaron los cambios", "error"); $args = array('module' => $this->module, 'action' => "EditView", 'record' => $this->record); $this->set_redirect(create_url($args)); $this->redirect(); die; } } }
public function pre_save() { parent::pre_save(); $this->api = ExternalAPIFactory::loadAPI($this->bean->application, true); if (empty($this->api)) { return $this->failed(translate('LBL_AUTH_UNSUPPORTED', $this->bean->module_dir)); } if (empty($this->bean->id)) { $eapmBean = EAPM::getLoginInfo($this->bean->application, true); if ($eapmBean) { SugarApplication::appendErrorMessage(translate('LBL_APPLICATION_FOUND_NOTICE', $this->bean->module_dir)); $this->bean->id = $eapmBean->id; } } $this->bean->validated = false; $this->bean->save_cleanup(); $this->api->loadEAPM($this->bean); }
public function pre_save() { $this->bean->set_access_token(); parent::pre_save(); }
public function pre_save() { $this->dieIfNotAdmin(); parent::pre_save(); }