public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Creation date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'date_end', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'label' => $translate->_('Message'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg')); $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Note'), 'description' => $translate->_('Write here a note. An email will be sent to the ISP staff.'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg')); $this->addElement('textarea', 'setup', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup Configuration'), 'description' => $translate->_('Here you can read the service configuration written by the ISP modules. These information are read-only.'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12')); $this->addElement('select', 'order_id', array('label' => $translate->_('Orders'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('order_id')->setAllowEmpty(false)->setMultiOptions(Orders::getList(true)); $this->addElement('multiselect', 'domains', array('label' => $translate->_('Available domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control col-lg-12 tmpitems')); $this->getElement('domains')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList()); $this->addElement('multiselect', 'domains_selected', array('label' => $translate->_('Selected domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control col-lg-12 items')); $this->getElement('domains_selected')->setRegisterInArrayValidator(false); // Disable the Validator in order to manage a dynamic list. $this->addElement('select', 'product_id', array('label' => $translate->_('Products'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('product_id')->setAllowEmpty(false)->setMultiOptions(Products::getList(true)); $this->addElement('select', 'billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('billing_cycle_id')->setAllowEmpty(false)->setMultiOptions(BillingCycle::getList(true)); $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders', false, true)); $this->addElement('select', 'autorenew', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Auto Renewal'), 'description' => $translate->_('Enable or disable the automatic renewal of the service'), 'class' => 'form-control')); $this->getElement('autorenew')->setAllowEmpty(false)->setMultiOptions(array('1' => $translate->_('Yes, I would like to renew the service at the expiration date.'), '0' => $translate->_('No, I am not interested in the service renew.'))); $this->addElement('hidden', 'detail_id'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'invoice_date', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('select', 'order_id', array('label' => $translate->_('Order No.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('order_id')->setAllowEmpty(false)->setMultiOptions(Orders::getList(true)); $this->addElement('select', 'customer_parent_id', array('label' => $translate->_('Invoice destination'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'disable' => 'true')); $this->getElement('customer_parent_id')->setAllowEmpty(true)->setMultiOptions(Customers::getList(true)); $this->addElement('text', 'number', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Sequential number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'formatted_number', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Invoice number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Private Notes'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg')); $this->addElement('hidden', 'invoice_id'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Subject'), 'class' => 'form-control')); $this->addElement('text', 'datetime', array('filters' => array('StringTrim'), 'label' => $translate->_('Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'class' => 'col-lg-12 form-control wysiwyg')); $this->addElement('select', 'sendemail', array('label' => $translate->_('Send Email'), 'description' => $translate->_('Send an email to the customer.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('1' => $translate->_('Yes'), '0' => $translate->_('No')))); $this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'class' => 'form-control')); $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList()); $this->addElement('select', 'customer_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Customer'), 'class' => 'form-control')); $this->getElement('customer_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Customers::getList()); $this->addElement('select', 'category', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'class' => 'form-control')); $this->getElement('category')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList()); $this->addElement('select', 'order_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Order reference'), 'class' => 'form-control')); $this->getElement('order_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Orders::getList(true)); $this->addElement('select', 'sibling_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Relationships'), 'class' => 'form-control')); $this->getElement('sibling_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false); $this->addElement('select', 'user_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Operator'), 'class' => 'form-control')); $this->getElement('user_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(AdminUser::getList()); #->setMultiOptions(AdminUser::getUserbyRoleID(AdminRoles::getIdRoleByName('operator'))); $this->addElement('select', 'status_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Status'), 'class' => 'form-control')); $this->getElement('status_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Statuses::getList('tickets')); // If the browser client is an Apple client hide the file upload html object if (false == Shineisp_Commons_Utilities::isAppleClient()) { $MBlimit = Settings::findbyParam('adminuploadlimit'); $Types = Settings::findbyParam('adminuploadfiletypes', 'Admin'); if (empty($MBlimit)) { $MBlimit = 1; } if (empty($Types)) { $Types = "zip,jpg"; } $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit); $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'decorators' => array('File', array('ViewScript', array('viewScript' => 'partials/file.phtml', 'placement' => false))), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $Types, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle')); $file->addValidator('Extension', false, $Types)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1); $this->addElement($file); } else { $this->addElement('hidden', 'attachments'); } $this->addElement('hidden', 'ticket_id'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'paymentdate', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Payment date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'reference', array('filters' => array('StringTrim'), 'label' => $translate->_('Transaction Reference'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'income', array('filters' => array('StringTrim'), 'label' => $translate->_('Income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'outcome', array('filters' => array('StringTrim'), 'label' => $translate->_('Expense'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'confirmed', array('filters' => array('StringTrim'), 'label' => $translate->_('Does the Transaction has been confirmed?'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('confirmed')->setAllowEmpty(false)->setMultiOptions(array('0' => "No, it has been not", '1' => "Yes, it has been")); $this->addElement('select', 'bank_id', array('decorators' => array('Bootstrap'), 'label' => 'Method of Payments', 'class' => 'form-control')); $this->getElement('bank_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Banks::getList()); $this->addElement('select', 'order_id', array('decorators' => array('Bootstrap'), 'label' => 'Order', 'class' => 'form-control')); $this->getElement('order_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Orders::getList()); $this->addElement('select', 'customer_id', array('decorators' => array('Bootstrap'), 'label' => 'Customer', 'class' => 'form-control')); $this->getElement('customer_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Customers::getList()); $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'id' => 'description', 'rows' => '3', 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control')); $this->addElement('hidden', 'payment_id'); }
/** * newAction * Create the form module in order to create a record * @return unknown_type */ public function doAction() { $request = $this->getRequest(); $q = $request->getParam('q'); $q = strtolower($q); if (!$q) { return; } $q = trim($q); $customers = Customers::getList(); foreach ($customers as $key => $value) { if (strpos(strtolower($value), $q) !== false) { echo "{$key}|{$value}|customers|" . $this->translator->translate('Customers') . "\n"; } } $customers = Customers::getEmailList(); foreach ($customers as $key => $value) { if (strpos(strtolower($value), $q) !== false) { echo "{$key}|{$value}|customers|" . $this->translator->translate('Customer email') . "\n"; } } $domains = Domains::getList(); foreach ($domains as $key => $value) { if (strpos(strtolower($value), $q) !== false) { echo "{$key}|{$value}|domains|" . $this->translator->translate('Domains') . "\n"; } } $products = Products::getList(); foreach ($products as $key => $value) { if (strpos(strtolower($value), $q) !== false) { echo "{$key}|{$value}|products|" . $this->translator->translate('Products') . "\n"; } } $orders = Orders::getList(); foreach ($orders as $key => $value) { if (strpos(strtolower($value), $q) !== false) { echo "{$key}|{$value}|orders|" . $this->translator->translate('Orders') . "\n"; } } $wiki = Wiki::getList(); foreach ($wiki as $key => $value) { if (strpos(strtolower($value), $q) !== false) { echo "{$key}|{$value}|wiki|" . $this->translator->translate('Wiki') . "\n"; } } die; }
$order_type = substr($order['order_code'], -2, 2); if ('SK' != $order_type) { unset($orders[$k]); continue; } $ids[] = $order['id']; } $ids = implode(',', $ids); if ($ids) { Orders::inUpdate("id IN ({$ids})", "order_status=6"); } //先把状态改成 订单取消,回滚完库存把状态改成7:订单关闭 ABase::log("Order ids in 1 hour : " . serialize($ids), 'cron_'); $time = time() - 10800; //3小时前的订单库存回收,考虑订单生成后还差一分钟订单失效时用户点击付款,并在付款操作时又等待了2小时 $orders = Orders::getList("create_time<{$time} AND order_status=6", 'id,order_code'); //首先在1个小时内使订单失效 foreach ($orders as $k => $order) { $oid = $order['id']; $order_code = $order['order_code']; $order_type = substr($order_code, -2, 2); if ('SK' != $order_type) { unset($orders[$k]); continue; } //DB::Debug(); $stocks = ProductsStockLock::getList("order_code='{$order_code}' AND status=0"); ABase::log("Stocks in 3 hour order: " . serialize($stocks), 'cron_'); DB::tranBegin('stock_recycle'); foreach ($stocks as $stock) { $sid = $stock['id'];
/** * Create the form module in order to create a record * @return unknown_type */ public function doAction() { $request = $this->getRequest(); $q = $request->getParam('q'); $results = array(); $q = strtolower($q); if (empty($q)) { die(json_encode(array($this->translator->translate('No Records')))); } $cms = CmsPages::getList(); foreach ($cms as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-file', 'section' => $this->translator->translate('Cms'), 'value' => $value, 'url' => "/admin/cmspages/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } $customers = Customers::getList(); if (!empty($customers)) { foreach ($customers as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-user', 'section' => $this->translator->translate('Customer'), 'value' => $value, 'url' => "/admin/customers/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $domains = Domains::getList(); if (!empty($domains)) { foreach ($domains as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-globe', 'section' => $this->translator->translate('Domain'), 'value' => $value, 'url' => "/admin/domains/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $products = Products::getList(); if (!empty($products)) { foreach ($products as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-barcode', 'section' => $this->translator->translate('Product'), 'value' => $value, 'url' => "/admin/products/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $orders = Orders::getList(); if (!empty($orders)) { foreach ($orders as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-briefcase', 'section' => $this->translator->translate('Order'), 'value' => $value, 'url' => "/admin/orders/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $ordersitems = OrdersItems::getItemsListbyDescription($q); if (!empty($ordersitems)) { foreach ($ordersitems as $key => $value) { $results[] = array('icon' => 'glyphicon-briefcase', 'section' => $this->translator->translate('Order Item'), 'value' => $value, 'url' => "/admin/ordersitems/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } $tickets = Tickets::getList(); if (!empty($tickets)) { foreach ($tickets as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-check', 'section' => $this->translator->translate('Ticket'), 'value' => $value, 'url' => "/admin/tickets/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $wiki = Wiki::getList(); if (!empty($wiki)) { foreach ($wiki as $key => $value) { if (strpos(strtolower($value), $q) !== false) { $results[] = array('icon' => 'glyphicon-question-sign', 'section' => $this->translator->translate('Wiki'), 'value' => $value, 'url' => "/admin/wiki/edit/id/{$key}", 'tokens' => explode(' ', $value)); } } } $ticket = TicketsNotes::getItemsNote($q); foreach ($ticket as $key => $value) { $results[] = array('icon' => 'glyphicon-question-sign', 'section' => $this->translator->translate('Ticket Notes'), 'value' => $value, 'url' => "/admin/wiki/tickets/id/{$key}", 'tokens' => explode(' ', $value)); } die(json_encode($results)); }