Code Duplication    Length = 34-34 lines in 2 locations

checkout.php 2 locations

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