コード例 #1
0
ファイル: Messages.php プロジェクト: kokkez/shineisp
 /**
  * Save the message.
  *  
  * @param $note
  * @param $customerID
  * @param $domainID
  * @param $orderID
  * @param $detailID
  * @return Boolean
  */
 public static function addMessage($note, $customerID, $domainID = NULL, $orderID = NULL, $detailID = NULL, $ispID = NULL)
 {
     $message = new Messages();
     if (!empty($note)) {
         $customer = Customers::get_by_customerid($customerID);
         $message->dateposted = date('Y-m-d H:i:s');
         $message->message = $note;
         $message->customer_id = $customerID;
         $message->isp_id = $ispID;
         $message->domain_id = $domainID;
         $message->order_id = $orderID;
         $message->detail_id = $detailID;
         $message->save();
         return $message['message_id'];
     }
     return false;
 }
コード例 #2
0
ファイル: Domains.php プロジェクト: kokkez/shineisp
 /**
  * ownerGrid
  * Get the customer/owner information.
  * @return array
  */
 public static function ownerGrid($domain_id)
 {
     if (isset($domain_id) && is_numeric($domain_id)) {
         $domain = self::find($domain_id, '*', true);
         if (!empty($domain[0]['customer_id'])) {
             $customer = Customers::get_by_customerid($domain[0]['customer_id'], 'company, firstname, lastname, email');
         }
         if (isset($customer[0])) {
             return array('records' => $customer, 'editpage' => 'customers');
         }
     }
 }
コード例 #3
0
ファイル: CustomersController.php プロジェクト: moay/shineisp
 /**
  * Search the record for the Select2 JQuery Object by ajax
  * @return json
  */
 public function searchAction()
 {
     if ($this->getRequest()->isXmlHttpRequest()) {
         $term = $this->getParam('term');
         $id = $this->getParam('id');
         if (!empty($term)) {
             $term = "%{$term}%";
             $records = Customers::findbyCustomfield("(firstname LIKE ?) OR (lastname LIKE ?) OR company LIKE ?", array($term, $term, $term));
             die(json_encode($records));
         }
         if (!empty($id)) {
             $records = Customers::get_by_customerid($id);
             die(json_encode($records));
         }
         $records = Customers::getAll();
         die(json_encode($records));
     } else {
         die;
     }
 }
