コード例 #1
0
ファイル: MeController.php プロジェクト: larryu/magento-b2b
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= 'pageJs.setCallbackId("changePwd", "' . $this->changePwdBtn->getUniqueID() . '");';
     $js .= 'pageJs.setCallbackId("changePersonInfo", "' . $this->changePersonInfoBtn->getUniqueID() . '");';
     return $js;
 }
コード例 #2
0
ファイル: ListController.php プロジェクト: larryu/magento-b2b
 /**
  * (non-PHPdoc)
  * @see CRUDPageAbstract::_getEndJs()
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= "pageJs.setCallbackId('genReportBtn', '" . $this->genReportBtn->getUniqueID() . "')";
     $js .= ".bindBtns();";
     return $js;
 }
コード例 #3
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     if (!($order = Order::get($this->Request['orderId'])) instanceof Order) {
         die('Invalid Order!');
     }
     if (trim($order->getType()) !== Order::TYPE_INVOICE) {
         header('Location: /order/' . $order->getId() . '.html?' . $_SERVER['QUERY_STRING']);
         die;
     }
     $js = parent::_getEndJs();
     $orderItems = $courierArray = array();
     foreach ($order->getOrderItems() as $orderItem) {
         $orderItems[] = $orderItem->getJson();
     }
     $purchaseEdit = $warehouseEdit = $accounEdit = $statusEdit = 'false';
     if ($order->canEditBy(Core::getRole())) {
         $statusEdit = $order->canEditBy(Core::getRole()) && Core::getRole()->getId() === trim(Role::ID_SYSTEM_ADMIN) ? 'true' : 'false';
         if (in_array(intval(Core::getRole()->getId()), array(Role::ID_SYSTEM_ADMIN, Role::ID_STORE_MANAGER, Role::ID_SALES))) {
             $purchaseEdit = $warehouseEdit = $accounEdit = 'true';
         } else {
             if (trim(Core::getRole()->getId()) === trim(Role::ID_PURCHASING)) {
                 $purchaseEdit = 'true';
             } else {
                 if (trim(Core::getRole()->getId()) === trim(Role::ID_WAREHOUSE)) {
                     $purchaseEdit = 'false';
                     $warehouseEdit = 'true';
                     $statusEdit = 'false';
                 }
             }
         }
     }
     if (in_array(intval(Core::getRole()->getId()), array(Role::ID_SYSTEM_ADMIN, Role::ID_STORE_MANAGER, Role::ID_ACCOUNTING, Role::ID_SALES))) {
         $accounEdit = 'true';
     }
     $orderArray = $order->getJson();
     $orderArray['childrenOrders'] = array_map(create_function('$a', 'return $a->getOrder()->getJson();'), OrderInfo::getAllByCriteria('typeId = ? and value = ?', array(OrderInfoType::ID_CLONED_FROM_ORDER_NO, trim($order->getOrderNo()))));
     $orderArray['creditNotes'] = array_map(create_function('$a', 'return $a->getJson();'), CreditNote::getAllByCriteria('orderId = ?', array(trim($order->getId()))));
     $orderStatuses = array_map(create_function('$a', 'return $a->getJson();'), OrderStatus::findAll());
     $courierArray = array_map(create_function('$a', 'return $a->getJson();'), Courier::findAll());
     $js .= 'pageJs';
     $js .= '.setCallbackId("updateOrder", "' . $this->updateOrderBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("changeOrderStatus", "' . $this->changeOrderStatusBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("updateOIForWH", "' . $this->updateOIForWHBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("updateShippingInfo", "' . $this->updateShippingInfoBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("clearETA", "' . $this->clearETABtn->getUniqueID() . '")';
     $js .= '.setCallbackId("changeIsOrdered", "' . $this->changeIsOrderedBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("updateAddress", "' . $this->updateAddressBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("updatePONo", "' . $this->updatePONoBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("changeShippingMethod", "' . $this->changeShippingMethodBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("updateSerials", "' . $this->updateSerialsBtn->getUniqueID() . '")';
     $js .= '.setEditMode(' . $purchaseEdit . ', ' . $warehouseEdit . ', ' . $accounEdit . ', ' . $statusEdit . ')';
     $js .= '.setOrder(' . json_encode($orderArray) . ', ' . json_encode($orderItems) . ', ' . json_encode($orderStatuses) . ', ' . OrderStatus::ID_SHIPPED . ')';
     $js .= '.setCourier(' . json_encode($courierArray) . ', ' . Courier::ID_LOCAL_PICKUP . ')';
     $js .= '.setCommentType("' . Comments::TYPE_PURCHASING . '", "' . Comments::TYPE_WAREHOUSE . '")';
     $js .= '.setOrderStatusIds([' . OrderStatus::ID_NEW . ', ' . OrderStatus::ID_INSUFFICIENT_STOCK . '], [' . OrderStatus::ID_ETA . ', ' . OrderStatus::ID_STOCK_CHECKED_BY_PURCHASING . ', ' . OrderStatus::ID_INSUFFICIENT_STOCK . '], [' . OrderStatus::ID_PICKED . '])';
     $js .= '.init("detailswrapper")';
     $js .= '.load();';
     return $js;
 }
コード例 #4
0
ファイル: Controller.php プロジェクト: larryu/magento-b2b
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= "pageJs";
     $js .= ".setCallbackId('searchOrders', '" . $this->searchOrdersBtn->getUniqueID() . "')";
     $js .= ".init('item-div');";
     return $js;
 }
コード例 #5
0
 /**
  * (non-PHPdoc)
  * @see CRUDPageAbstract::_getEndJs()
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= "pageJs.init()";
     $js .= ".setHTMLID('resultDiv', 'result-div')";
     $js .= ".setCallbackId('genReportmBtn', '" . $this->genReportmBtn->getUniqueID() . "')";
     return $js;
 }
コード例 #6
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= "pageJs";
     $js .= ".setCallbackId('getData', '" . $this->_getDataBtn->getUniqueID() . "')";
     $js .= ".setHTMLID('resultDivId', 'statics-div');";
     return $js;
 }
コード例 #7
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     if (!isset($this->Request['id'])) {
         die('System ERR: no param passed in!');
     }
     if (trim($this->Request['id']) === 'new') {
         $order = new Order();
     } else {
         if (!($order = Order::get($this->Request['id'])) instanceof Order) {
             die('Invalid Order!');
         }
     }
     if ($order instanceof Order && trim($order->getType()) === Order::TYPE_INVOICE) {
         header('Location: /orderdetails/' . $order->getId() . '.html?' . $_SERVER['QUERY_STRING']);
         die;
     }
     $cloneOrder = null;
     if (isset($_REQUEST['cloneorderid']) && !($cloneOrder = Order::get(trim($_REQUEST['cloneorderid']))) instanceof Order) {
         die('Invalid Order to clone from');
     }
     $paymentMethods = array_map(create_function('$a', 'return $a->getJson();'), PaymentMethod::getAll(true, null, DaoQuery::DEFAUTL_PAGE_SIZE, array('name' => 'asc')));
     $shippingMethods = array_map(create_function('$a', 'return $a->getJson();'), Courier::getAll(true, null, DaoQuery::DEFAUTL_PAGE_SIZE, array('name' => 'asc')));
     $customer = isset($_REQUEST['customerid']) && ($customer = Customer::get(trim($_REQUEST['customerid']))) instanceof Customer ? $customer->getJson() : null;
     $js .= "pageJs";
     $js .= ".setHTMLID('itemDiv', 'detailswrapper')";
     $js .= ".setHTMLID('searchPanel', 'search_panel')";
     $js .= ".setCallbackId('searchCustomer', '" . $this->searchCustomerBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('searchProduct', '" . $this->searchProductBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('saveOrder', '" . $this->saveOrderBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('cancelOrder', '" . $this->cancelOrderBtn->getUniqueID() . "')";
     $js .= ".setPaymentMethods(" . json_encode($paymentMethods) . ")";
     $js .= ".setShippingMethods(" . json_encode($shippingMethods) . ")";
     $js .= ".setOrderTypes(" . json_encode(Order::getAllTypes()) . ")";
     if ($cloneOrder instanceof Order) {
         $clonOrderArray = $cloneOrder->getJson();
         $clonOrderArray['items'] = array_map(create_function('$a', 'return $a->getJson();'), OrderItem::getAllByCriteria('orderId = ?', array($cloneOrder->getId())));
         $js .= ".setOriginalOrder(" . json_encode($clonOrderArray) . ")";
     }
     if ($order instanceof Order && trim($order->getId()) !== '') {
         $orderArray = $order->getJson();
         $orderArray['items'] = array_map(create_function('$a', 'return $a->getJson();'), OrderItem::getAllByCriteria('orderId = ?', array($order->getId())));
         $js .= ".setOrder(" . json_encode($orderArray) . ")";
     }
     $js .= ".init(" . json_encode($customer) . ")";
     if (!AccessControl::canAccessCreateOrderPage(Core::getRole())) {
         $js .= ".disableEverything(" . (in_array(Core::getRole()->getId(), array(Role::ID_ACCOUNTING, Role::ID_SALES, Role::ID_PURCHASING)) ? 'true' : '') . ")";
     } else {
         if ($order instanceof Order && trim($order->getId()) !== '' && intval($order->getStatus()->getId()) === OrderStatus::ID_CANCELLED) {
             $js .= ".disableEverything()";
             $js .= ".showModalBox('<h4>Error</h4>', '<h4>This " . $order->getType() . " has been " . $order->getStatus()->getName() . "!</h4><h4>No one can edit it anymore</h4>')";
         }
     }
     $js .= ";";
     return $js;
 }
コード例 #8
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= 'pageJs.setHtmlIDs("savePanel")';
     $js .= '.setCallbackId("saveUser", "' . $this->saveUserBtn->getUniqueID() . '")';
     $js .= '.setEditUrl("/useraccount/edit/{uid}.html")';
     $js .= '.load(' . json_encode($this->_getUser()) . ', ' . json_encode($this->_getRoles()) . ')';
     $js .= ';';
     return $js;
 }
コード例 #9
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $importDataTypes = array('myob_ean' => 'MYOB EAN', 'myob_upc' => 'MYOB UPC', 'stockAdjustment' => 'Stock Adjustment', 'accounting' => 'Accounting Code for Products', 'accountingCode' => 'Accounting Code for Categories');
     $js = parent::_getEndJs();
     $js .= 'pageJs';
     $js .= ".setHTMLID('importerDiv', 'importer_div')";
     $js .= ".setHTMLID('importDataTypesDropdownId', 'import_type_dropdown')";
     $js .= '.setCallbackId("getAllCodeForProduct", "' . $this->getAllCodeForProductBtn->getUniqueID() . '")';
     $js .= '.load(' . json_encode($importDataTypes) . ');';
     return $js;
 }
コード例 #10
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= 'pageJs.setResultDiv("resultDiv")';
     $js .= '.setTotalUserCountDiv("totalUsers")';
     $js .= '.setCallbackId("getUsers", "' . $this->getUsersBtn->getUniqueId() . '")';
     $js .= '.setCallbackId("deleteUser", "' . $this->deleteUserBtn->getUniqueId() . '")';
     $js .= '.setCallbackId("getRoles", "' . $this->getRolesBtn->getUniqueId() . '")';
     $js .= '.getUsers($("searchBtn"), true);';
     return $js;
 }
コード例 #11
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     // 		$js .= 'pageJs._infoTypes = {"custName": ' . OrderInfoType::ID_CUS_NAME. ', "custEmail" : ' . OrderInfoType::ID_CUS_EMAIL . ', "qty": ' . OrderInfoType::ID_QTY_ORDERED . '};';
     $js .= 'pageJs.setCallbackId("getOrderitems", "' . $this->getOrderItemsBtn->getUniqueID() . '")';
     $js .= '.init("resultDiv", "searchDiv")';
     $js .= '.setSearchCriteria(' . json_encode($this->_getViewPreference()) . ')';
     $js .= '.getSearchCriteria()';
     $js .= '.getResults(true, ' . DaoQuery::DEFAUTL_PAGE_SIZE . ');';
     // 		$js .= '$("searchBtn").click();';
     return $js;
 }
コード例 #12
0
 /**
  * (non-PHPdoc)
  * @see BPCPageAbstract::_getEndJs()
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $pageSize = 30;
     $js .= 'pageJs._resultDivId = "resultDiv";';
     $js .= 'pageJs._pageInfo.pageSize = ' . $pageSize . ';';
     $js .= 'pageJs.setCallbackId("getPriceMatchCompany", "' . $this->getPriceMatchCompanyBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("updatePriceMatchCompany", "' . $this->updatePriceMatchCompanyBtn->getUniqueID() . '")';
     $js .= '.setCallbackId("deleteAliasForPriceMatchCompany", "' . $this->deleteAliasForPriceMatchCompanyBtn->getUniqueID() . '")';
     $js .= '.displayAllPriceMatchCompany();';
     return $js;
 }
コード例 #13
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $companyArray = PriceMatcher::getAllCompaniesForPriceMatching();
     if (count(array_keys($companyArray)) === 0) {
         die('No Price Match Company Set up. Please set up the Price Matching companies before using this page!!!!!');
     }
     $js = parent::_getEndJs();
     // Setup the dnd listeners.
     $js .= 'pageJs.setCallbackId("getAllPricesForProduct", "' . $this->getAllPricesForProductBtn->getUniqueID() . '")';
     $js .= '.load("price_match_div", ' . json_encode($companyArray) . ');';
     return $js;
 }
コード例 #14
0
ファイル: ListController.php プロジェクト: larryu/magento-b2b
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= "pageJs";
     $js .= ".setHTMLID('itemDiv', 'detailswrapper')";
     $js .= ".setHTMLID('searchPanel', 'search_panel')";
     $js .= ".setHTMLID('productsTable', 'products_table')";
     $js .= ".setHTMLID('barcodeInput', 'barcode_input')";
     $js .= ".setCallbackId('searchProduct', '" . $this->searchProductBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('saveQuantities', '" . $this->saveQuantitiesBtn->getUniqueID() . "')";
     $js .= ".init();";
     return $js;
 }
コード例 #15
0
 /**
  * (non-PHPdoc)
  * @see TControl::onInit()
  */
 public function onInit($param)
 {
     parent::onInit($param);
     $scriptArray = BPCPageAbstract::getLastestJS(get_class($this));
     foreach ($scriptArray as $key => $value) {
         if (($value = trim($value)) !== '') {
             if ($key === 'js') {
                 $this->getPage()->getClientScript()->registerScriptFile(__CLASS__ . 'Js', $this->publishAsset($value));
             } else {
                 if ($key === 'css') {
                     $this->getPage()->getClientScript()->registerStyleSheetFile(__CLASS__ . 'Css', $this->publishAsset($value));
                 }
             }
         }
     }
 }
