Code Duplication    Length = 34-34 lines in 2 locations

checkout.php 2 locations

@@ 451-484 (lines=34) @@
448
        $xoopsTpl->assign('text', xoops_trim($text));
449
        break;
450
451
    case 'delivery' :
452
        if ($h_oledrion_caddy->isCartEmpty()) {
453
            Oledrion_utils::redirect(_OLEDRION_CART_IS_EMPTY, OLEDRION_URL, 4);
454
        }
455
        if ($commend_id == 0) {
456
            Oledrion_utils::redirect(_OLEDRION_ERROR20, OLEDRION_URL, 4);
457
        }
458
        // Check checkout level
459
        if ($checkout_level == 1) {
460
            Oledrion_utils::redirect(_OLEDRION_FINAL_CHECKOUT, OLEDRION_URL . 'checkout.php?op=confirm&commend_id=' . $commend_id, 1);
461
        }
462
        listCart();
463
        $commande    = $h_oledrion_commands->get($commend_id);
464
        $location_id = $commande->getVar('cmd_location_id');
465
        $deliveres   = $h_oledrion_delivery->getThisLocationDelivery($location_id);
466
467
        $sform = new XoopsThemeForm(_OLEDRION_DELIVERY_FORM, 'informationfrm', OLEDRION_URL . 'checkout.php', 'post');
468
        $sform->addElement(new XoopsFormHidden('op', 'save'));
469
        $sform->addElement(new XoopsFormHidden('action', 'delivery'));
470
        $sform->addElement(new XoopsFormHidden('commend_id', $commend_id));
471
        $delivery_options = new XoopsFormRadio(_OLEDRION_SELECT_DELIVERY, 'delivery_id');
472
        foreach ($deliveres as $delivery) {
473
            $delivery_options->addOption($delivery['delivery_id'], Oledrion_utils::deliveryHtmlSelect($delivery));
474
        }
475
        $sform->addElement($delivery_options, true);
476
        $sform->addElement(new XoopsFormButton('', 'post', _OLEDRION_SAVE_NEXT, 'submit'));
477
        $sform =& Oledrion_utils::formMarkRequiredFields($sform);
478
        $xoopsTpl->assign('form', $sform->render());
479
480
        // texte à afficher
481
        $registry = new oledrion_registryfile();
482
        $text     = $registry->getfile(OLEDRION_TEXTFILE6);
483
        $xoopsTpl->assign('text', xoops_trim($text));
484
        break;
485
486
    case 'payment' :
487
        if ($h_oledrion_caddy->isCartEmpty()) {
@@ 486-519 (lines=34) @@
483
        $xoopsTpl->assign('text', xoops_trim($text));
484
        break;
485
486
    case 'payment' :
487
        if ($h_oledrion_caddy->isCartEmpty()) {
488
            Oledrion_utils::redirect(_OLEDRION_CART_IS_EMPTY, OLEDRION_URL, 4);
489
        }
490
        if ($commend_id == 0) {
491
            Oledrion_utils::redirect(_OLEDRION_ERROR20, OLEDRION_URL, 4);
492
        }
493
        // Check checkout level
494
        if ($checkout_level == 1) {
495
            Oledrion_utils::redirect(_OLEDRION_FINAL_CHECKOUT, OLEDRION_URL . 'checkout.php?op=confirm&commend_id=' . $commend_id, 1);
496
        }
497
        listCart();
498
        $commande    = $h_oledrion_commands->get($commend_id);
499
        $delivery_id = $commande->getVar('cmd_delivery_id');
500
        $payments    = $h_oledrion_payment->getThisDeliveryPayment($delivery_id);
501
502
        $sform = new XoopsThemeForm(_OLEDRION_PAYMENT_FORM, 'informationfrm', OLEDRION_URL . 'checkout.php', 'post');
503
        $sform->addElement(new XoopsFormHidden('op', 'save'));
504
        $sform->addElement(new XoopsFormHidden('action', 'payment'));
505
        $sform->addElement(new XoopsFormHidden('commend_id', $commend_id));
506
        $payment_options = new XoopsFormRadio(_OLEDRION_SELECT_PAYMENT, 'payment_id');
507
        foreach ($payments as $payment) {
508
            $payment_options->addOption($payment['payment_id'], Oledrion_utils::paymentHtmlSelect($payment));
509
        }
510
        $sform->addElement($payment_options, true);
511
        $sform->addElement(new XoopsFormButton('', 'post', _OLEDRION_SAVE_CONFIRM, 'submit'));
512
        $sform =& Oledrion_utils::formMarkRequiredFields($sform);
513
        $xoopsTpl->assign('form', $sform->render());
514
515
        // texte à afficher
516
        $registry = new oledrion_registryfile();
517
        $text     = $registry->getfile(OLEDRION_TEXTFILE6);
518
        $xoopsTpl->assign('text', xoops_trim($text));
519
        break;
520
521
    // ****************************************************************************************************************
522
    case 'confirm' :