/** * Edit function for saving simple document * @param xml object $data data to be updated * @return array */ public function edit($data) { //get data from fields when using epath to send data if (isset($data->fields)) { return parent::edit($data->fields); } else { return parent::edit($data); } }
/** * deleteSystemEmailIfNoMergeFields * @param XML $data tags * @return void */ public function deleteSystemEmailIfNoMergeFields($data) { $this->_documentClassName = 'MoveIn4Activity\\Document\\ActivitySystemEmailDocument'; if (count($data->mergeFields) == 0) { $data->deleted = true; unset($data->mergeFields); return parent::edit($data); } else { return ['status' => "done"]; } }
/** * save and edit system template document * @param unknown $data data * @return Ambigous <multitype:, multitype:Ambigous <boolean, \Base\Model\Service\Ambigous, multitype:, string, unknown, object> NULL > */ public function edit($data) { if (isset($data->id) && !empty($data->id) && isset($data->generatedOn)) { unset($data->recipient); } $result = parent::edit($data); $response = new \SimpleXMLIterator('<?xml version="1.0" encoding="UTF-8"?><template/>'); $response->addChild('id', (string) $result['id']); $response->addChild('fields', 'recipient'); $recipients = $this->getOne($response); $result['recipients'] = $recipients['fields']; return $result; }
/** * save and edit system template document * @param unknown $data data * @return Ambigous <multitype:, multitype:Ambigous <boolean, \Base\Model\Service\Ambigous, multitype:, string, unknown, object> NULL > */ public function edit($data) { if (isset($data->fields)) { $recipient = $data->fields->addChild('recipient'); $recipient->addChild('documentId', (string) $data->recipient->documentId); $recipient->addChild('person', (string) $data->recipient->person); $auth = $data->fields->addChild('auth'); foreach ((array) $data->auth as $index => $value) { $auth->addChild($index, $value); } return parent::edit($data->fields); } else { return parent::edit($data); } }