コード例 #16
0
 /**
  * (non-PHPdoc)
  * @see BPCPageAbstract::onLoad()
  */
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (!$this->isPostBack) {
         $this->order = Order::get($this->Request['orderId']);
         if (!$this->order instanceof Order) {
             die('Invalid Order!');
         }
         if (isset($_REQUEST['pdf']) && intval($_REQUEST['pdf']) === 1) {
             $file = EntityToPDF::getPDF($this->order, 'docket');
             header('Content-Type: application/pdf');
             // The PDF source is in original.pdf
             readfile($file);
             die;
         }
     }
 }
コード例 #17
0
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (Core::getUser() instanceof UserAccount) {
         $this->getResponse()->redirect('/');
     }
     $cScripts = BPCPageAbstract::getLastestJS(get_class($this));
     if (isset($cScripts['js']) && ($lastestJs = trim($cScripts['js'])) !== '') {
         $this->getPage()->getClientScript()->registerScriptFile('pageJs', $this->publishAsset($lastestJs));
     }
     if (isset($cScripts['css']) && ($lastestCss = trim($cScripts['css'])) !== '') {
         $this->getPage()->getClientScript()->registerStyleSheetFile('pageCss', $this->publishAsset($lastestCss));
     }
     if (!$this->IsPostBack) {
         $this->username->focus();
         $this->errorDiv->visible = false;
     }
 }