コード例 #4
0
ファイル: OrdersController.php プロジェクト: kokkez/shineisp
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/orders/process');
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     $customer = null;
     $createInvoiceConfirmText = $this->translator->translate('Are you sure you want to create or overwrite the invoice for this order?');
     $id = intval($this->getRequest()->getParam('id'));
     $this->view->description = $this->translator->translate("Here you can edit the selected order.");
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->orders->find($id);
         if (!empty($rs)) {
             $rs = $rs->toArray();
             $rs['setupfee'] = Orders::getSetupfee($id);
             $rs['order_date'] = Shineisp_Commons_Utilities::formatDateOut($rs['order_date']);
             $rs['expiring_date'] = Shineisp_Commons_Utilities::formatDateOut($rs['expiring_date']);
             $rs['received_income'] = 0;
             $rs['missing_income'] = $rs['grandtotal'];
             $rs['order_number'] = !empty($rs['order_number']) ? $rs['order_number'] : Orders::formatOrderId($rs['order_id']);
             $payments = Payments::findbyorderid($id, 'income', true);
             if (isset($payments)) {
                 foreach ($payments as $payment) {
                     $rs['received_income'] += isset($payment['income']) ? $payment['income'] : 0;
                     $rs['missing_income'] -= isset($payment['income']) ? $payment['income'] : 0;
                 }
             }
             $rs['profit'] = $rs['total'] - $rs['cost'];
             $rs['profit'] = $currency->toCurrency($rs['profit'], array('currency' => Settings::findbyParam('currency')));
             // set the default income to prepare the payment task
             $rs['income'] = $rs['missing_income'];
             $rs['missing_income'] = sprintf('%.2f', $rs['missing_income']);
             unset($payments);
             $parent = Customers::find($rs['customer_id']);
             //if customer comes from reseller
             if ($parent['parent_id']) {
                 $rs['customer_parent_id'] = $parent['parent_id'];
             } else {
                 $rs['customer_parent_id'] = $rs['customer_id'];
             }
             $link = Fastlinks::findlinks($id, $rs['customer_id'], 'Orders');
             if (isset($link[0])) {
                 $rs['fastlink'] = $link[0]['code'];
                 $rs['visits'] = $link[0]['visits'];
             }
             $form->populate($rs);
             $this->view->id = $id;
             $this->view->customerid = $rs['customer_id'];
             if (!empty($rs['fastlink'])) {
                 $this->view->titlelink = "/index/link/id/" . $rs['fastlink'];
             }
             if (!empty($rs['order_number'])) {
                 $this->view->title = $this->translator->_("Order nr. %s", $rs['order_number']);
             }
             $this->view->messages = Messages::getbyOrderId($id);
             $createInvoiceConfirmText = $rs['missing_income'] > 0 ? $this->translator->translate('Are you sure you want to create or overwrite the invoice for this order? The order status is: not paid.') : $createInvoiceConfirmText;
             $customer = Customers::get_by_customerid($rs['customer_id'], 'company, firstname, lastname, email');
         } else {
             $this->_helper->redirector('list', 'orders', 'admin');
         }
     }
     $this->view->mex = urldecode($this->getRequest()->getParam('mex'));
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('id' => 'submit', 'css' => array('btn btn-success'))), array("url" => "/admin/orders/print/id/{$id}", "label" => $this->translator->translate('Print'), "params" => array('css' => null)), array("url" => "/admin/orders/dropboxit/id/{$id}", "label" => $this->translator->translate('Dropbox It'), "params" => array('css' => null)), array("url" => "/admin/orders/clone/id/{$id}", "label" => $this->translator->translate('Clone'), "params" => array('css' => null)), array("url" => "/admin/orders/sendorder/id/{$id}", "label" => $this->translator->translate('Email'), "params" => array('css' => array('btn btn-danger'))), array("url" => "/admin/orders/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => array('btn btn-danger'))), array("url" => "/admin/orders/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if the order has been invoiced
     $invoice_id = Orders::isInvoiced($id);
     if ($invoice_id) {
         $this->view->buttons[] = array("url" => "/admin/orders/sendinvoice/id/{$invoice_id}", "label" => $this->translator->translate('Email invoice'), "params" => array('css' => array('btn btn-danger')));
         $this->view->buttons[] = array("url" => "/admin/invoices/print/id/{$invoice_id}", "label" => $this->translator->translate('Print invoice'), "params" => array('css' => null));
     } else {
         // Order not invoiced, show button to create a new invoice
         $this->view->buttons[] = array("url" => "/admin/orders/createinvoice/id/{$id}", "label" => $this->translator->translate('Invoice'), "params" => array('css' => array('btn btn-danger')), 'onclick' => "return confirm('" . $createInvoiceConfirmText . "')");
     }
     $this->view->customer = array('records' => $customer, 'editpage' => 'customers');
     $this->view->ordersdatagrid = $this->orderdetailGrid();
     $this->view->paymentsdatagrid = $this->paymentsGrid();
     $this->view->statushistory = StatusHistory::getStatusList($id);
     // Get Order status history
     $this->view->filesgrid = $this->filesGrid();
     $this->view->statushistorygrid = $this->statusHistoryGrid();
     $this->view->form = $form;
     $this->render('applicantform');
 }
コード例 #5
0
ファイル: Isp.php プロジェクト: kokkez/shineisp
 /**
  * Get ISP by Customer Id
  * @param string $email
  */
 public static function getByCustomerId($id)
 {
     $Customer = Customers::get_by_customerid($id);
     $isp_id = isset($Customer['isp_id']) ? intval($Customer['isp_id']) : 1;
     // TODO: remove fallback to 1
     return self::getActiveIspById($isp_id);
 }