function gw_set_incoming_action() { $kodeord = 'BBB'; require_once 'SmsService.php'; $options = array(); $options['soap_version'] = SOAP_1_1; $options['location'] = $this->sms_param['service_url']; $options['uri'] = "http://soa01a.srv.bergenkom.no/biz/bk/sms/SmsService-v1"; $options['trace'] = 1; $options['proxy_host'] = $this->sms_param['proxy_host']; $options['proxy_port'] = $this->sms_param['proxy_port']; $options['encoding'] = 'iso-8859-1'; //'UTF-8'; $options['login'] = $this->sms_param['login']; $options['password'] = $this->sms_param['password']; $service = new SmsService($this->sms_param['wsdl'], $options); $UserContext = new UserContext(); $UserContext->userid = $GLOBALS['phpgw_info']['user']['account_lid']; $UserContext->appid = 'Portico'; $getNyeInnkommendeMeldinger = new getNyeInnkommendeMeldinger(); $getNyeInnkommendeMeldinger->userContext = $UserContext; $getNyeInnkommendeMeldinger->kodeord = $kodeord; $ReturnValue = $service->getNyeInnkommendeMeldinger($getNyeInnkommendeMeldinger); $response = array(); if (isset($ReturnValue->return)) { $_response = $ReturnValue->return; if (is_array($_response)) { $response = $_response; } else { $response[] = $_response; } } $datetime_format = phpgwapi_db::datetime_format(); foreach ($response as $entry) { $sms_datetime = date($datetime_format, time()); // should not be calculated $message = trim(ltrim($entry->tekst, $entry->kodeord)); $array_target_code = explode(' ', $message); $target_code = strtoupper(trim($array_target_code[0])); $message = $array_target_code[1]; for ($i = 2; $i < count($array_target_code); $i++) { $message .= " {$array_target_code[$i]}"; } $this->setsmsincomingaction($sms_datetime, $entry->tlfavsender, $target_code, $message); } return $ReturnValue; }
public function __construct($session = false) { $this->acl_location = '.demo_location'; $this->currentapp = $GLOBALS['phpgw_info']['flags']['currentapp']; $this->so = CreateObject('demo.sodemo', $this->acl_location); $this->custom = createObject('phpgwapi.custom_fields'); if ($session) { $this->read_sessiondata(); $this->use_session = true; } $this->start = phpgw::get_var('start', 'int', 'REQUEST', 0); $this->query = phpgw::get_var('query'); $this->sort = phpgw::get_var('sort'); $this->order = phpgw::get_var('order'); $this->filter = phpgw::get_var('filter'); $this->cat_id = phpgw::get_var('cat_id', 'int'); $this->allrows = phpgw::get_var('allrows', 'bool'); $this->dateformat = phpgwapi_db::date_format(); $this->datetimeformat = phpgwapi_db::datetime_format(); }
/** * Constructor * * @param string $appname the name of the module using the custom fields * * @return void */ public function __construct($appname = null) { $this->_appname = $appname; if (is_null($this->_appname)) { $this->_appname =& $GLOBALS['phpgw_info']['flags']['currentapp']; } $this->_db =& $GLOBALS['phpgw']->db; $this->_join =& $this->_db->join; $this->_like =& $this->_db->like; $this->_dateformat = phpgwapi_db::date_format(); $this->_datetimeformat = phpgwapi_db::datetime_format(); $this->_db->Halt_On_Error = 'yes'; $this->datatype_text = array('V' => lang('Varchar'), 'I' => lang('Integer'), 'C' => lang('char'), 'N' => lang('Float'), 'D' => lang('Date'), 'DT' => lang('Datetime'), 'T' => lang('Memo'), 'R' => lang('Muliple radio'), 'CH' => lang('Muliple checkbox'), 'LB' => lang('Listbox'), 'AB' => lang('Contact'), 'ABO' => lang('Organisation'), 'VENDOR' => lang('Vendor'), 'email' => lang('Email'), 'link' => lang('Link'), 'pwd' => lang('password'), 'user' => 'phpgw_user', 'event' => lang('event'), 'bolean' => 'Bolean', 'custom1' => lang('Custom listbox'), 'custom2' => lang('Custom lookup'), 'custom3' => lang('Custom autocomplete::integer')); $this->_oProc = createObject('phpgwapi.schema_proc', $GLOBALS['phpgw_info']['server']['db_type']); $this->_oProc->m_odb =& $this->_db; }
function edit($values, $values_attribute, $entity_id, $cat_id) { $receipt = array(); $value_set = array(); $table = "fm_{$this->type}_{$entity_id}_{$cat_id}"; if (isset($values['street_name']) && $values['street_name']) { $address[] = $values['street_name']; $address[] = $values['street_number']; $value_set['address'] = $this->db->db_addslashes(implode(" ", $address)); } if (!isset($address) || !$address) { $address = isset($values['location_name']) ? $this->db->db_addslashes($values['location_name']) : ''; if ($address) { $value_set['address'] = $address; } } if (isset($values['location_code']) && $values['location_code']) { $value_set['location_code'] = $values['location_code']; } $admin_location = CreateObject('property.soadmin_location'); $admin_location->read(false); // Delete old values for location - in case of moving up in the hierarchy $metadata = $this->db->metadata($table); for ($i = 1; $i < $admin_location->total_records + 1; $i++) { if (isset($metadata["loc{$i}"])) { $value_set["loc{$i}"] = false; } } if (isset($values['location']) && is_array($values['location'])) { foreach ($values['location'] as $column => $value) { $value_set[$column] = $value; } } if (isset($values['extra']) && is_array($values['extra'])) { foreach ($values['extra'] as $column => $value) { $value_set[$column] = $value; } } $admin_entity = CreateObject('property.soadmin_entity'); $admin_entity->type = $this->type; $category = $admin_entity->read_single_category($entity_id, $cat_id); $location_id = $GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], ".{$this->type}.{$entity_id}.{$cat_id}"); if (isset($values_attribute) && is_array($values_attribute)) { foreach ($values_attribute as $entry) { if ($entry['datatype'] != 'AB' && $entry['datatype'] != 'VENDOR' && $entry['datatype'] != 'user' && $entry['datatype'] != 'event') { if ($entry['datatype'] == 'C' || $entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] == 'link') { $entry['value'] = $this->db->db_addslashes($entry['value']); } if ($entry['datatype'] == 'pwd' && $entry['value'] && $entry['value2']) { if ($entry['value'] || $entry['value2']) { if ($entry['value'] == $entry['value2']) { $value_set[$entry['name']] = md5($entry['value']); } else { $receipt['error'][] = array('msg' => lang('Passwords do not match!')); } } } else { $value_set[$entry['name']] = isset($entry['value']) ? $entry['value'] : ''; } } if ($entry['history'] == 1) { if (!$category['is_eav']) { $this->db->query("SELECT {$entry['name']} FROM {$table} WHERE id = '{$values['id']}'", __LINE__, __FILE__); $this->db->next_record(); $old_value = $this->db->f($entry['name'], true); } else { $sql = "SELECT * FROM fm_bim_item WHERE fm_bim_item.id = {$values['id']} AND location_id = {$location_id}"; $this->db->query($sql, __LINE__, __FILE__); $this->db->next_record(); $xmldata = $this->db->f('xml_representation'); $xml = new DOMDocument('1.0', 'utf-8'); $xml->loadXML($xmldata); $old_value = $xml->getElementsByTagName($entry['name'])->item(0)->nodeValue; } if ($entry['datatype'] == 'D') { $old_value = $old_value ? date(phpgwapi_db::date_format(), strtotime($old_value)) : ''; } if ($entry['value'] != $old_value) { $history_set[$entry['attrib_id']] = array('value' => $entry['value'], 'old_value' => $old_value, 'date' => $this->bocommon->date_to_timestamp($entry['date'])); } } } } $this->db->transaction_begin(); if (isset($value_set['p_num']) && $value_set['p_num']) { // $p_category = $admin_entity->read_single_category($value_set['p_entity_id'], $value_set['p_cat_id']); // $p_id = (int) ltrim($value_set['p_num'], $p_category['prefix']); $p_id = $value_set['p_num']; $p_location_id = $GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], ".{$this->type}.{$value_set['p_entity_id']}.{$value_set['p_cat_id']}"); } if ($category['is_eav']) { if (isset($value_set['p_num']) && $value_set['p_num']) { $value_set['p_id'] = $p_id; $value_set['p_location_id'] = $p_location_id; } if ($category['entity_group_id'] != $values['entity_group_id']) { $value_set['entity_group_id'] = $values['entity_group_id']; } $this->_edit_eav($value_set, $location_id, ".{$this->type}.{$entity_id}.{$cat_id}", $values['id']); } else { if (isset($value_set['p_num']) && $value_set['p_num']) { $value_set['p_num'] = $p_id; } $value_set['modified_by'] = $this->account; $value_set['modified_on'] = time(); $value_set = $this->db->validate_update($value_set); $this->db->query("UPDATE {$table} set {$value_set} WHERE id=" . $values['id'], __LINE__, __FILE__); } if (isset($history_set) && is_array($history_set)) { $historylog = CreateObject('property.historylog', "{$this->type}_{$entity_id}_{$cat_id}"); foreach ($history_set as $attrib_id => $history) { $historylog->add('SO', $values['id'], $history['value'], $history['old_value'], $attrib_id, $history['date']); } } $this->db->transaction_commit(); $receipt['id'] = $values['id']; $receipt['message'][] = array('msg' => lang('entity %1 has been edited', $values['num'])); return $receipt; }