コード例 #18
0
ファイル: POController.php プロジェクト: larryu/magento-b2b
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $class = get_called_class();
     $js = $this->_getJSPrefix();
     $js .= parent::_getEndJs();
     $paymentMethods = array_map(create_function('$a', 'return $a->getJson();'), PaymentMethod::getAll());
     $shippingMethods = array_map(create_function('$a', 'return $a->getJson();'), Courier::getAll());
     $supplier = isset($_REQUEST['supplierid']) && ($supplier = Supplier::get(trim($_REQUEST['supplierid']))) instanceof Supplier ? $supplier->getJson() : null;
     $js .= "pageJs";
     $js .= ".setHTMLID('itemDiv', 'detailswrapper')";
     $js .= ".setHTMLID('searchPanel', 'search_panel')";
     $js .= ".setCallbackId('searchSupplier', '" . $this->searchSupplierBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('searchProduct', '" . $this->searchProductBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('saveOrder', '" . $this->saveOrderBtn->getUniqueID() . "')";
     $js .= ".setPaymentMethods(" . json_encode($paymentMethods) . ")";
     $js .= ".setShippingMethods(" . json_encode($shippingMethods) . ")";
     $js .= ".init(" . json_encode($supplier) . ");";
     return $js;
 }
コード例 #19
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $class = trim($this->_focusEntity);
     if ($class === '' || !isset($this->Request['id'])) {
         die('System Error: no id or class passed in');
     }
     if (trim($this->Request['id']) === 'new') {
         $entity = new $class();
     } else {
         if (!($entity = $class::get($this->Request['id'])) instanceof $class) {
             die('invalid item!');
         }
     }
     $js .= "pageJs.setHTMLID('itemDiv', 'item-div')";
     $js .= ".setItem(" . (trim($entity->getId()) === '' ? '{}' : json_encode($entity->getJson())) . ")";
     $js .= ".setCallbackId('saveItem', '" . $this->_saveItemBtn->getUniqueID() . "');";
     return $js;
 }
