Exemplo n.º 1
0
 /**
  * Get a record by ID
  * @param $id
  * @return Doctrine Record
  */
 public static function getById($id)
 {
     $dq = Doctrine_Query::create()->from('Notes n')->where("n.note_id = ?", $id)->limit(1);
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $logged_user = $auth->getIdentity();
         $dq->leftJoin('n.AdminUser au')->whereIn("au.isp_id", $logged_user['isp_id']);
         $dq->addWhere("n.user_id = ?", $logged_user['user_id']);
     }
     $record = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     if (!empty($record)) {
         if (!empty($record[0]['expire'])) {
             $record[0]['expire'] = Shineisp_Commons_Utilities::formatDateOut($record[0]['expire']);
         }
     }
     return $record;
 }
Exemplo n.º 2
0
 public function Alerts()
 {
     $registry = Shineisp_Registry::getInstance();
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     $translation = $registry->Zend_Translate;
     $alerts = array();
     $this->view->module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $this->view->controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $this->view->action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $NS = new Zend_Session_Namespace('Default');
     if (!empty($NS->customer)) {
         $data = $NS->customer;
         $orders = Orders::find_all_not_paid_ordersbyCustomerID($data['customer_id']);
         $tasks_errors = DomainsTasks::GetIncompleteTask($data['customer_id']);
         if (count($tasks_errors) > 0) {
             foreach ($tasks_errors as $task) {
                 if (!empty($task['log'])) {
                     $alerts[] = array('message' => $task['domain'] . " - " . $translation->_($task['log']), $task['domain_id'], 'link' => '/domains/edit/id/' . $task['domain_id'], 'icon' => 'danger');
                 }
             }
         }
         if (count($orders) > 0) {
             foreach ($orders as $order) {
                 $order['grandtotal'] = $currency->toCurrency($order['grandtotal'], array('currency' => Settings::findbyParam('currency')));
                 if (!empty($order['invoice_id'])) {
                     $alerts[] = array('message' => $translation->_('The invoice %s of %s (%s) has been not payed yet, click here to show more details.', $order['Invoices']['number'], Shineisp_Commons_Utilities::formatDateOut($order['order_date']), $order['grandtotal']), 'link' => '/orders/edit/id/' . $order['order_id'], 'icon' => 'danger');
                 } else {
                     $alerts[] = array('message' => $translation->_('The order %s that you have requested the %s with total %s has not been paid yet, click here for more information.', $order['order_number'], Shineisp_Commons_Utilities::formatDateOut($order['order_date']), $order['grandtotal']), 'link' => '/orders/edit/id/' . $order['order_id'], 'icon' => 'danger');
                 }
             }
         }
         $this->view->alerts = $alerts;
         // Path of the template
         return $this->view->render('partials/alerts.phtml');
     }
 }
Exemplo n.º 3
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $isp = Shineisp_Registry::get('ISP');
     $request = $this->getRequest();
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index');
     }
     // Get our form and validate it
     $form = $this->getForm('/admin/orders/process');
     if (!$form->isValid($request->getPost())) {
         // Invalid entries
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("Order process");
         $this->view->description = $this->translator->translate("Check the information posted and then click on the save button.");
         return $this->_helper->viewRenderer('applicantform');
         // re-render the login form
     }
     // Get the values posted
     $params = $form->getValues();
     // Get the id
     $id = $this->getRequest()->getParam('order_id');
     // Save the message note
     if (!empty($params['note'])) {
         // If the order is commentable then go on
         if (Orders::IsCommentable($id)) {
             $order = Orders::getAllInfo($id, null, true);
             $link = Fastlinks::findlinks($id, $this->customer['customer_id'], 'orders');
             if (!empty($link[0]['code'])) {
                 $code = $link[0]['code'];
             } else {
                 $code = Fastlinks::CreateFastlink('orders', 'edit', json_encode(array('id' => $id)), 'orders', $id, $this->customer['customer_id']);
             }
             // Save the message in the database
             Messages::addMessage($params['note'], $this->customer['customer_id'], null, $id);
             $in_reply_to = md5($id);
             $placeholder['messagetype'] = $this->translator->translate('Order');
             $placeholders['subject'] = sprintf("%03s", $id) . " - " . Shineisp_Commons_Utilities::formatDateOut($order[0]['order_date']);
             $placeholders['fullname'] = $this->customer['firstname'] . " " . $this->customer['lastname'];
             $placeholders['orderid'] = $placeholders['subject'];
             $placeholders['conditions'] = Settings::findbyParam('conditions');
             $placeholders['url'] = "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/" . $code;
             // Send a message to the customer
             Shineisp_Commons_Utilities::sendEmailTemplate($order[0]['Customers']['email'], 'order_message', $placeholders, $in_reply_to, null, null, $isp, $order[0]['Customers']['language_id']);
             $placeholders['url'] = "http://" . $_SERVER['HTTP_HOST'] . "/admin/login/link/id/{$code}/keypass/" . Shineisp_Commons_Hasher::hash_string($isp->email);
             $placeholders['message'] = $params['note'];
             // Send a message to the administrator
             Shineisp_Commons_Utilities::sendEmailTemplate($isp->email, 'order_message_admin', $placeholders, $in_reply_to);
         }
     }
     $this->_helper->redirector('index', 'orders', 'default', array('mex' => 'The requested task has been completed successfully', 'status' => 'success'));
 }
