/** * Read Metadata from xml array * * @param array $xmlArr * @return void */ protected function readMetadata(&$xmlArr) { parent::readMetaData($xmlArr); $this->m_Name = $this->prefixPackage($this->m_Name); $this->m_Title = isset($xmlArr["EASYVIEW"]["ATTRIBUTES"]["TITLE"]) ? $xmlArr["EASYVIEW"]["ATTRIBUTES"]["TITLE"] : null; $this->m_Keywords = isset($xmlArr["EASYVIEW"]["ATTRIBUTES"]["KEYWORDS"]) ? $xmlArr["EASYVIEW"]["ATTRIBUTES"]["KEYWORDS"] : null; $this->m_TemplateEngine = isset($xmlArr["EASYVIEW"]["ATTRIBUTES"]["TEMPLATEENGINE"]) ? $xmlArr["EASYVIEW"]["ATTRIBUTES"]["TEMPLATEENGINE"] : null; $this->m_TemplateFile = isset($xmlArr["EASYVIEW"]["ATTRIBUTES"]["TEMPLATEFILE"]) ? $xmlArr["EASYVIEW"]["ATTRIBUTES"]["TEMPLATEFILE"] : null; $this->m_ViewSet = isset($xmlArr["EASYVIEW"]["ATTRIBUTES"]["VIEWSET"]) ? $xmlArr["EASYVIEW"]["ATTRIBUTES"]["VIEWSET"] : null; $this->m_Tab = isset($xmlArr["EASYVIEW"]["ATTRIBUTES"]["TAB"]) ? $xmlArr["EASYVIEW"]["ATTRIBUTES"]["TAB"] : null; $this->m_FormRefs = new MetaIterator($xmlArr["EASYVIEW"]["FORMREFERENCES"]["REFERENCE"], "FormReference", $this); if ($xmlArr["EASYVIEW"]["FORMREFERENCELIBS"]) { $this->m_FormRefLibs = new MetaIterator($xmlArr["EASYVIEW"]["FORMREFERENCELIBS"]["REFERENCE"], "FormReference", $this); } $this->m_MessageFile = isset($xmlArr["EASYVIEW"]["ATTRIBUTES"]["MESSAGEFILE"]) ? $xmlArr["EASYVIEW"]["ATTRIBUTES"]["MESSAGEFILE"] : null; $this->m_Messages = Resource::loadMessage($this->m_MessageFile); $this->m_CacheLifeTime = isset($xmlArr["EASYVIEW"]["ATTRIBUTES"]["CACHELIFETIME"]) ? $xmlArr["EASYVIEW"]["ATTRIBUTES"]["CACHELIFETIME"] : "0"; $this->readTile($xmlArr); // TODO: is this needed as title supports expression? if (empty($this->m_Title)) { $this->m_Title = $this->m_Description; } $this->translate(); // translate for multi-language support }
protected function readMetaData($xmlArr) { parent::readMetadata($xmlArr); $this->m_Tempaltes = $this->readTemplates($xmlArr["PLUGINSERVICE"]["TEMPLATE"]); $this->m_EmailDataObj = isset($xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["BIZDATAOBJ"]) ? $xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["BIZDATAOBJ"] : "email.do.EmailQueueDO"; $this->m_SendtoQueue = isset($xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["SENDTOQUEUE"]) ? $xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["SENDTOQUEUE"] : "Y"; }
protected function readMetaData($xmlArr) { parent::readMetaData($xmlArr); $this->m_Name = $this->prefixPackage($this->m_Name); $this->m_Title = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TITLE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TITLE"] : null; $this->m_Description = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["DESCRIPTION"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["DESCRIPTION"] : null; $this->m_CssClass = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["CSSCLASS"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["CSSCLASS"] : null; $this->m_TemplateEngine = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TEMPLATEENGINE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TEMPLATEENGINE"] : null; $this->m_TemplateFile = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TEMPLATEFILE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TEMPLATEFILE"] : null; $this->m_StartMenuItem = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["STARTMENUITEM"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["STARTMENUITEM"] : null; $this->m_StartMenuID = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["STARTMENUID"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["STARTMENUID"] : null; $this->m_SearchRule = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["SEARCHRULE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["SEARCHRULE"] : null; $this->m_GlobalSearchRule = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["GLOBALSEARCHRULE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["GLOBALSEARCHRULE"] : null; $this->m_MenuDeep = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["MENUDEEP"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["MENUDEEP"] : null; $this->m_DataObjName = $this->prefixPackage($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["BIZDATAOBJ"]); $this->m_CacheLifeTime = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["CACHELIFETIME"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["CACHELIFETIME"] : "0"; $this->translate(); // read dataService metadata. if not a full url, add default global DATA_SERVICE_HOST as prefix $this->m_DataService = $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["DATASERVICE"]; $this->m_QueryString = $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["QUERYSTRING"]; $urlParts = parse_url($this->m_DataService); if (!$urlParts['host']) { $this->m_DataService = DEFAULT_DATASERVICE_PROVIDER . $this->m_DataService; } }
/** * Read array meta data, and store to meta object * * @param array $xmlArr * @return void */ protected function readMetadata(&$xmlArr) { parent::readMetaData($xmlArr); $this->m_targetReportPath = isset($xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["TARGETREPORTPATH"]) ? $xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["TARGETREPORTPATH"] : null; $this->m_rptTemplate = isset($xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["REPORTTEMPLATE"]) ? $xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["REPORTTEMPLATE"] : null; $this->m_birtViewer = isset($xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["BIRTVIEWER"]) ? $xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["BIRTVIEWER"] : null; }
protected function readMetaData($xmlArr) { parent::readMetaData($xmlArr); $this->m_Name = $this->prefixPackage($this->m_Name); $this->m_CacheLifeTime = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["CACHELIFETIME"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["CACHELIFETIME"] : "0"; $this->m_RootMenuItem = $xmlArr["BIZDATAOBJ"]["MENUITEM"]; $this->fetchEntireTree(); }
function save () { parent::save(); if (empty($this->info) || !is_array($this->info)) return true; foreach ((array)$this->info as $name => $value) { $Meta = new MetaObject(array( 'parent' => $this->id, 'context' => 'customer', 'type' => 'meta', 'name' => $name )); $Meta->parent = $this->id; $Meta->context = 'customer'; $Meta->type = 'meta'; $Meta->name = $name; $Meta->value = $value; $Meta->save(); } }
/** * Read array meta data, and store to meta object * * @param array $xmlArr * @return void */ protected function readMetadata(&$xmlArr) { parent::readMetaData($xmlArr); $this->m_DataObjName = $xmlArr["PLUGINSERVICE"]["ATTRIBUTES"]["DATAOBJECTNAME"]; $this->m_DataObjName = $this->prefixPackage($this->m_DataObjName); $this->readMetaCollection($xmlArr["PLUGINSERVICE"]["DOTRIGGER"], $tmpList); if (!$tmpList) { return; } foreach ($tmpList as $triggerXml) { $this->m_DOTriggerList[] = new DOTrigger($triggerXml); } }
protected function readMetadata(&$xmlArr) { parent::readMetaData($xmlArr); $this->m_Name = $this->prefixPackage($this->m_Name); $this->m_Title = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TITLE"]) ? I18n::getInstance()->translate($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TITLE"]) : null; $this->m_Description = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["DESCRIPTION"]) ? I18n::getInstance()->translate($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["DESCRIPTION"]) : null; $this->m_CssClass = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["CSSCLASS"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["CSSCLASS"] : null; $this->m_TemplateEngine = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TEMPLATEENGINE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TEMPLATEENGINE"] : null; $this->m_TemplateFile = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TEMPLATEFILE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["TEMPLATEFILE"] : null; $this->m_StartMenuItem = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["STARTMENUITEM"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["STARTMENUITEM"] : null; $this->m_StartMenuID = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["STARTMENUID"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["STARTMENUID"] : null; $this->m_SearchRule = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["SEARCHRULE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["SEARCHRULE"] : null; $this->m_GlobalSearchRule = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["GLOBALSEARCHRULE"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["GLOBALSEARCHRULE"] : null; $this->m_MenuDeep = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["MENUDEEP"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["MENUDEEP"] : null; $this->m_DataObjName = $this->prefixPackage($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["BIZDATAOBJ"]); $this->m_CacheLifeTime = isset($xmlArr["MENUWIDGET"]["ATTRIBUTES"]["CACHELIFETIME"]) ? $xmlArr["MENUWIDGET"]["ATTRIBUTES"]["CACHELIFETIME"] : "0"; }
/** * Get the property of the object. Used in expression language * * @param string $propertyName name of the property * @return BizField|string property value */ public function getProperty($propertyName) { $ret = parent::getProperty($propertyName); if ($ret) { return $ret; } if ($propertyName == "Table") { return $this->m_Table; } if ($propertyName == "SearchRule") { return $this->m_SearchRule; } // get control object if propertyName is "Field[fldname]" $pos1 = strpos($propertyName, "["); $pos2 = strpos($propertyName, "]"); if ($pos1 > 0 && $pos2 > $pos1) { $propType = substr($propertyName, 0, $pos1); $fieldName = substr($propertyName, $pos1 + 1, $pos2 - $pos1 - 1); if ($propType == "param") { // get parameter return $this->m_Parameters->get($fieldName); } return $this->getField($fieldName); } }
function load () { $db = &DB::get(); $args = func_get_args(); if (empty($args[0])) return false; if (!is_array($args[0])) return false; $where = ""; foreach ($args[0] as $key => $id) $where .= ($where == ""?"":" AND ")."$key='".$db->escape($id)."'"; $r = $db->query("SELECT * FROM $this->_table WHERE $where",AS_ARRAY); foreach ($r as $row) { $meta = new MetaObject(); $meta->populate($row,'',array()); $this->meta[$meta->id] = $meta; $this->named[$meta->name] =& $this->meta[$meta->id]; } if (isset($row) && count($row) == 0) $this->_loaded = false; $this->_loaded = true; return $this->_loaded; }
/** * Interface processor for the customer list screen * * Handles processing customer list actions and displaying the * customer list screen * * @return void **/ function customers () { global $Ecart,$Customers,$wpdb; $db = DB::get(); $defaults = array( 'page' => false, 'deleting' => false, 'selected' => false, 'update' => false, 'newstatus' => false, 'pagenum' => 1, 'per_page' => false, 'start' => '', 'end' => '', 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '', ); $args = array_merge($defaults,$_GET); extract($args, EXTR_SKIP); if ($page == $this->Admin->pagename('customers') && !empty($deleting) && !empty($selected) && is_array($selected) && current_user_can('ecart_delete_customers')) { foreach($selected as $deletion) { $Customer = new Customer($deletion); $Billing = new Billing($Customer->id,'customer'); $Billing->delete(); $Shipping = new Shipping($Customer->id,'customer'); $Shipping->delete(); $Customer->delete(); } } if (!empty($_POST['save'])) { check_admin_referer('ecart-save-customer'); if ($_POST['id'] != "new") { $Customer = new Customer($_POST['id']); $Billing = new Billing($Customer->id,'customer'); $Shipping = new Shipping($Customer->id,'customer'); } else $Customer = new Customer(); $Customer->updates($_POST); if (!empty($_POST['new-password']) && !empty($_POST['confirm-password']) && $_POST['new-password'] == $_POST['confirm-password']) { $Customer->password = wp_hash_password($_POST['new-password']); if (!empty($Customer->wpuser)) wp_set_password($_POST['new-password'], $Customer->wpuser); } $Customer->info = false; // No longer used from DB $Customer->save(); foreach ($_POST['info'] as $id => $info) { $Meta = new MetaObject($id); $Meta->value = $info; $Meta->save(); } if (isset($Customer->id)) $Billing->customer = $Customer->id; $Billing->updates($_POST['billing']); $Billing->save(); if (isset($Customer->id)) $Shipping->customer = $Customer->id; $Shipping->updates($_POST['shipping']); $Shipping->save(); } $pagenum = absint( $pagenum ); if ( empty($pagenum) ) $pagenum = 1; if( !$per_page || $per_page < 0 ) $per_page = 20; $index = ($per_page * ($pagenum-1)); if (!empty($start)) { $startdate = $start; list($month,$day,$year) = explode("/",$startdate); $starts = mktime(0,0,0,$month,$day,$year); } if (!empty($end)) { $enddate = $end; list($month,$day,$year) = explode("/",$enddate); $ends = mktime(23,59,59,$month,$day,$year); } $customer_table = DatabaseObject::tablename(Customer::$table); $billing_table = DatabaseObject::tablename(Billing::$table); $purchase_table = DatabaseObject::tablename(Purchase::$table); $users_table = $wpdb->users; $where = ''; if (!empty($s)) { $s = stripslashes($s); if (preg_match_all('/(\w+?)\:(?="(.+?)"|(.+?)\b)/',$s,$props,PREG_SET_ORDER)) { foreach ($props as $search) { $keyword = !empty($search[2])?$search[2]:$search[3]; switch(strtolower($search[1])) { case "company": $where .= ((empty($where))?"WHERE ":" AND ")."c.company LIKE '%$keyword%'"; break; case "login": $where .= ((empty($where))?"WHERE ":" AND ")."u.user_login LIKE '%$keyword%'"; break; case "address": $where .= ((empty($where))?"WHERE ":" AND ")."(b.address LIKE '%$keyword%' OR b.xaddress='%$keyword%')"; break; case "city": $where .= ((empty($where))?"WHERE ":" AND ")."b.city LIKE '%$keyword%'"; break; case "province": case "state": $where .= ((empty($where))?"WHERE ":" AND ")."b.state='$keyword'"; break; case "zip": case "zipcode": case "postcode": $where .= ((empty($where))?"WHERE ":" AND ")."b.postcode='$keyword'"; break; case "country": $where .= ((empty($where))?"WHERE ":" AND ")."b.country='$keyword'"; break; } } } elseif (strpos($s,'@') !== false) { $where .= ((empty($where))?"WHERE ":" AND ")."c.email='$s'"; } else $where .= ((empty($where))?"WHERE ":" AND ")." (c.id='$s' OR CONCAT(c.firstname,' ',c.lastname) LIKE '%$s%' OR c.company LIKE '%$s%')"; } if (!empty($starts) && !empty($ends)) $where .= ((empty($where))?"WHERE ":" AND ").' (UNIX_TIMESTAMP(c.created) >= '.$starts.' AND UNIX_TIMESTAMP(c.created) <= '.$ends.')'; $customercount = $db->query("SELECT count(*) as total FROM $customer_table AS c $where"); $query = "SELECT c.*,b.city,b.state,b.country, u.user_login, SUM(p.total) AS total,count(distinct p.id) AS orders FROM $customer_table AS c LEFT JOIN $purchase_table AS p ON p.customer=c.id LEFT JOIN $billing_table AS b ON b.customer=c.id LEFT JOIN $users_table AS u ON u.ID=c.wpuser AND (c.wpuser IS NULL OR c.wpuser !=0) $where GROUP BY c.id ORDER BY c.created DESC LIMIT $index,$per_page"; $Customers = $db->query($query,AS_ARRAY); $num_pages = ceil($customercount->total / $per_page); $page_links = paginate_links( array( 'base' => add_query_arg( 'pagenum', '%#%' ), 'format' => '', 'total' => $num_pages, 'current' => $pagenum )); $ranges = array( 'all' => __('Show New Customers','Ecart'), 'today' => __('Today','Ecart'), 'week' => __('This Week','Ecart'), 'month' => __('This Month','Ecart'), 'quarter' => __('This Quarter','Ecart'), 'year' => __('This Year','Ecart'), 'yesterday' => __('Yesterday','Ecart'), 'lastweek' => __('Last Week','Ecart'), 'last30' => __('Last 30 Days','Ecart'), 'last90' => __('Last 3 Months','Ecart'), 'lastmonth' => __('Last Month','Ecart'), 'lastquarter' => __('Last Quarter','Ecart'), 'lastyear' => __('Last Year','Ecart'), 'lastexport' => __('Last Export','Ecart'), 'custom' => __('Custom Dates','Ecart') ); $exports = array( 'tab' => __('Tab-separated.txt','Ecart'), 'csv' => __('Comma-separated.csv','Ecart'), 'xls' => __('Microsoft® Excel.xls','Ecart') ); $formatPref = $Ecart->Settings->get('customerexport_format'); if (!$formatPref) $formatPref = 'tab'; $columns = array_merge(Customer::exportcolumns(),Billing::exportcolumns(),Shipping::exportcolumns()); $selected = $Ecart->Settings->get('customerexport_columns'); if (empty($selected)) $selected = array_keys($columns); $authentication = $Ecart->Settings->get('account_system'); include(ECART_ADMIN_PATH."/customers/customers.php"); }
/** * Get object property * This method get element object if propertyName is "Elements[elementName]" format. * * @param string $propertyName * @return <type> */ public function getProperty($propertyName) { $ret = parent::getProperty($propertyName); if ($ret !== null) { return $ret; } $pos1 = strpos($propertyName, "["); $pos2 = strpos($propertyName, "]"); if ($pos1 > 0 && $pos2 > $pos1) { $propType = substr($propertyName, 0, $pos1); $elementName = substr($propertyName, $pos1 + 1, $pos2 - $pos1 - 1); /*if ($propType == "param") { // get parameter return $this->m_Parameters->get($ctrlname); }*/ return $this->getElement($elementName); } }
/** * Get the property of the object. Used in expression language * @param string $propertyName name of the property * @return string property value */ public function getProperty($propertyName) { $ret = parent::getProperty($propertyName); if ($ret) { return $ret; } if ($propertyName == "Title") { return $this->m_Title; } if ($propertyName == "jsClass") { return $this->m_jsClass; } if ($propertyName == "DataObjName") { return $this->m_DataObjName; } // get control object if propertyName is "Control[ctrlname]" $pos1 = strpos($propertyName, "["); $pos2 = strpos($propertyName, "]"); if ($pos1 > 0 && $pos2 > $pos1) { $propType = substr($propertyName, 0, $pos1); $ctrlname = substr($propertyName, $pos1 + 1, $pos2 - $pos1 - 1); if ($propType == "param") { // get parameter return $this->m_Parameters->get($ctrlname); } return $this->GetControl($ctrlname); } }
function updates ($data,$ignores=array()) { parent::updates($data,$ignores); if (preg_match('/^.*?(\d+[\.\,\d]*).*$/',$this->value)) $this->numeral = preg_replace('/^.*?(\d+[\.\,\d]*).*$/','$1',$this->value); }
/** * Get object property * This method get element object if propertyName is "Elements[elementName]" format. * * @param string $propertyName * @return <type> */ public function getProperty($propertyName) { $ret = parent::getProperty($propertyName); if ($ret !== null) { return $ret; } $pos1 = strpos($propertyName, "["); $pos2 = strpos($propertyName, "]"); if ($pos1 > 0 && $pos2 > $pos1) { $propType = substr($propertyName, 0, $pos1); $elementName = substr($propertyName, $pos1 + 1, $pos2 - $pos1 - 1); switch (strtolower($propType)) { case 'param': case 'params': $result = $this->m_FormParams[$elementName]; break; default: $result = $this->getElement($elementName); break; } return $result; } }
/** * Get property of element * * @param string $propertyName * @return mixed */ public function getProperty($propertyName) { if ($propertyName == "Value") { return $this->getValue(); } $ret = parent::getProperty($propertyName); if ($ret) { return $ret; } return $this->{$propertyName}; }
/** * Save the object back to the database * * @since 1.1 * * @return void **/ function save () { $this->value = new stdClass(); foreach ($this->_xcols as $col) $this->value->{$col} = $this->{$col}; parent::save(); }
/** * Adds an order note to record that the tickets email was resent. * * @param Purchase $order */ protected function add_tickets_resent_note($order_id) { $Note = new MetaObject(); $Note->parent = $order_id; $Note->context = 'purchase'; $Note->type = 'order_note'; $Note->name = 'note'; $Note->value = new stdClass(); $Note->value->author = wp_get_current_user()->ID; $Note->value->message = __('Email containing tickets (sent by ShoppTickets)', 'event-tickets-plus'); $Note->value->sent = true; $Note->save(); }
/** * Interface processor for the order manager * * @return void **/ function manager () { global $Ecart,$UI,$Notes; global $is_IIS; if ( !(is_ecart_userlevel() || current_user_can('ecart_orders')) ) wp_die(__('You do not have sufficient permissions to access this page.','Ecart')); $Purchase = $Ecart->Purchase; $Purchase->Customer = new Customer($Purchase->customer); // Handle Order note processing if (!empty($_POST['note'])) { $user = wp_get_current_user(); $Note = new MetaObject(); $Note->parent = $Purchase->id; $Note->context = 'purchase'; $Note->type = 'order_note'; $Note->name = 'note'; $Note->value = new stdClass(); $Note->value->author = $user->ID; $Note->value->message = $_POST['note']; $Note->save(); } if (!empty($_POST['delete-note'])) { $noteid = key($_POST['delete-note']); $Note = new MetaObject($noteid); $Note->delete(); } if (!empty($_POST['edit-note'])) { $noteid = key($_POST['note-editor']); $Note = new MetaObject($noteid); $Note->value->message = $_POST['note-editor'][$noteid]; $Note->save(); } $Notes = new ObjectMeta($Purchase->id,'purchase','order_note'); if (!empty($_POST['update'])) { check_admin_referer('ecart-save-order'); if ($_POST['txnstatus'] != $Purchase->txnstatus) do_action_ref_array('ecart_order_txnstatus_update',array(&$_POST['txnstatus'],&$Purchase)); $Purchase->updates($_POST); $mailstatus = false; if ($_POST['notify'] == "yes") { $labels = $this->Settings->get('order_status'); // Save a reference to this purchase in Ecart // so the Template API works when generating the receipt $Ecart->Purchase =& $Purchase; // Send the e-mail notification $addressee = "$Purchase->firstname $Purchase->lastname"; $address = "$Purchase->email"; $email = array(); $email['from'] = '"'.get_bloginfo("name").'"'; if ($Ecart->Settings->get('merchant_email')) $email['from'] .= ' <'.$Ecart->Settings->get('merchant_email').'>'; if($is_IIS) $email['to'] = $address; else $email['to'] = '"'.html_entity_decode($addressee,ENT_QUOTES).'" <'.$address.'>'; $email['subject'] = __('Order Updated','Ecart'); $email['url'] = get_bloginfo('siteurl'); $email['sitename'] = get_bloginfo('name'); if ($_POST['receipt'] == "yes") $email['receipt'] = $Purchase->receipt(); $email['status'] = strtoupper($labels[$Purchase->status]); $email['message'] = wpautop(stripslashes($_POST['message'])); if (file_exists(ECART_TEMPLATES."/notification.html")) $template = ECART_TEMPLATES."/notification.html"; if (file_exists(ECART_TEMPLATES."/notify.php")) $template = ECART_TEMPLATES."/notify.php"; if (ecart_email($template,$email)) $mailsent = true; } $Purchase->save(); if ($mailsent) $updated = __('Order status updated & notification email sent.','Ecart'); else $updated = __('Order status updated.','Ecart'); } $targets = $this->Settings->get('target_markets'); $UI->txnStatusLabels = Lookup::payment_status_labels(); $UI->statusLabels = $this->Settings->get('order_status'); if (empty($statusLabels)) $statusLabels = array(''); include(ECART_ADMIN_PATH."/orders/order.php"); }
/** * Read array meta data, and store to meta object * * @param array $xmlArr * @return void */ protected function readMetaData($xmlArr) { parent::readMetaData($xmlArr); $level = strtoupper($xmlArr["PLUGINSERVICE"]["LOG_CONFIG"]["ATTRIBUTES"]["LEVEL"]); $this->_level = (int) $level; $this->_format = strtoupper($xmlArr["PLUGINSERVICE"]["LOG_CONFIG"]["ATTRIBUTES"]["FORMAT"]); $this->_org = strtoupper($xmlArr["PLUGINSERVICE"]["LOG_CONFIG"]["ATTRIBUTES"]["ORG"]); $this->_daystolive = $xmlArr["PLUGINSERVICE"]["LOG_CONFIG"]["ATTRIBUTES"]["DAYSTOLIVE"] ? strtoupper($xmlArr["PLUGINSERVICE"]["LOG_CONFIG"]["ATTRIBUTES"]["DAYSTOLIVE"]) : '0'; }
/** * Get object property * This method get element object if propertyName is "Elements[elementName]" format. * * @param string $propertyName * @return <type> */ public function getProperty($propertyName) { $ret = parent::getProperty($propertyName); if ($ret !== null) { return $ret; } $pos1 = strpos($propertyName, "["); $pos2 = strpos($propertyName, "]"); if ($pos1 > 0 && $pos2 > $pos1) { $propType = substr($propertyName, 0, $pos1); $elementName = substr($propertyName, $pos1 + 1, $pos2 - $pos1 - 1); $result = $this->getElement($elementName); return $result; } }
/** * Get the property of the object. Used in expression language * @param string $propertyName name of the property * @return string property value */ public function getProperty($propertyName) { $ret = parent::getProperty($propertyName); if ($ret) { return $ret; } // get control object if propertyName is "type[ctrlname]" $pos1 = strpos($propertyName, "["); $pos2 = strpos($propertyName, "]"); if ($pos1 > 0 && $pos2 > $pos1) { $propType = substr($propertyName, 0, $pos1); $ctrlname = substr($propertyName, $pos1 + 1, $pos2 - $pos1 - 1); if ($propType == "param") { // get parameter return $this->m_Parameters->get($ctrlname); } } }
/** * Read array meta-data, and store to meta-object * * @param array $xmlArr * @return void */ protected function readMetadata(&$xmlArr) { parent::readMetaData($xmlArr); $this->m_Accounts = new MetaIterator($xmlArr["PLUGINSERVICE"]["ACCOUNTS"]["ACCOUNT"], "EmailAccount"); $this->_logEnabled = $xmlArr["PLUGINSERVICE"]["LOGGING"]["ATTRIBUTES"]["ENABLED"]; if ($this->_logEnabled) { $this->_logType = $xmlArr["PLUGINSERVICE"]["LOGGING"]["ATTRIBUTES"]["TYPE"]; $this->_logObject = $xmlArr["PLUGINSERVICE"]["LOGGING"]["ATTRIBUTES"]["OBJECT"]; } }