コード例 #20
0
ファイル: jsSaveAs.php プロジェクト: larryu/magento-b2b
 /**
  * (non-PHPdoc)
  * @see TControl::onLoad()
  */
 public function onLoad($param)
 {
     $clientScript = $this->getPage()->getClientScript();
     if (!$this->getPage()->IsPostBack || !$this->getPage()->IsCallback) {
         $className = get_class($this);
         $scriptArray = BPCPageAbstract::getLastestJS($className);
         foreach ($scriptArray as $key => $value) {
             if (($value = trim($value)) !== '') {
                 if ($key === 'js') {
                     $this->getPage()->getClientScript()->registerScriptFile($className . 'JS', $this->publishAsset($value));
                 } else {
                     if ($key === 'css') {
                         $this->getPage()->getClientScript()->registerStyleSheetFile($className . 'CSS', $this->publishAsset($value));
                     }
                 }
             }
         }
     }
 }
コード例 #21
0
ファイル: Controller.php プロジェクト: larryu/magento-b2b
 /**
  * (non-PHPdoc)
  * @see BPCPageAbstract::onLoad()
  */
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (!$this->isPostBack) {
         $this->kit = Kit::get($this->Request['kitId']);
         if (!$this->kit instanceof Kit) {
             die('Invalid Kit!');
         }
         if (isset($_REQUEST['pdf']) && intval($_REQUEST['pdf']) === 1) {
             $file = EntityToPDF::getPDF($this->kit);
             header('Content-Type: application/pdf');
             // The PDF source is in original.pdf
             readfile($file);
             die;
         }
         if (isset($_REQUEST['printlater']) && intval($_REQUEST['printlater']) === 1) {
             $this->getClientScript()->registerEndScript('printlater', 'window.print();');
         }
     }
 }
