/** * {@inheritdoc} */ public function setOrder(OrderInterface $order = null) { $this->order = $order; if (null !== $order) { $this->state = $order->getState(); } }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, OrderInterface $order) { $paypal_config = $this->config('uc_paypal.settings'); if (\Drupal::moduleHandler()->moduleExists('uc_quote') && $paypal_config->get('ec_review_shipping') && $order->isShippable()) { uc_checkout_pane_quotes('prepare', $order, NULL); $order->line_items = $order->getLineItems(); $order->save(); $result = uc_checkout_pane_quotes('view', $order, NULL); $form['panes']['quotes'] = array('#type' => 'fieldset', '#title' => $this->t('Shipping cost')); $form['panes']['quotes'] += $result['contents']; unset($form['panes']['quotes']['quote_button']); $form['shippable'] = array('#type' => 'value', '#value' => 'true'); } if ($paypal_config->get('ec_review_company')) { $form['delivery_company'] = array('#type' => 'textfield', '#title' => $this->t('Company'), '#description' => $order->isShippable() ? $this->t('Leave blank if shipping to a residence.') : '', '#default_value' => $order->delivery_company); } if ($paypal_config->get('ec_review_phone')) { $form['delivery_phone'] = array('#type' => 'textfield', '#title' => $this->t('Contact phone number'), '#default_value' => $order->delivery_phone, '#size' => 24); } if ($paypal_config->get('ec_review_comment')) { $form['order_comments'] = array('#type' => 'textarea', '#title' => $this->t('Order comments'), '#description' => $this->t('Special instructions or notes regarding your order.')); } if (empty($form)) { $this->redirect('uc_cart.ec_submit'); } $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Continue checkout')); return $form; }
protected function recalculateAdjustable() { if (null !== $this->order) { $this->order->recalculateAdjustmentsTotal(); } elseif (null !== $this->orderItem) { $this->orderItem->recalculateAdjustmentsTotal(); } elseif (null !== $this->orderItemUnit) { $this->orderItemUnit->recalculateAdjustmentsTotal(); } }
protected function jsLoadBoard() { parent::jsLoadBoard(); if ($this->phase == 'Builds') { // Expand the allowed SupplyCenters array to include non-home SCs. libHTML::$footerIncludes[] = '../variants/Modern2/resources/supplycenterscorrect.js'; foreach (libHTML::$footerScript as $index => $script) { libHTML::$footerScript[$index] = str_replace('loadBoard();', 'loadBoard();SupplyCentersCorrect();', $script); } } }
protected function jsLoadBoard() { parent::jsLoadBoard(); if ($this->phase == 'Builds') { // Expand the allowed SupplyCenters array to include non-home SCs. libHTML::$footerIncludes[] = l_jf('../variants/BuildAnywhere/resources/supplycenterscorrect.js'); foreach (libHTML::$footerScript as $index => $script) { if (strpos($script, l_jf('loadBoard') . '();')) { libHTML::$footerScript[$index] = str_replace(l_jf('loadBoard') . '();', l_jf('loadBoard') . '();' . l_jf('SupplyCentersCorrect') . '();', $script); } } } }
private function loadOI($memberID, $countryID) { global $DB; $con = array(); $con['gameID'] = $this->id; $con['userID'] = 2; $con['variantID'] = 1; $con['memberID'] = $memberID; $con['turn'] = $this->turn; $con['phase'] = $this->phase; $con['countryID'] = $countryID; $con['orderStatus'] = 'Saved'; $con['tokenExpireTime'] = time() + 60 * 60 * 6; list($con['maxOrderID']) = $DB->sql_row("SELECT MAX(id)+100 FROM wD_Orders"); $con = OrderInterface::getContext($con); return OrderInterface::newJSON($con['key'], $con['json']); }
} else { $DB->sql_put("ROLLBACK"); } throw $e; } } } } } if ($Game instanceof processGame) { $Game = $Game->Variant->panelGameBoard($Game->id); $Game->Members->makeUserMember($User->id); $Member = $Game->Members->ByUserID[$User->id]; } if ('Pre-game' != $Game->phase && $Game->phase != 'Finished') { $OI = OrderInterface::newBoard(); $OI->load(); $Orders = '<div id="orderDiv' . $Member->id . '">' . $OI->html() . '</div>'; unset($OI); } } if ('Pre-game' != $Game->phase && (isset($Member) || $User->type['Moderator'])) { $CB = $Game->Variant->Chatbox(); // Now that we have retrieved the latest messages we can update the time we last viewed the messages // Post messages we sent, and get the user we're speaking to $msgCountryID = $CB->findTab(); $CB->postMessage($msgCountryID); $DB->sql_put("COMMIT"); $forum = $CB->output($msgCountryID); unset($CB); libHTML::$footerScript[] = 'makeFormsSafe();';
$likeMessageID = (int) $token[1]; $DB->sql_put("BEGIN"); list($likeExists) = $DB->sql_row("SELECT COUNT(*) FROM wD_LikePost WHERE userID = " . $userID . " AND likeMessageID = " . $likeMessageID); if ($likeExists == 0) { $DB->sql_put("UPDATE wD_ForumMessages SET likeCount = likeCount + 1 WHERE id = " . $likeMessageID); $DB->sql_put("INSERT INTO wD_LikePost ( userID, likeMessageID ) VALUES ( " . $userID . ", " . $likeMessageID . " )"); } else { $DB->sql_put("UPDATE wD_ForumMessages SET likeCount = likeCount - 1 WHERE id = " . $likeMessageID); $DB->sql_put("DELETE FROM wD_LikePost WHERE userID = " . $userID . " AND likeMessageID = " . $likeMessageID); } $DB->sql_put("COMMIT"); } } elseif (isset($_REQUEST['context']) && isset($_REQUEST['contextKey']) && isset($_REQUEST['orderUpdates'])) { require_once l_r('board/orders/orderinterface.php'); try { $O = OrderInterface::newJSON($_REQUEST['contextKey'], $_REQUEST['context']); $O->load(); $newReady = $oldReady = $O->orderStatus->Ready; if ($O->orderStatus->Ready && isset($_REQUEST['notready'])) { $newReady = $O->readyToggle(); } $O->set($_REQUEST['orderUpdates']); $O->validate(); if (!$O->orderStatus->Ready && isset($_REQUEST['ready'])) { $newReady = $O->readyToggle(); } $O->writeOrders(); $O->writeOrderStatus(); $DB->sql_put("COMMIT"); $results = $O->getResults(); if ($newReady && !$oldReady) {