Exemplo n.º 4
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/purchases/process');
     $id = $this->getRequest()->getParam('id');
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/purchases/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/purchases/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     $this->view->title = $this->translator->translate("Purchases Edit");
     $this->view->description = $this->translator->translate("Here you can edit the selected purchase invoice.");
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->purchases->find($id)->toArray();
         if (!empty($rs)) {
             $rs['creationdate'] = Shineisp_Commons_Utilities::formatDateOut($rs['creationdate']);
             $rs['expiringdate'] = Shineisp_Commons_Utilities::formatDateOut($rs['expiringdate']);
             $rs['paymentdate'] = Shineisp_Commons_Utilities::formatDateOut($rs['paymentdate']);
             $this->view->title = $this->translator->translate("Purchase invoice") . " #" . $rs['number'] . " - " . $rs['creationdate'];
             $this->view->id = $id;
             $this->view->attachment = $rs['document'];
             $form->populate($rs);
             $this->view->buttons[] = array("url" => "/admin/purchases/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
         }
     }
     $this->view->mex = urldecode($this->getRequest()->getParam('mex'));
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 5
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/invoices/process');
     $id = $this->getRequest()->getParam('id');
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->invoices->find($id)->toArray();
         if (!empty($rs)) {
             $rs['invoice_date'] = Shineisp_Commons_Utilities::formatDateOut($rs['invoice_date']);
             $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'];
             }
             // Create the buttons in the edit form
             $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/invoices/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null)), array("url" => "/admin/invoices/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/invoices/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
             // Check if the order has been invoiced
             $this->view->buttons[] = array("url" => "/admin/orders/sendinvoice/id/{$id}", "label" => $this->translator->translate('Email invoice'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/invoices/print/id/{$id}", "label" => $this->translator->translate('Print invoice'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/invoices/confirmoverwrite/id/{$id}", "label" => $this->translator->translate('Overwrite invoice'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/orders/edit/id/" . $rs['order_id'], "label" => $this->translator->translate('Order'), "params" => array('css' => null));
             $form->populate($rs);
         }
     }
     $this->view->title = $this->translator->translate("Invoice Edit");
     $this->view->description = $this->translator->translate("Here you can edit the selected order.");
     $this->view->mex = urldecode($this->getRequest()->getParam('mex'));
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 6
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/ordersitems/process');
     $id = $this->getRequest()->getParam('id');
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/ordersitems/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/ordersitems/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if (!empty($id) && is_numeric($id)) {
         $rs = OrdersItems::getAllInfo($id);
         if (!empty($rs)) {
             // Load the domains attached to the order
             $form->getElement('domains_selected')->setMultiOptions(OrdersItemsDomains::getList($id));
             $rs['date_start'] = Shineisp_Commons_Utilities::formatDateOut($rs['date_start']);
             $rs['date_end'] = !empty($rs['date_end']) ? Shineisp_Commons_Utilities::formatDateOut($rs['date_end']) : "";
             $form->populate($rs);
             // send the order id in the view
             $this->view->order_id = $rs['order_id'];
             // send the customer id in the view
             $this->view->customer_id = $rs['Orders']['customer_id'];
             // Check if the product is a hosting plan
             $this->view->isHosting = !empty($rs['Products']['type']) && $rs['Products']['type'] == "hosting" ? true : false;
             // Create the buttons in the edit form
             $this->view->buttons[] = array("url" => "/admin/ordersitems/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/services/edit/id/{$id}", "label" => $this->translator->translate('Service'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/orders/edit/id/" . $rs['order_id'], "label" => $this->translator->translate('Order'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/customers/edit/id/" . $rs['Orders']['customer_id'], "label" => $this->translator->translate('Customers'), "params" => array('css' => null));
         } else {
             $this->_helper->redirector('list', 'orders', 'admin', array('mex' => $this->translator->translate('Unable to find the order item selected.'), 'status' => 'danger'));
         }
     } else {
         $this->_helper->redirector('list', 'orders', 'admin', array('mex' => $this->translator->translate('Unable to find the order item selected.'), 'status' => 'danger'));
     }
     $this->view->title = $this->translator->translate("Service edit");
     $this->view->description = $this->translator->translate("Here you can edit the service selected");
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 7
0
 /**
  * print the order
  *
  * @param unknown_type $invoiceid
  */
 public static function pdf($order_id, $show = true, $force = false, $path = "/documents/orders/")
 {
     $taxpercent = "";
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     if (!is_numeric($order_id)) {
         return false;
     }
     $pdf = new Shineisp_Commons_PdfOrder();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $payments = Payments::findbyorderid($order_id, null, true);
     $order = self::getAllInfo($order_id, null, true);
     // Set the name of the file
     $filename = $order[0]['order_date'] . " - " . $order[0]['order_id'] . ".pdf";
     $database['header']['label'] = $translator->translate('Order No.') . " " . $order[0]['order_number'] . " - " . Shineisp_Commons_Utilities::formatDateOut($order[0]['order_date']);
     $database['columns'][] = array("value" => $translator->translate("SKU"), "size" => 40);
     $database['columns'][] = array("value" => $translator->translate("Description"));
     $database['columns'][] = array("value" => $translator->translate("Qty"), "size" => 30, "align" => "center");
     $database['columns'][] = array("value" => $translator->translate("Unit"), "size" => 30);
     $database['columns'][] = array("value" => $translator->translate("Tax Free Price"), "size" => 60, "align" => "right");
     $database['columns'][] = array("value" => $translator->translate("Discount"), "size" => 60, "align" => "right");
     $database['columns'][] = array("value" => $translator->translate("Setup fee"), "size" => 60, "align" => "right");
     $database['columns'][] = array("value" => $translator->translate("Tax %"), "size" => 40, "align" => "center");
     $database['columns'][] = array("value" => $translator->translate("Total"), "size" => 50, "align" => "right");
     if (isset($order[0])) {
         $orderinfo['order_number'] = !empty($order[0]['order_number']) ? $order[0]['order_number'] : self::formatOrderId($order[0]['order_id']);
         $orderinfo['invoice_id'] = "";
         $orderinfo['date'] = Shineisp_Commons_Utilities::formatDateOut($order[0]['order_date']);
         //if customer comes from reseller
         if ($order[0]['Customers']['parent_id']) {
             $isTaxFree = Customers::isTaxFree($order[0]['Customers']['parent_id']);
             $isVATFree = Customers::isVATFree($order[0]['Customers']['parent_id']);
             $invoice_dest = Customers::getAllInfo($order[0]['Customers']['parent_id'], 'c.*, a.*');
             $orderinfo['customer']['customer_id'] = $invoice_dest['customer_id'];
             $orderinfo['customer']['company'] = $invoice_dest['company'];
             $orderinfo['customer']['firstname'] = $invoice_dest['firstname'];
             $orderinfo['customer']['lastname'] = $invoice_dest['lastname'];
             $orderinfo['customer']['vat'] = $invoice_dest['vat'];
             $orderinfo['customer']['taxpayernumber'] = $invoice_dest['taxpayernumber'];
             $orderinfo['customer']['email'] = $invoice_dest['email'];
             if (isset($invoice_dest['Addresses'][0])) {
                 $orderinfo['customer']['address'] = $invoice_dest['Addresses'][0]['address'];
                 $orderinfo['customer']['city'] = $invoice_dest['Addresses'][0]['city'];
                 $orderinfo['customer']['code'] = $invoice_dest['Addresses'][0]['code'];
                 $orderinfo['customer']['country'] = !empty($invoice_dest['Addresses'][0]['Countries']['name']) ? $invoice_dest['Addresses'][0]['Countries']['name'] : "";
             }
         } else {
             $isTaxFree = Customers::isTaxFree($order[0]['Customers']['customer_id']);
             $isVATFree = Customers::isVATFree($order[0]['Customers']['customer_id']);
             $orderinfo['customer']['customer_id'] = $order[0]['Customers']['customer_id'];
             $orderinfo['customer']['company'] = $order[0]['Customers']['company'];
             $orderinfo['customer']['firstname'] = $order[0]['Customers']['firstname'];
             $orderinfo['customer']['lastname'] = $order[0]['Customers']['lastname'];
             $orderinfo['customer']['vat'] = $order[0]['Customers']['vat'];
             $orderinfo['customer']['taxpayernumber'] = $order[0]['Customers']['taxpayernumber'];
             $orderinfo['customer']['email'] = $order[0]['Customers']['email'];
             if (isset($order[0]['Customers']['Addresses'][0])) {
                 $orderinfo['customer']['address'] = $order[0]['Customers']['Addresses'][0]['address'];
                 $orderinfo['customer']['city'] = $order[0]['Customers']['Addresses'][0]['city'];
                 $orderinfo['customer']['code'] = $order[0]['Customers']['Addresses'][0]['code'];
                 $orderinfo['customer']['country'] = $order[0]['Customers']['Addresses'][0]['Countries']['name'];
             }
         }
         if (count($payments) > 0) {
             $orderinfo['payment_date'] = Shineisp_Commons_Utilities::formatDateOut($payments[0]['paymentdate']);
             $orderinfo['payment_mode'] = $payments[0]['Banks']['name'];
             $orderinfo['payment_description'] = $payments[0]['description'];
             $orderinfo['payment_transaction_id'] = $payments[0]['reference'];
         }
         $orderinfo['invoice_id'] = "";
         $orderinfo['company']['name'] = $order[0]['Isp']['company'];
         $orderinfo['company']['manager'] = $order[0]['Isp']['manager'];
         $orderinfo['company']['vat'] = $order[0]['Isp']['vatnumber'];
         $orderinfo['company']['bankname'] = $order[0]['Isp']['bankname'];
         $orderinfo['company']['iban'] = $order[0]['Isp']['iban'];
         $orderinfo['company']['bic'] = $order[0]['Isp']['bic'];
         $orderinfo['company']['address'] = $order[0]['Isp']['address'];
         $orderinfo['company']['zip'] = $order[0]['Isp']['zip'];
         $orderinfo['company']['city'] = $order[0]['Isp']['city'];
         $orderinfo['company']['country'] = $order[0]['Isp']['country'];
         $orderinfo['company']['telephone'] = $order[0]['Isp']['telephone'];
         $orderinfo['company']['fax'] = $order[0]['Isp']['fax'];
         $orderinfo['company']['website'] = $order[0]['Isp']['website'];
         $orderinfo['company']['email'] = $order[0]['Isp']['email'];
         $orderinfo['company']['slogan'] = $order[0]['Isp']['slogan'];
         $orderinfo['company']['custom1'] = $order[0]['Isp']['custom1'];
         $orderinfo['company']['custom2'] = $order[0]['Isp']['custom2'];
         $orderinfo['company']['custom3'] = $order[0]['Isp']['custom3'];
         if ($order[0]['status_id'] == Statuses::id("tobepaid", "orders")) {
             // To be payed
             $orderinfo['ribbon']['text'] = $translator->translate("To be Paid");
             $orderinfo['ribbon']['color'] = "#D60000";
             $orderinfo['ribbon']['border-color'] = "#BD0000";
         } elseif ($order[0]['status_id'] == Statuses::id("complete", "orders")) {
             // Complete
             $orderinfo['ribbon']['text'] = $translator->translate("Paid");
             $orderinfo['ribbon']['color'] = "#009926";
             $orderinfo['ribbon']['border-color'] = "#00661A";
         } else {
             $orderinfo['ribbon']['text'] = $translator->translate(Statuses::getLabel($order[0]['status_id']));
             $orderinfo['ribbon']['color'] = "#FFCC33";
             $orderinfo['ribbon']['border-color'] = "#E6AC00";
         }
         $orderinfo['subtotal'] = $order[0]['total'];
         $orderinfo['grandtotal'] = $order[0]['grandtotal'];
         $orderinfo['vat'] = $order[0]['vat'];
         $orderinfo['delivery'] = 0;
         $database['records'] = $orderinfo;
         foreach ($order[0]['OrdersItems'] as $item) {
             $price = $item['price'] * $item['quantity'] + $item['setupfee'];
             $tax = Taxes::getTaxbyProductID($item['product_id']);
             if ($tax['percentage'] > 0) {
                 $rowtotal = $price * (100 + $tax['percentage']) / 100;
             } else {
                 $rowtotal = $price;
             }
             if (!$isTaxFree && !$isVATFree) {
                 $taxes = Taxes::getTaxbyProductID($item['product_id']);
                 if (!empty($taxes['percentage'])) {
                     $taxpercent = $taxes['percentage'];
                 }
             }
             if (!empty($item['discount'])) {
                 $item['discount'] = $item['discount'] . "%";
             }
             $database['records'][] = array($item['Products']['sku'], $item['description'], $item['quantity'], $translator->translate('nr'), $item['price'], $item['discount'], $item['setupfee'], $taxpercent, $rowtotal);
         }
         if (isset($order[0])) {
             $pdf->CreatePDF($database, $filename, $show, $path, $force);
             // Execute a custom event
             self::events()->trigger('orders_pdf_created', "Orders", array('file' => "{$path}/{$filename}"));
             return $path . $filename;
         }
     }
     return false;
 }
Exemplo n.º 8
0
 /**
  * Get a record and populate the application form 
  * 
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/creditnotes/process');
     $id = $this->getRequest()->getParam('id');
     $this->view->title = $this->translator->translate("Credit Note Edit");
     $this->view->description = $this->translator->translate("Here you can edit the selected credit notes.");
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/creditnotes/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null)), array("url" => "/admin/creditnotes/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/creditnotes/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->creditnotes->get_by_id($id);
         if (!empty($rs)) {
             $rs['creationdate'] = Shineisp_Commons_Utilities::formatDateOut($rs['creationdate']);
             $this->view->title = $this->translator->translate("Credit Note") . " #" . $rs['number'] . " - " . $rs['creationdate'];
             $this->view->id = $id;
             $form->populate($rs);
         }
         // Check if the order has been invoiced
         $invoice_id = $rs['invoice_id'];
         if ($invoice_id) {
             $this->view->buttons[] = array("url" => "/admin/creditnotes/printpdf/id/{$id}", "label" => $this->translator->translate('Print'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/invoices/edit/id/{$invoice_id}", "label" => $this->translator->translate('Invoice'), "params" => array('css' => null));
         }
     }
     $this->view->mex = urldecode($this->getRequest()->getParam('mex'));
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->items = $this->itemsGrid();
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 9
0
 /**
  * Creation of the payment transaction grid 
  * @return multitype:boolean multitype:string
  */
 private function paymentsGrid()
 {
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     $myrec = array();
     $requestId = $this->getParam('id');
     if (!empty($requestId) && is_numeric($requestId)) {
         $rs = Payments::findbyorderid($requestId, 'payment_id, paymentdate, b.name as bank, description, reference, confirmed, income, outcome', true);
         if (isset($rs)) {
             $i = 0;
             // Format some data
             foreach ($rs as $record) {
                 $myrec[$i]['id'] = $record['payment_id'];
                 // Set the date format
                 $myrec[$i]['payment_date'] = Shineisp_Commons_Utilities::formatDateOut($record['paymentdate']);
                 $myrec[$i]['description'] = $record['description'];
                 $myrec[$i]['reference'] = $record['reference'];
                 $myrec[$i]['confirmed'] = $record['confirmed'] ? $this->translator->translate('Yes') : $this->translator->translate('No');
                 $myrec[$i]['type'] = $record['bank'];
                 // Checking the currency set in the configuration
                 $myrec[$i]['income'] = $currency->toCurrency($record['income'], array('currency' => Settings::findbyParam('currency')));
                 $myrec[$i]['outcome'] = $currency->toCurrency($record['outcome'], array('currency' => Settings::findbyParam('currency')));
                 $i++;
             }
             return array('records' => $myrec, 'pager' => true, 'edit' => array('controller' => 'payments', 'action' => 'edit'), 'delete' => array('controller' => 'orders', 'action' => 'deletepayment'));
         }
     }
 }
Exemplo n.º 10
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/domains/process');
     $this->view->title = $this->translator->translate("Domain Edit");
     $this->view->description = $this->translator->translate("Here you can edit your own domain parameters.");
     $id = $this->getRequest()->getParam('id');
     if (!empty($id) && is_numeric($id)) {
         // Create the buttons in the edit form
         $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domains/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null)), array("url" => "/admin/domains/list", "label" => $this->translator->translate('List'), "params" => array('css' => null)), array("url" => "/admin/domains/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)), array("url" => "/admin/domains/newevent/id/{$id}", "label" => $this->translator->translate('Calendar Event'), "params" => array('css' => null)));
         try {
             $rs = $this->domains->find($id, null);
             if (!empty($rs[0])) {
                 $rs[0]['creation_date'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['creation_date']);
                 $rs[0]['expiring_date'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['expiring_date']);
                 $rs[0]['status_id'] = $rs[0]['Statuses']['status_id'];
                 // Domains NicHandles
                 $rs[0]['owner'] = DomainsNichandle::getProfile($id);
                 $rs[0]['admin'] = DomainsNichandle::getProfile($id, "admin");
                 $rs[0]['tech'] = DomainsNichandle::getProfile($id, "tech");
                 $rs[0]['billing'] = DomainsNichandle::getProfile($id, "billing");
                 $form->populate($rs[0]);
                 if (!empty($rs[0]['DomainsTlds']['WhoisServers'])) {
                     $this->view->title = $rs[0]['domain'] . "." . $rs[0]['DomainsTlds']['WhoisServers']['tld'];
                     $this->view->titlelink = "http://" . $rs[0]['domain'] . "." . $rs[0]['DomainsTlds']['WhoisServers']['tld'];
                     $this->view->icon = "fa fa-globe";
                 }
                 $this->view->owner_datagrid = domains::ownerGrid($id);
                 $this->view->actions = Registrars::getActions($rs[0]['registrars_id']);
             }
         } catch (Exception $e) {
             die($e->getMessage());
         }
         $this->view->id = $id;
         // Get all the messages attached to the domain
         $this->view->messages = Messages::getbyDomainId($id);
     }
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->dns_datagrid = Domains::dnsGrid();
     $this->view->form = $form;
     $this->view->services_datagrid = array('records' => domains::Services($id), 'edit' => array('controller' => 'services', 'action' => 'edit'));
     $this->view->orders_datagrid = array('records' => domains::Orders($id), 'edit' => array('controller' => 'orders', 'action' => 'edit'));
     $this->render('applicantform');
 }
Exemplo n.º 11
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/customers/process');
     $id = $this->getRequest()->getParam('id');
     $this->view->title = $this->translator->translate("Customer edit");
     $this->view->description = $this->translator->translate("Here you can edit the customer details.");
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/customers/list", "label" => $this->translator->translate('List'), "params" => array('css' => null)), array("url" => "/admin/customers/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->customers->getAllInfo($id);
         if (!empty($rs)) {
             $rs += CustomAttributes::getElementsValues($id, 'customers');
             $rs['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($rs['birthdate']);
             $this->view->id = $id;
             $form->populate($rs);
             if (!empty($rs['company'])) {
                 $this->view->title = $rs['company'] . " - " . $rs['firstname'] . " " . $rs['lastname'];
             } else {
                 $this->view->title = $rs['firstname'] . " " . $rs['lastname'];
             }
             $this->view->buttons[] = array("url" => "/admin/orders/new", "label" => $this->translator->translate('New Order'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/customers/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/default/index/fastlogin/id/" . Shineisp_Commons_Hasher::hash_string($rs['email']), "label" => $this->translator->translate('Public profile'), "params" => array('css' => null));
         }
     }
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->editmode = true;
     $this->view->addressesdatagrid = $this->addressesGrid();
     $this->view->contactsdatagrid = $this->contactsGrid();
     $this->view->filesdatagrid = $this->filesGrid();
     $this->view->domainsdatagrid = $this->domainsGrid();
     $this->view->servicesdatagrid = $this->servicesGrid();
     $this->view->ordersdatagrid = $this->ordersGrid();
     $this->view->tickets = $this->ticketsGrid();
     $this->view->invoicesdatagrid = $this->invoicesGrid();
     $this->view->sentmailsdatagrid = $this->sentmailsGrid();
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 12
0
 /**
  * This batch has been created in order to remind customers
  * that one or more tickets are still open.
  */
 public static function checkTickets()
 {
     $isp = Isp::getActiveISP();
     $tickets = Tickets::getWaitingReply();
     // Get the template from the main email template folder
     $retval = Shineisp_Commons_Utilities::getEmailTemplate('ticket_waitreply');
     foreach ($tickets as $ticket) {
         $customer = $ticket['Customers'];
         // Get the fastlink attached
         $link_exist = Fastlinks::findlinks($ticket['ticket_id'], $customer['customer_id'], 'tickets');
         if (count($link_exist) > 0) {
             $fastlink = $link_exist[0]['code'];
         } else {
             $fastlink = Fastlinks::CreateFastlink('tickets', 'edit', json_encode(array('id' => $ticket['ticket_id'])), 'tickets', $ticket['ticket_id'], $customer['customer_id']);
         }
         $customer_url = "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/{$fastlink}";
         if ($retval) {
             $subject = $retval['subject'];
             $Template = nl2br($retval['template']);
             $subject = str_replace("[subject]", $ticket['subject'], $subject);
             $Template = str_replace("[subject]", $ticket['subject'], $Template);
             $Template = str_replace("[lastname]", $customer['lastname'], $Template);
             $Template = str_replace("[issue_number]", $ticket['ticket_id'], $Template);
             $Template = str_replace("[date_open]", Shineisp_Commons_Utilities::formatDateOut($ticket['date_open']), $Template);
             $Template = str_replace("[link]", $customer_url, $Template);
             $Template = str_replace("[signature]", $isp['company'] . "<br/>" . $isp['website'], $Template);
             Shineisp_Commons_Utilities::SendEmail($isp['email'], Contacts::getEmails($customer['customer_id']), null, $subject, $Template, true);
         }
     }
     return true;
 }
Exemplo n.º 13
0
 public static function formatSearchvalue($value)
 {
     // If is a numeric
     if (is_numeric($value)) {
         return $value;
     }
     // If is a date
     if (Shineisp_Commons_Utilities::isDate($value)) {
         return Shineisp_Commons_Utilities::formatDateOut($value);
     }
     $value = addslashes($value);
     return $value;
 }
Exemplo n.º 14
0
 public static function getList($empty = false)
 {
     $items = array();
     $arrTypes = Doctrine::getTable('PurchaseInvoices')->findAll();
     if ($empty) {
         $items[] = "";
     }
     foreach ($arrTypes->getData() as $c) {
         $items[$c['purchase_id']] = $z = sprintf("%03d", $c['number']) . " - " . Shineisp_Commons_Utilities::formatDateOut($c['creationdate']);
     }
     return $items;
 }
Exemplo n.º 15
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/payments/process');
     $id = $this->getRequest()->getParam('id');
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/payments/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/payments/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->payments->getAllInfo($id, null, true);
         if (!empty($rs[0])) {
             $rs[0]['paymentdate'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['paymentdate']);
             $this->view->buttons[] = array("url" => "/admin/orders/edit/id/" . $rs[0]['order_id'], "label" => $this->translator->translate('Order'), "params" => array('css' => null));
             $this->view->buttons[] = array("url" => "/admin/customers/edit/id/" . $rs[0]['customer_id'], "label" => $this->translator->translate('Customer'), "params" => array('css' => null));
             $form->populate($rs[0]);
         }
         $this->view->buttons[] = array("url" => "/admin/payments/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
     }
     $this->view->title = $this->translator->translate("Payment Transaction Details");
     $this->view->description = $this->translator->translate("Here you can edit the Payment Transaction information parameters.");
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 16
0
 /**
  * renewdomainAction
  * Renew a group of domains selected
  * @param $items
  * @return void
  */
 private function renewdomains($items)
 {
     $mex = "";
     if (is_array($items)) {
         try {
             $Orderid = Orders::createOrderWithMultiProducts($items, $this->customer['customer_id']);
             $isp = Shineisp_Registry::get('ISP');
             $order = Orders::getAllInfo($Orderid, null, true);
             $link = Fastlinks::findlinks($Orderid, $this->customer['customer_id'], 'orders');
             $retval = Shineisp_Commons_Utilities::getEmailTemplate('new_order');
             if ($retval) {
                 $subject = $retval['subject'];
                 $subject = str_replace("[orderid]", sprintf("%03s", $Orderid) . " - " . Shineisp_Commons_Utilities::formatDateOut($order[0]['order_date']), $subject);
                 $orderbody = $retval['template'];
                 $orderbody = str_replace("[fullname]", $order[0]['Customers']['firstname'] . " " . $order[0]['Customers']['lastname'], $orderbody);
                 $orderbody = str_replace("[bank]", $isp->bankname . "\nc/c:" . $isp->bankaccount . "\nIBAN: " . $isp->iban . "\nBIC: " . $isp->bic, $orderbody);
                 $orderbody = str_replace("[orderid]", $Orderid . "/" . date('Y'), $orderbody);
                 $orderbody = str_replace("[email]", $isp->email, $orderbody);
                 $orderbody = str_replace("[signature]", $isp->company . "\n" . $isp->email, $orderbody);
                 if (!empty($link[0])) {
                     $orderbody = str_replace("[url]", "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/" . $link[0]['code'], $orderbody);
                 } else {
                     $orderbody = str_replace("[url]", "http://" . $_SERVER['HTTP_HOST'], $orderbody);
                 }
                 if (!empty($order[0]['Customers']['email'])) {
                     Shineisp_Commons_Utilities::SendEmail($isp->email, $order[0]['Customers']['email'], $isp->email, $subject, $orderbody);
                 }
             }
             die(json_encode(array('reload' => '/orders/edit/id/' . $Orderid)));
         } catch (Exception $e) {
             die(json_encode(array('mex' => $e->getMessage())));
         }
     }
     return false;
 }
Exemplo n.º 17
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/domainstasks/process');
     $id = $this->getRequest()->getParam('id');
     $this->view->title = $this->translator->translate("Domain task");
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domainstasks/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domainstasks/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if (!empty($id) && is_numeric($id)) {
         $rs = DomainsTasks::getById($id, null, true);
         if (!empty($rs[0])) {
             $rs[0]['startdate'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['startdate']);
             $rs[0]['enddate'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['enddate']);
             $domain = $rs[0]['Domains']['domain'] . "." . $rs[0]['Domains']['DomainsTlds']['WhoisServers']['tld'];
             $this->view->title = $this->translator->_("Domain task: %s", $domain);
             $this->view->titlelink = "/admin/domains/edit/id/" . $rs[0]['domain_id'];
             $form->populate($rs[0]);
             $this->view->buttons[] = array("url" => "/admin/domainstasks/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
         }
     }
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->description = $this->translator->translate("Here you can edit the domain task information.");
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 18
0
 /**
  * Get status 
  * 
  * @param $order_id, $statusSection [orders, customers, ...], $fields="*"
  * @return Doctrine Record
  */
 public static function getStatusList($order_id, $fields = null)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $data = array();
     $i = 0;
     if (!is_numeric($order_id)) {
         return array();
     }
     $order_id = intval($order_id);
     $dq = Doctrine_Query::create()->from('StatusHistory sh')->leftJoin('sh.Statuses s')->where('sh.order_id = ?', $order_id)->andWhere('s.public = 1')->orderBy('sh.datetime ASC');
     if ($fields) {
         $dq->select($fields);
     } else {
         $dq->select("*, s.status AS status");
     }
     $records = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     foreach ($records as $record) {
         $data[$i]['datetime'] = Shineisp_Commons_Utilities::formatDateOut($record['datetime'], null, true);
         $data[$i]['status'] = $translator->translate($record['status']);
         $i++;
     }
     return $data;
 }
Exemplo n.º 19
0
 /**
  * editAction
  * Get a record and populate the application form
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/domainsprofiles/process');
     $id = $this->getRequest()->getParam('id');
     $this->view->title = $this->translator->translate("Customer edit");
     $this->view->description = $this->translator->translate("Here you can edit the customer details.");
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domainsprofiles/list", "label" => $this->translator->translate('List'), "params" => array('css' => null)), array("url" => "/admin/domainsprofiles/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->domainsprofiles->getAllInfo($id);
         if (!empty($rs)) {
             $rs['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($rs['birthdate']);
             $this->view->id = $id;
             $form->populate($rs);
             if (!empty($rs['company'])) {
                 $this->view->title = $rs['company'] . " - " . $rs['firstname'] . " " . $rs['lastname'];
             } else {
                 $this->view->title = $rs['firstname'] . " " . $rs['lastname'];
             }
             $this->view->buttons[] = array("url" => "/admin/domainsprofiles/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
         }
     }
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->editmode = true;
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 20
0
 /**
  * print the invoice
  * @param unknown_type $invoiceid
  */
 public static function PrintPDF($invoice_id, $show = true, $force = false, $path = "/documents/invoices/")
 {
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     $pdf = new Shineisp_Commons_PdfOrder();
     if (!is_numeric($invoice_id)) {
         return false;
     }
     $invoice = Invoices::find($invoice_id);
     if (!$invoice) {
         return false;
     }
     $invoice = $invoice->toArray();
     // Set the basepath for the file
     $Order = Doctrine::getTable('Orders')->findOneBy('order_id', $invoice['order_id']);
     $invoicePath = $path . $Order->isp_id . '/' . str_replace('-', '/', $invoice['invoice_id']);
     // Set the name of the file
     $filename = $invoicePath . '/' . $invoice['invoice_id'] . ".pdf";
     $filenameOld = $path . $invoice['invoice_date'] . " - " . $invoice['number'] . ".pdf";
     // 			Invoice already exists, we return it
     if ((file_exists(PUBLIC_PATH . $filename) || file_exists(PUBLIC_PATH . $filenameOld)) && $show && !$force) {
         $outputFilename = !empty($invoice['formatted_number']) ? $invoice['formatted_number'] . ".pdf" : $invoice['invoice_date'] . "_" . $invoice['number'] . ".pdf";
         header('Content-type: application/pdf');
         header('Content-Disposition: attachment; filename="' . $outputFilename . '"');
         $invoice = file_exists(PUBLIC_PATH . $filename) ? file_get_contents(PUBLIC_PATH . $filename) : file_get_contents(PUBLIC_PATH . $filenameOld);
         die($invoice);
     }
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $payments = Payments::findbyorderid($invoice['order_id'], null, true);
     $order = Orders::getAllInfo($invoice['order_id'], null, true);
     $database['header']['label'] = $translator->translate('Invoice No.') . " " . (!empty($invoice['formatted_number']) ? $invoice['formatted_number'] : $database['records']['invoice_number']) . " - " . Shineisp_Commons_Utilities::formatDateOut($invoice['invoice_date']);
     $database['columns'][] = array("value" => $translator->translate("SKU"), "size" => 20, "align" => "left", "key" => "sku");
     $database['columns'][] = array("value" => $translator->translate("Description"), "size" => 65, "align" => "left", "key" => "description");
     $database['columns'][] = array("value" => $translator->translate("Qty"), "size" => 2, "align" => "right", "key" => "qty");
     $database['columns'][] = array("value" => $translator->translate("Unit"), "size" => 12, "align" => "left", "key" => "unit");
     $database['columns'][] = array("value" => $translator->translate("Tax Free Price"), "size" => 9, "align" => "right", "key" => "taxfreeprice");
     $database['columns'][] = array("value" => $translator->translate("Discount"), "size" => 10, "align" => "right", "key" => "discount");
     $database['columns'][] = array("value" => $translator->translate("Setup fee"), "size" => 15, "align" => "right", "key" => "setup");
     $database['columns'][] = array("value" => $translator->translate("Total"), "size" => 18, "align" => "right", "key" => "total");
     if (isset($order[0])) {
         $orderinfo['order_number'] = !empty($order[0]['order_number']) ? $order[0]['order_number'] : Orders::formatOrderId($order[0]['order_id']);
         $orderinfo['invoice_id'] = $invoice['number'];
         $orderinfo['date'] = Shineisp_Commons_Utilities::formatDateOut($invoice['invoice_date']);
         //if customer comes from reseller
         if ($order[0]['Customers']['parent_id']) {
             $invoice_dest = Customers::getAllInfo($order[0]['Customers']['parent_id'], 'c.*, a.*');
             $orderinfo['customer']['customer_id'] = $invoice_dest['customer_id'];
             $orderinfo['customer']['company'] = $invoice_dest['company'];
             $orderinfo['customer']['firstname'] = $invoice_dest['firstname'];
             $orderinfo['customer']['lastname'] = $invoice_dest['lastname'];
             $orderinfo['customer']['vat'] = $invoice_dest['vat'];
             $orderinfo['customer']['taxpayernumber'] = $invoice_dest['taxpayernumber'];
             $orderinfo['customer']['email'] = $invoice_dest['email'];
             if (isset($invoice_dest['Addresses'][0])) {
                 $orderinfo['customer']['address'] = $invoice_dest['Addresses'][0]['address'];
                 $orderinfo['customer']['city'] = $invoice_dest['Addresses'][0]['city'];
                 $orderinfo['customer']['code'] = $invoice_dest['Addresses'][0]['code'];
                 $orderinfo['customer']['country'] = !empty($invoice_dest['Addresses'][0]['Countries']['name']) ? $invoice_dest['Addresses'][0]['Countries']['name'] : "";
             }
         } else {
             $orderinfo['customer']['customer_id'] = $order[0]['Customers']['customer_id'];
             $orderinfo['customer']['company'] = $order[0]['Customers']['company'];
             $orderinfo['customer']['firstname'] = $order[0]['Customers']['firstname'];
             $orderinfo['customer']['lastname'] = $order[0]['Customers']['lastname'];
             $orderinfo['customer']['vat'] = $order[0]['Customers']['vat'];
             $orderinfo['customer']['taxpayernumber'] = $order[0]['Customers']['taxpayernumber'];
             $orderinfo['customer']['email'] = $order[0]['Customers']['email'];
             if (isset($order[0]['Customers']['Addresses'][0])) {
                 $orderinfo['customer']['address'] = $order[0]['Customers']['Addresses'][0]['address'];
                 $orderinfo['customer']['city'] = $order[0]['Customers']['Addresses'][0]['city'];
                 $orderinfo['customer']['code'] = $order[0]['Customers']['Addresses'][0]['code'];
                 $orderinfo['customer']['country'] = $order[0]['Customers']['Addresses'][0]['Countries']['name'];
             }
         }
         $orderinfo['payments'] = array();
         if (count($payments) > 0) {
             if ($payments > 1) {
                 $numPayment = 1;
                 foreach ($payments as $payment) {
                     if ($numPayment++ > 10) {
                         break;
                     }
                     $payment['paymentdate'] = Shineisp_Commons_Utilities::formatDateOut($payment['paymentdate']);
                     $payment['income'] = $currency->toCurrency($payment['income'], array('currency' => Settings::findbyParam('currency')));
                     $orderinfo['payments'][] = $payment;
                 }
             }
             $orderinfo['payment_date'] = Shineisp_Commons_Utilities::formatDateOut($payments[0]['paymentdate']);
             $orderinfo['payment_mode'] = $payments[0]['Banks']['name'];
             $orderinfo['payment_description'] = $payments[0]['description'];
             $orderinfo['payment_transaction_id'] = $payments[0]['reference'];
         }
         $orderinfo['invoice_number'] = $invoice['number'];
         $orderinfo['company']['name'] = $order[0]['Isp']['company'];
         $orderinfo['company']['manager'] = $order[0]['Isp']['manager'];
         $orderinfo['company']['vat'] = $order[0]['Isp']['vatnumber'];
         $orderinfo['company']['bankname'] = $order[0]['Isp']['bankname'];
         $orderinfo['company']['iban'] = $order[0]['Isp']['iban'];
         $orderinfo['company']['bic'] = $order[0]['Isp']['bic'];
         $orderinfo['company']['address'] = $order[0]['Isp']['address'];
         $orderinfo['company']['zip'] = $order[0]['Isp']['zip'];
         $orderinfo['company']['city'] = $order[0]['Isp']['city'];
         $orderinfo['company']['country'] = $order[0]['Isp']['country'];
         $orderinfo['company']['telephone'] = $order[0]['Isp']['telephone'];
         $orderinfo['company']['fax'] = $order[0]['Isp']['fax'];
         $orderinfo['company']['website'] = $order[0]['Isp']['website'];
         $orderinfo['company']['email'] = $order[0]['Isp']['email'];
         $orderinfo['company']['slogan'] = $order[0]['Isp']['slogan'];
         $orderinfo['company']['custom1'] = $order[0]['Isp']['custom1'];
         $orderinfo['company']['custom2'] = $order[0]['Isp']['custom2'];
         $orderinfo['company']['custom3'] = $order[0]['Isp']['custom3'];
         $orderinfo['subtotal'] = $currency->toCurrency($order[0]['total'], array('currency' => Settings::findbyParam('currency')));
         $orderinfo['grandtotal'] = $currency->toCurrency($order[0]['grandtotal'], array('currency' => Settings::findbyParam('currency')));
         $orderinfo['vat'] = $currency->toCurrency($order[0]['vat'], array('currency' => Settings::findbyParam('currency')));
         $orderinfo['delivery'] = 0;
         if ($order[0]['status_id'] == Statuses::id("tobepaid", "orders")) {
             // To be payed
             $orderinfo['ribbon']['text'] = $translator->translate("To be Paid");
             $orderinfo['ribbon']['color'] = "#D60000";
         } elseif ($order[0]['status_id'] == Statuses::id("paid", "orders")) {
             // Paid
             $orderinfo['ribbon']['text'] = $translator->translate("Paid");
             $orderinfo['ribbon']['color'] = "#009926";
         } elseif ($order[0]['status_id'] == Statuses::id("complete", "orders")) {
             // Complete
             $orderinfo['ribbon']['text'] = $translator->translate("Complete");
             $orderinfo['ribbon']['color'] = "#009926";
         } else {
             $orderinfo['ribbon']['text'] = $translator->translate(Statuses::getLabel($order[0]['status_id']));
             $orderinfo['ribbon']['color'] = "#FFCC33";
         }
         $database['records'] = $orderinfo;
         foreach ($order[0]['OrdersItems'] as $item) {
             $billingCycle = BillingCycle::getAllinfo($item['billing_cycle_id']);
             if (!empty($billingCycle)) {
                 if (!empty($billingCycle['months']) && empty($item['tld_id'])) {
                     $price = $item['price'] * $billingCycle['months'] + $item['setupfee'];
                 } else {
                     $price = $item['price'] + $item['setupfee'];
                 }
             } else {
                 $price = $item['price'] * $item['quantity'] + $item['setupfee'];
             }
             $rowtotal = $price + $item['vat'];
             $item['price'] = $currency->toCurrency($item['price'], array('currency' => Settings::findbyParam('currency')));
             $item['setupfee'] = $currency->toCurrency($item['setupfee'], array('currency' => Settings::findbyParam('currency')));
             $rowtotal = $currency->toCurrency($rowtotal, array('currency' => Settings::findbyParam('currency')));
             if (!empty($item['discount'])) {
                 $item['discount'] = $item['discount'] . "%";
             }
             if (!empty($billingCycle['name']) && empty($item['tld_id'])) {
                 $item['date_end'] = Shineisp_Commons_Utilities::formatDateOut($item['date_end']);
                 $billingCycleName = $billingCycle['name'];
                 $item['description'] .= "<br/><br/> - " . $translator->translate('Expiring date') . ": " . $item['date_end'];
             } else {
                 $billingCycleName = "-";
             }
             // 					var_dump($item);
             $database['records']['items'][] = array($item['Products']['sku'], $item['description'], $item['quantity'], $billingCycleName, $item['price'], $item['discount'], $item['setupfee'], $rowtotal);
         }
         // 				var_dump($database['records']);
         // 				die;
         // Sanitize some fields
         $database['records']['invoice_number'] = !empty($database['records']['invoice_number']) ? $database['records']['invoice_number'] : "";
         $database['records']['formatted_number'] = !empty($invoice['formatted_number']) ? $invoice['formatted_number'] : $database['records']['invoice_number'];
         $database['records']['payment_description'] = !empty($database['records']['payment_description']) ? $database['records']['payment_description'] : "";
         $database['records']['payment_mode'] = !empty($database['records']['payment_mode']) ? $database['records']['payment_mode'] : "";
         $database['records']['payment_date'] = !empty($database['records']['payment_date']) ? $database['records']['payment_date'] : "";
         $database['records']['totalPayments'] = count($database['records']['payments']);
         // QRCode Image
         $code['order'] = $database['records']['order_number'];
         $code['customer'] = $database['records']['customer']['customer_id'];
         $jcode = base64_encode(json_encode($code));
         $database['records']['qrcode_url'] = $_SERVER['HTTP_HOST'] . "/index/qrcode/q/" . $jcode;
         $database['records']['skip_barcode'] = 1;
         if (!empty($database['records']['invoice_number'])) {
             $database['records']['barcode'] = $database['records']['invoice_number'];
             $database['records']['skip_barcode'] = 0;
         }
         if (isset($order[0])) {
             // Create the path structure
             if (!is_dir(PUBLIC_PATH . $invoicePath)) {
                 mkdir(PUBLIC_PATH . $invoicePath, 0700, true);
             }
             // Template name
             $templateName = Settings::findByParam('invoice_template');
             if (empty($templateName)) {
                 $templateName = Shineisp_Commons_Utilities::getFirstFile(PUBLIC_PATH . '/skins/commons/invoices', '/\\.phtml$/');
             }
             $invoiceview = new Shineisp_Invoice();
             $invoiceview->assign('header', $database['header']);
             $invoiceview->assign('columns', $database['columns']);
             $invoiceview->assign('data', $database['records']);
             $html = $invoiceview->render($templateName);
             $html2pdf = new HTML2PDF('P', 'A4', 'it', true, 'UTF-8', array(4, 4, 4, 1));
             $html2pdf->WriteHTML($html);
             $html2pdf->Output(PUBLIC_PATH . $filename, "F");
             // Execute a custom event
             self::events()->trigger('invoices_pdf_created', "Invoices", array('order' => $order, 'invoice' => $invoice, 'file' => $filename));
             return PUBLIC_PATH . $filename;
         }
     }
     return false;
 }
Exemplo n.º 21
0
 /**
  * Get the reviews data map coordinates
  */
 public static function getXMLDataMap($locale = 1)
 {
     $data = array();
     $j = 0;
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $records = Doctrine_Query::create()->from('Reviews r')->leftJoin('r.Products p')->leftJoin("p.ProductsData pd WITH pd.language_id = {$locale}")->where("active = ?", true)->andWhere('latitude <> ?', "")->andWhere('longitude <> ?', "")->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     foreach ($records as $record) {
         $text = "<div id=\"mycontent\">";
         $text .= "<div id=\"bodyContent\">";
         $text .= "<h4><a href=\"/" . $record['Products']['uri'] . ".html\">" . $record['Products']['ProductsData'][0]['name'] . "</a></h4>";
         for ($i = 0; $i < $record['stars']; $i++) {
             $text .= "*";
         }
         $text .= "<br/><br/>" . $record['review'] . "<br/>";
         $text .= "<p><b>inviato da " . $record['nick'] . "</b> il " . Shineisp_Commons_Utilities::formatDateOut($record['publishedat']) . "</p>";
         $text .= "</div></div>";
         $data['marker'][$j]['@attributes'] = array('lat' => $record['latitude'], 'lng' => $record['longitude']);
         $data['marker'][$j]['text']['@cdata'] = $text;
         $j++;
     }
     $customers = Addresses::getMapCoords();
     foreach ($customers as $record) {
         if (!empty($record['company'])) {
             $text = "";
             #$text = "<div id=\"mycontent\">";
             #$text .= "<div id=\"bodyContent\">";
             #$text .= "<p>". $translator->_('%s has choosen our company as I.T. partners', "<b>" . $record['company']. "</b>") . "</p>";
             #$text .= "</div></div>";
             $data['marker'][$j]['@attributes'] = array('lat' => $record['latitude'], 'lng' => $record['longitude'], 'icontype' => "purple");
             $data['marker'][$j]['text']['@cdata'] = $text;
             $j++;
         }
     }
     $xml = Shineisp_Commons_Array2XML::createXML('markers', $data);
     $xml->save(PUBLIC_PATH . "/documents/reviews.xml");
     return true;
 }
Exemplo n.º 22
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/panelsactions/process');
     $id = $this->getRequest()->getParam('id');
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/panelsactions/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/panelsactions/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if (!empty($id) && is_numeric($id)) {
         $rs = PanelsActions::getById($id, null, true);
         if (!empty($rs[0])) {
             $rs[0]['start'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['start']);
             $rs[0]['end'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['end']);
             $form->populate($rs[0]);
             $this->view->buttons[] = array("url" => "/admin/panelsactions/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
         }
     }
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->title = $this->translator->translate("Panel action edit");
     $this->view->description = $this->translator->translate("Here you can edit the panel actions.");
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 23
0
 /**
  * print the credit note
  * @param integer $creditnoteId
  */
 public static function PrintPDF($creditnoteId, $show = true)
 {
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     $pdf = new Shineisp_Commons_PdfOrder();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $creditnote = Doctrine_Query::create()->from('CreditNotes cn')->leftJoin('cn.CreditNotesItems cni')->leftJoin('cn.Invoices i')->leftJoin('i.Customers c')->leftJoin('c.Addresses a')->leftJoin('a.Countries co')->leftJoin('i.Orders o')->leftJoin('o.OrdersItems oi')->leftJoin('o.Isp isp')->leftJoin('o.Payments p')->leftJoin('p.Banks b')->leftJoin('o.Statuses s')->leftJoin('o.Customers oc')->where("cn.creditnote_id = ?", $creditnoteId)->execute(array(), Doctrine::HYDRATE_ARRAY);
     if (empty($creditnote)) {
         return false;
     }
     $invoice = $creditnote[0]['Invoices'];
     $customer = $creditnote[0]['Invoices']['Customers'];
     $payments = $creditnote[0]['Invoices']['Orders']['Payments'];
     $order = $creditnote[0]['Invoices']['Orders'];
     $items = $creditnote[0]['CreditNotesItems'];
     $database['header']['label'] = $translator->translate('Credit Note No.') . " " . sprintf("%03d", $creditnote[0]['number']) . " - " . Shineisp_Commons_Utilities::formatDateOut($creditnote[0]['creationdate']);
     $database['columns'][] = array("value" => "Description");
     $database['columns'][] = array("value" => "Qty", "size" => 30, "align" => "center");
     $database['columns'][] = array("value" => "Unit", "size" => 30);
     $database['columns'][] = array("value" => "Tax Free Price", "size" => 60, "align" => "right");
     $database['columns'][] = array("value" => "VAT", "size" => 40, "align" => "right");
     $database['columns'][] = array("value" => "Total", "size" => 50, "align" => "right");
     if (isset($order)) {
         $info['order_number'] = $order['order_id'];
         $info['invoice_number'] = $invoice['number'];
         $info['date'] = Shineisp_Commons_Utilities::formatDateOut($invoice['invoice_date']);
         //if customer comes from reseller
         if ($order['Customers']['parent_id']) {
             $reseller = Customers::getAllInfo($order['Customers']['parent_id']);
             $info['customer']['customer_id'] = $reseller['customer_id'];
             $info['customer']['company'] = $reseller['company'];
             $info['customer']['firstname'] = $reseller['firstname'];
             $info['customer']['lastname'] = $reseller['lastname'];
             $info['customer']['vat'] = $reseller['vat'];
             $info['customer']['email'] = $reseller['email'];
             if (isset($reseller['Addresses'][0])) {
                 $info['customer']['address'] = $reseller['Addresses'][0]['address'];
                 $info['customer']['city'] = $reseller['Addresses'][0]['city'];
                 $info['customer']['code'] = $reseller['Addresses'][0]['code'];
                 $info['customer']['country'] = !empty($reseller['Addresses'][0]['Countries']['name']) ? $reseller['Addresses'][0]['Countries']['name'] : "";
             }
         } else {
             $info['customer']['customer_id'] = $customer['customer_id'];
             $info['customer']['company'] = $customer['company'];
             $info['customer']['firstname'] = $customer['firstname'];
             $info['customer']['lastname'] = $customer['lastname'];
             $info['customer']['vat'] = $customer['vat'];
             $info['customer']['email'] = $customer['email'];
             if (isset($customer['Addresses'][0])) {
                 $info['customer']['address'] = $customer['Addresses'][0]['address'];
                 $info['customer']['city'] = $customer['Addresses'][0]['city'];
                 $info['customer']['code'] = $customer['Addresses'][0]['code'];
                 $info['customer']['country'] = $customer['Addresses'][0]['Countries']['name'];
             }
         }
         if (count($payments) > 0) {
             $info['payment_date'] = Shineisp_Commons_Utilities::formatDateOut($payments[0]['paymentdate']);
             $info['payment_mode'] = $payments[0]['Banks']['name'];
             $info['payment_description'] = $payments[0]['description'];
             $info['payment_transaction_id'] = $payments[0]['reference'];
         }
         $info['invoice_id'] = $invoice['number'];
         $info['company']['name'] = $order['Isp']['company'];
         $info['company']['vat'] = $order['Isp']['vatnumber'];
         $info['company']['bankname'] = $order['Isp']['bankname'];
         $info['company']['iban'] = $order['Isp']['iban'];
         $info['company']['bic'] = $order['Isp']['bic'];
         $info['company']['address'] = $order['Isp']['address'];
         $info['company']['zip'] = $order['Isp']['zip'];
         $info['company']['city'] = $order['Isp']['city'];
         $info['company']['country'] = $order['Isp']['country'];
         $info['company']['telephone'] = $order['Isp']['telephone'];
         $info['company']['fax'] = $order['Isp']['fax'];
         $info['company']['website'] = $order['Isp']['website'];
         $info['company']['email'] = $order['Isp']['email'];
         $info['company']['slogan'] = $order['Isp']['slogan'];
         $info['subtotal'] = $currency->toCurrency($creditnote[0]['total_net'], array('currency' => Settings::findbyParam('currency')));
         $info['grandtotal'] = $currency->toCurrency($creditnote[0]['total'], array('currency' => Settings::findbyParam('currency')));
         $info['vat'] = $currency->toCurrency($creditnote[0]['vat'], array('currency' => Settings::findbyParam('currency')));
         $info['delivery'] = 0;
         $database['records'] = $info;
         //				Zend_Debug::dump($creditnote);
         //				die;
         foreach ($items as $item) {
             $item['price'] = $currency->toCurrency($item['price'], array('currency' => Settings::findbyParam('currency')));
             $item['vat'] = $currency->toCurrency($item['vat'], array('currency' => Settings::findbyParam('currency')));
             $item['total'] = $currency->toCurrency($item['total'], array('currency' => Settings::findbyParam('currency')));
             $database['records'][] = array($item['description'], $item['quantity'], 'nr', $item['price'], $item['vat'], $item['total']);
         }
         if (isset($order)) {
             $pdf->CreatePDF($database, $creditnote[0]['creationdate'] . " - " . $creditnote[0]['number'] . ".pdf", $show, "/documents/creditnotes", true);
         }
     }
 }
Exemplo n.º 24
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/services/process');
     $service_domains = new OrdersItemsDomains();
     $id = $this->getRequest()->getParam('id');
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/services/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/services/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     try {
         if (!empty($id) && is_numeric($id)) {
             $form->getElement('domains')->setMultiOptions(Domains::getFreeOrderDomainsList($id));
             $rs = $this->services->getAllInfo($id, null, true);
             if (!empty($rs)) {
                 $form->getElement('domains_selected')->setMultiOptions($service_domains->getList($id));
                 $rs['date_start'] = Shineisp_Commons_Utilities::formatDateOut($rs['date_start']);
                 $rs['date_end'] = Shineisp_Commons_Utilities::formatDateOut($rs['date_end']);
                 $rs['customer_id'] = $rs['Orders']['customer_id'];
                 $form->populate($rs);
                 $this->view->buttons[] = array("url" => "/admin/services/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
                 $this->view->buttons[] = array("url" => "/admin/orders/edit/id/" . $rs['Orders']['order_id'], "label" => $this->translator->translate('Order'), "params" => array('css' => null));
             }
             // Get all the messages attached to the ordersitems
             $this->view->messages = Messages::getbyServiceId($id);
             $this->view->owner_datagrid = $this->ownerGrid($rs['Orders']['customer_id']);
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $this->view->title = $this->translator->translate("Service Details");
     $this->view->description = $this->translator->translate("Here you can see the details of the service subscribed by the customer.");
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->form = $form;
     $this->render('applicantform');
 }
Exemplo n.º 25
0
 /**
  * Create a Nic-Handle for the client 
  * 
  * Executes the 'login' command on Ascio's servers, to retrive the session variable
  * for execute the commands.
  * 
  *   Parameters
  *   ===========
  *   string session : the session id
  *   string name : the contact name
  *   string firstname : the contact firstname
  *   string sex : the contact sex (M/F)
  *   string password : the contact password
  *   string email : the contact email
  *   string phone : the contact phone number (international format, ex: +33.899701761)
  *   string fax : the contact fax number
  *   string address : the contact address
  *   string city : the contact city
  *   string area : the contact area
  *   string zip : the contact zip code
  *   string country : the contact country (be|fr|pl|es|lu|ch|de|...)
  *   string language : the contact language (fr|en|pl|es|de)
  *   boolean isOwner : is it an owner nic ? default false
  *   string legalform : the contact legalform (corporation|individual|association|other)
  *   string organisation : organisation name
  *   string legalName : the contact legalname
  *   string legalNumber : the contact legalnumber (SIRET/SIREN/...)
  *   string vat : the contact vat
  *   string birthDay : the contact birthDay
  *   string birthCity : the contact birth city
  *   string nationalIdentificationNumber : the contact fiscal code or company vat
  *   string companyNationalIdentificationNumber : the contact vat
  *   string corporationType : the contact vat (s.a.s.|s.n.c.|s.r.l.|s.p.a.|s.a.p.a.|s.c.a.r.l.|individuale)
  * 
  * 
  * @param      integer      $customerID		Code identifier
  * @return     string       $nicHandle		the new contact handle id
  * @access     private
  */
 private function createNicHandle($customerID)
 {
     $soap = $this->Connect();
     if (!empty($this->session)) {
         $fields = "c.customer_id as customer_id, c.company as company, c.firstname as firstname, c.lastname as lastname, c.gender as gender, c.email as email, c.password as password, c.birthdate as birthdate, c.birthplace as birthplace, c.taxpayernumber as taxpayernumber, c.vat as vat, c.note as note,  a.address as address, a.code as code, a.city as city, a.area as area, ct.name as country, ct.code as countrycode, cts.type_id as type_id, cts.name as companytype, l.legalform_id as legalform_id, l.name as legalform, s.status_id as status_id, s.status as status, cn.contact as contact";
         $customer = Customers::getAllInfo($customerID, $fields);
         return $soap->nicCreateIT($this->session['id'], $customer['lastname'], $customer['firstname'], $customer['gender'], Shineisp_Commons_Utilities::GenerateRandomString(), $customer['email'], $customer['contact'], null, $customer['address'], $customer['city'], $customer['area'], $customer['code'], strtolower($customer['countrycode']), "en", true, $customer['legalform'], $customer['company'], $customer['firstname'] . " " . $customer['lastname'], null, $customer['vat'], Shineisp_Commons_Utilities::formatDateOut($customer['birthdate']), $customer['birthplace'], $customer['taxpayernumber'], $customer['vat'], $customer['companytype']);
         // Corporation Type
     }
     return false;
 }
Exemplo n.º 26
0
 /**
  * 
  * @param integer $domainId
  * @param string $type
  */
 private function createNic($domainId, $type = 'owner')
 {
     $soap = $this->Connect();
     if (!empty($this->session)) {
         $tld = Domains::getDomainTld($domainId);
         // get the domain profile
         $profile = DomainsProfiles::getProfileByDomainId($domainId, $type);
         if ($profile) {
             // Set generic variables for parameters
             $profile['countrycode'] = strtolower(Countries::getCodebyId($profile['country_id']));
             $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($profile['birthdate']);
             $profile['password'] = Shineisp_Commons_Utilities::GenerateRandomString();
             $profile['fullname'] = $profile['firstname'] . " " . $profile['lastname'];
             $profile['legalform'] = strtolower($profile['Legalforms']['name']);
             $profile['corporationtype'] = strtolower($profile['CompanyTypes']['name']);
             $profile['legalnumber'] = null;
             $profile['language'] = "en";
             $profile['isowner'] = $type == "owner" ? true : false;
             if ($tld == "it") {
                 // Create a nicHandle for the Italian domain tld
                 $params[] = $this->session['id'];
                 // Session
                 $params[] = $profile['lastname'];
                 // Lastname
                 $params[] = $profile['firstname'];
                 // Firstname
                 $params[] = $profile['gender'];
                 // Gender
                 $params[] = $profile['password'];
                 // Password
                 $params[] = $profile['email'];
                 // Email
                 $params[] = $profile['phone'];
                 // Phone
                 $params[] = $profile['fax'];
                 // Fax
                 $params[] = $profile['address'];
                 // Address
                 $params[] = $profile['city'];
                 // City
                 $params[] = $profile['area'];
                 // Area
                 $params[] = $profile['zip'];
                 // Zip
                 $params[] = $profile['countrycode'];
                 // Country Code
                 $params[] = $profile['language'];
                 // Language
                 $params[] = $profile['isowner'];
                 // isOwner
                 $params[] = $profile['legalform'];
                 // Legalform
                 $params[] = $profile['company'];
                 // Organisation
                 $params[] = $profile['fullname'];
                 // Legal name
                 $params[] = $profile['legalnumber'];
                 // Legal Number
                 $params[] = $profile['vat'];
                 // VAT or IVA
                 $params[] = $profile['birthdate'];
                 // Birthday
                 $params[] = $profile['birthplace'];
                 // Birthcity
                 $params[] = $profile['taxpayernumber'];
                 // Contact fiscal code or company vat
                 $params[] = $profile['vat'];
                 // Company National Identification Number
                 $params[] = $profile['corporationtype'];
                 $nicHandle = call_user_func_array(array($soap, 'nicCreateIT'), $params);
                 Shineisp_Commons_Utilities::log('Calling profile nicCreateIT with these params: ' . json_encode($params), "registrar.ovh.log");
             } else {
                 $params[] = $this->session['id'];
                 // Session
                 $params[] = $profile['lastname'];
                 // Lastname
                 $params[] = $profile['firstname'];
                 // Firstname
                 $params[] = $profile['password'];
                 // Password
                 $params[] = $profile['email'];
                 // Email
                 $params[] = $profile['phone'];
                 // Phone
                 $params[] = $profile['fax'];
                 // Fax
                 $params[] = $profile['address'];
                 // Address
                 $params[] = $profile['city'];
                 // City
                 $params[] = $profile['area'];
                 // Area
                 $params[] = $profile['zip'];
                 // Zip
                 $params[] = $profile['countrycode'];
                 // Country Code
                 $params[] = $profile['language'];
                 // Language
                 $params[] = $profile['isowner'];
                 // isOwner
                 $params[] = $profile['legalform'];
                 // Legalform
                 $params[] = $profile['company'];
                 // Organisation
                 $params[] = $profile['fullname'];
                 // Legal name
                 $params[] = $profile['legalnumber'];
                 // Legal Number
                 $params[] = $profile['vat'];
                 // VAT or IVA
                 $nicHandle = call_user_func_array(array($soap, 'nicCreate'), $params);
                 Shineisp_Commons_Utilities::log('Calling profile nicCreate with these params: ' . json_encode($params), "registrar.ovh.log");
             }
             if (!empty($nicHandle)) {
                 CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle, $type, $profile['profile_id']);
                 // Save the nic-Handle in the database
             }
         } else {
             // If the client has not create any profile, the main client information will be set in all domain tld field [admin, tech, owner, billing]
             // Get the domain information
             $domain = Domains::find($domainId);
             // Create the OVH nic-Handle
             $nicHandle = $this->createNicHandlebyCustomer($domain[0]['customer_id'], $domainId);
             // Save the nic-Handle in the database
             CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle);
         }
         return $nicHandle;
     }
     return false;
 }