コード例 #22
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     if (!isset($this->Request['id'])) {
         die('System ERR: no param passed in!');
     }
     if (!($creditNote = CreditNote::get($this->Request['id'])) instanceof CreditNote && trim($this->Request['id']) !== 'new') {
         die('Invalid CreditNote passed in!');
     }
     $js = parent::_getEndJs();
     $customer = isset($_REQUEST['customerid']) && ($customer = Customer::get(trim($_REQUEST['customerid']))) instanceof Customer ? $customer->getJson() : null;
     $order = null;
     if (isset($_REQUEST['orderid']) && !($order = Order::get(trim($_REQUEST['orderid']))) instanceof Order) {
         die('Invalid Order passed in!');
     }
     if ($order instanceof Order && $creditNote instanceof CreditNote && $creditNote->getOrder() instanceof Order && $creditNote->getOrder()->getId() !== $order->getId()) {
         die('You can ONLY create NEW Credit Note from an existing ORDER');
     }
     if ($order instanceof Order && intval($order->getStatus()->getId()) === OrderStatus::ID_CANCELLED) {
         die('You can NOT create a credit note against a CANCELED order(OrderNo: ' . $order->getOrderNo() . ')');
     }
     if ($creditNote instanceof CreditNote) {
         $js .= "pageJs._creditNote=" . json_encode($creditNote->getJson(array('customer' => $creditNote->getCustomer()->getJson(), 'items' => array_map(create_function('$a', 'return $a->getJson(array("product"=>$a->getProduct()->getJson()));'), $creditNote->getCreditNoteItems())))) . ";";
     }
     if ($order instanceof Order) {
         $js .= "pageJs._order=" . json_encode($order->getJson(array('customer' => $order->getCustomer()->getJson(), 'items' => array_map(create_function('$a', 'return $a->getJson(array("product"=>$a->getProduct()->getJson()));'), $order->getOrderItems())))) . ";";
     } else {
         $js .= "pageJs._customer=" . json_encode($customer) . ";";
     }
     $paymentMethods = array_map(create_function('$a', 'return $a->getJson();'), PaymentMethod::getAll(true, null, DaoQuery::DEFAUTL_PAGE_SIZE, array('name' => 'asc')));
     $applyToOptions = CreditNote::getApplyToTypes();
     $js .= "pageJs._applyToOptions=" . json_encode($applyToOptions) . ";";
     $js .= "pageJs";
     $js .= ".setHTMLID('itemDiv', 'detailswrapper')";
     $js .= ".setHTMLID('searchPanel', 'search_panel')";
     $js .= ".setCallbackId('searchCustomer', '" . $this->searchCustomerBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('searchProduct', '" . $this->searchProductBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('saveOrder', '" . $this->saveOrderBtn->getUniqueID() . "')";
     $js .= ".setPaymentMethods(" . json_encode($paymentMethods) . ")";
     $js .= ".init();";
     return $js;
 }
