Projet

Général

Profil

Révision b858700c

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/commerce/modules/checkout/includes/commerce_checkout.admin.inc
398 398

  
399 399
  return $content;
400 400
}
401

  
402
/**
403
 * Form callback: confirmation form for manually invoking the checkout
404
 * completion event for an order.
405
 *
406
 * @param $order
407
 *   The order object to process checkout completion on.
408
 *
409
 * @return
410
 *   The form array to confirm the process.
411
 *
412
 * @see confirm_form()
413
 */
414
function commerce_checkout_complete_form($form, &$form_state, $order) {
415
  $form['order_id'] = array(
416
    '#type' => 'value',
417
    '#value' => $order->order_id,
418
  );
419

  
420
  // Build a description of what the user may expect to occur on submission.
421
  $items = array(
422
    t('The normal checkout completion process will be invoked on this order.'),
423
    t('This may involve order status updates and e-mail notifications.'),
424
  );
425

  
426
  $form = confirm_form($form,
427
    t('Are you sure you want to simulate checkout completion for order @number?', array('@number' => $order->order_number)),
428
    'admin/commerce/orders/' . $order->order_id . '/edit',
429
    '<p>' . theme('item_list', array('items' => $items)) . '</p>',
430
    t('Simulate checkout completion'),
431
    t('Cancel')
432
  );
433

  
434
  return $form;
435
}
436

  
437
/**
438
 * Form submit callback for commerce_checkout_complete_form().
439
 */
440
function commerce_checkout_complete_form_submit($form, &$form_state) {
441
  if ($order = commerce_order_load($form_state['values']['order_id'])) {
442
    commerce_checkout_complete($order);
443
    drupal_set_message(t('Checkout completion rules have been executed for the order.'));
444
    $form_state['redirect'] = 'admin/commerce/orders/' . $order->order_id . '/edit';
445
  }
446
  else {
447
    drupal_set_message(t('Order not found.'), 'error');
448
    $form_state['redirect'] = 'admin/commerce/orders';
449
  }
450
}

Formats disponibles : Unified diff