Example #1
0
 /**
  * Prepare child blocks
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     $onclick = "submitAndReloadArea(\$('creditmemo_item_container'),'" . $this->getUpdateUrl() . "')";
     $this->addChild('update_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Update Qty\'s'), 'class' => 'update-button', 'onclick' => $onclick]);
     if ($this->getCreditmemo()->canRefund()) {
         if ($this->getCreditmemo()->getInvoice() && $this->getCreditmemo()->getInvoice()->getTransactionId()) {
             $this->addChild('submit_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Refund'), 'class' => 'save submit-button refund primary', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemo()']);
         }
         $this->addChild('submit_offline', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Refund Offline'), 'class' => 'save submit-button primary', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemoOffline()']);
     } else {
         $this->addChild('submit_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Refund Offline'), 'class' => 'save submit-button primary', 'onclick' => 'disableElements(\'submit-button\');submitCreditMemoOffline()']);
     }
     return parent::_prepareLayout();
 }
Example #2
0
 /**
  * Prepare child blocks
  *
  * @return $this
  */
 protected function _beforeToHtml()
 {
     $onclick = "submitAndReloadArea(\$('invoice_item_container'),'" . $this->getUpdateUrl() . "')";
     $this->addChild('update_button', 'Magento\\Backend\\Block\\Widget\\Button', ['class' => 'update-button', 'label' => __('Update Qty\'s'), 'onclick' => $onclick]);
     $this->_disableSubmitButton = true;
     $submitButtonClass = ' disabled';
     foreach ($this->getInvoice()->getAllItems() as $item) {
         /**
          * @see bug #14839
          */
         if ($item->getQty()) {
             $this->_disableSubmitButton = false;
             $submitButtonClass = '';
             break;
         }
     }
     if ($this->getOrder()->getForcedShipmentWithInvoice()) {
         $_submitLabel = __('Submit Invoice and Shipment');
     } else {
         $_submitLabel = __('Submit Invoice');
     }
     $this->addChild('submit_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => $_submitLabel, 'class' => 'save submit-button primary' . $submitButtonClass, 'onclick' => 'disableElements(\'submit-button\');$(\'edit_form\').submit()', 'disabled' => $this->_disableSubmitButton]);
     return parent::_prepareLayout();
 }