コード例 #23
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= "pageJs";
     $js .= ".setHTMLID('itemDiv', 'detailswrapper')";
     $js .= ".setHTMLID('searchPanel', 'search_panel')";
     $js .= ".setHTMLID('paymentPanel', 'payment_panel')";
     $js .= ".setHTMLID('supplierInfoPanel', 'supplier_info_panel')";
     $js .= ".setHTMLID('partsTable', 'order_change_details_table')";
     $js .= ".setHTMLID('barcodeInput', 'barcode_input')";
     $js .= ".setCallbackId('searchPO', '" . $this->searchPOBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('searchProduct', '" . $this->searchProductBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('saveOrder', '" . $this->saveOrderBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('checkProduct', '" . $this->checkProductBtn->getUniqueID() . "')";
     if (isset($this->Request['poid']) && ($po = PurchaseOrder::get($this->Request['poid'])) instanceof PurchaseOrder) {
         $js .= ".init(" . json_encode($this->_getPOJson($po)) . ");";
     } else {
         $js .= ".init();";
     }
     return $js;
 }
コード例 #24
0
 /**
  * (non-PHPdoc)
  * @see TControl::onInit()
  */
 public function onInit($param)
 {
     parent::onInit($param);
     $scriptArray = BPCPageAbstract::getLastestJS(get_class($this));
     foreach ($scriptArray as $key => $value) {
         if (($value = trim($value)) !== '') {
             if ($key === 'js') {
                 $this->getPage()->getClientScript()->registerScriptFile('PaymentListPanelJs', $this->publishAsset($value));
             } else {
                 if ($key === 'css') {
                     $this->getPage()->getClientScript()->registerStyleSheetFile('PaymentListPanelCss', $this->publishAsset($value));
                 }
             }
         }
     }
     if (!$this->getPage()->IsCallBack && !$this->getPage()->IsPostBack) {
         $js = 'if(typeof(PaymentListPanelJs) !== "undefined") {';
         $js .= 'PaymentListPanelJs.callbackIds = ' . json_encode(array('getPayments' => $this->getPaymentsBtn->getUniqueID(), 'delPayment' => $this->delPaymentBtn->getUniqueID(), 'addPayment' => $this->addPaymentBtn->getUniqueID())) . ';';
         $js .= '}';
         $this->getPage()->getClientScript()->registerEndScript('plpJs', $js);
     }
 }
