示例#1
0
 public function edit($id, $userid)
 {
     $row = new Invoice();
     $row->load($id);
     $params['fixed'] = array('toggle', 0);
     $params['userid'] = array('hidden', $userid);
     $params['active'] = array('toggle', 1);
     $params['created_date'] = array('list_date', date('Y-m-d H:i:s', (int) gmdate('U')));
     $params['amount'] = array('inputB', '');
     $params['usage'] = array('list', 0);
     $params['method'] = array('list', '');
     $params['coupons'] = array('list', 0);
     $available_plans = SubscriptionPlanHandler::getActivePlanList();
     $lists['usage'] = JHTML::_('select.genericlist', $available_plans, 'usage', 'size="1"', 'value', 'text', $row->usage);
     $lists['method'] = str_replace('processor', 'method', PaymentProcessorHandler::getSelectList($row->method, true));
     $this->db->setQuery('SELECT `id` as value, `coupon_code` as text' . ' FROM #__acctexp_coupons');
     $coupons = $this->db->loadObjectList();
     $this->db->setQuery('SELECT `id` as value, `coupon_code` as text' . ' FROM #__acctexp_coupons_static');
     $coupons = array_merge($this->db->loadObjectList(), $coupons);
     $coupons_active = array();
     if (!empty($row->coupons)) {
         foreach ($row->coupons as $coupon_code) {
             $coupon_id = couponHandler::idFromCode($coupon_code);
             $coupons_active[] = (int) $coupon_id['id'];
         }
     }
     $lists['coupons'] = JHTML::_('select.genericlist', $coupons, 'coupons[]', 'multiple="multiple"', 'value', 'text', $coupons_active);
     $params_values = array();
     $params_values['active'] = $row->active;
     $params_values['fixed'] = $row->fixed;
     $params_values['userid'] = $row->userid;
     $params_values['created_date'] = $row->created_date;
     $settings = new aecSettings('invoice', 'general');
     $settings->fullSettingsArray($params, $params_values, $lists);
     // Call HTML Class
     $aecHTML = new aecHTML($settings->settings, $settings->lists);
     if (!empty($customparamsarray)) {
         $aecHTML->customparams = $customparamsarray;
     }
     $aecHTML->params = $row->params;
     HTML_AcctExp::editInvoice($aecHTML, $id);
 }