コード例 #25
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $systemSetting = SystemSettings::getByType(SystemSettings::TYPE_SYSTEM_BUILD_PRODUCTS_ID);
     $products = array();
     if ($systemSetting instanceof SystemSettings) {
         foreach (json_decode($systemSetting->getValue()) as $type => $ids) {
             $products[$type] = array();
             foreach ($ids as $id) {
                 if (($product = Product::get($id)) instanceof Product) {
                     $products[$type][] = $product->getJson();
                 }
             }
         }
     }
     $js = parent::_getEndJs();
     $js .= 'pageJs.resultDivId = "resultDiv";';
     $js .= 'pageJs.downloadBtnId = "download-btn";';
     $js .= 'pageJs.products = ' . json_encode($products) . ';';
     $js .= "pageJs.setCallbackId('updateSetting', '" . $this->updateSettingBtn->getUniqueID() . "');";
     $js .= 'pageJs.init();';
     return $js;
 }
コード例 #26
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     if (!isset($this->Request['id'])) {
         die('System ERR: no param passed in!');
     }
     if (!($rma = RMA::get($this->Request['id'])) instanceof RMA && trim($this->Request['id']) !== 'new') {
         die('Invalid $rma passed in!');
     }
     $js = parent::_getEndJs();
     $customer = isset($_REQUEST['customerid']) && ($customer = Customer::get(trim($_REQUEST['customerid']))) instanceof Customer ? $customer->getJson() : null;
     if (isset($_REQUEST['orderid']) && !($order = Order::get(trim($_REQUEST['orderid']))) instanceof Order) {
         die('Invalid Order passed in!');
     }
     if (isset($_REQUEST['orderid']) && ($order = Order::get(trim($_REQUEST['orderid']))) instanceof Order && $rma instanceof RMA) {
         die('You can ONLY create NEW Credit Note from an existing ORDER');
     }
     $statusOptions = RMA::getAllStatuses();
     if (isset($_REQUEST['orderid']) && ($order = Order::get(trim($_REQUEST['orderid']))) instanceof Order) {
         $js .= "pageJs._order=" . json_encode($order->getJson(array('customer' => $order->getCustomer()->getJson(), 'items' => array_map(create_function('$a', 'return $a->getJson(array("product"=>$a->getProduct()->getJson()));'), $order->getOrderItems())))) . ";";
     } else {
         $js .= "pageJs._customer=" . json_encode($customer) . ";";
     }
     if ($rma instanceof RMA) {
         $js .= "pageJs._RMA=" . json_encode($rma->getJson(array('customer' => $rma->getCustomer()->getJson(), 'items' => array_map(create_function('$a', 'return $a->getJson(array("product"=>$a->getProduct()->getJson()));'), $rma->getRMAItems())))) . ";";
     }
     $js .= "pageJs._statusOptions=" . json_encode($statusOptions) . ";";
     $js .= "pageJs";
     $js .= ".setHTMLID('itemDiv', 'detailswrapper')";
     $js .= ".setHTMLID('searchPanel', 'search_panel')";
     $js .= ".setCallbackId('searchCustomer', '" . $this->searchCustomerBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('searchProduct', '" . $this->searchProductBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('saveOrder', '" . $this->saveOrderBtn->getUniqueID() . "')";
     $js .= '.setCallbackId("addComments", "' . $this->addCommentsBtn->getUniqueID() . '")';
     $js .= ".init();";
     return $js;
 }
コード例 #27
0
ファイル: HomeController.php プロジェクト: larryu/magento-b2b
 /**
  * (non-PHPdoc)
  * @see BPCPageAbstract::onLoad()
  */
 public function onLoad($param)
 {
     parent::onLoad($param);
 }
コード例 #28
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $js = parent::_getEndJs();
     $js .= "pageJs.setCallbackId('getItems', '" . $this->_getItemsBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('deleteItems', '" . $this->_delItemsBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('saveItem', '" . $this->_saveItemsBtn->getUniqueID() . "')";
     $js .= ".setHTMLIds('item-list', 'searchPanel', 'total-found-count');";
     $js .= "if(pageJs.init) {pageJs.init();}";
     $js .= "pageJs.getSearchCriteria();";
     //$js .= ".getResults(true, " . $this->pageSize . ")";
     return $js;
 }