Code Duplication    Length = 23-23 lines in 2 locations

invoice.php 2 locations

@@ 97-119 (lines=23) @@
94
        $handlers = OledrionHandler::getInstance();
95
96
        // Boucle sur le caddy ************************************************************************************************
97
        foreach ($caddy as $itemCaddy) {
98
            $productForTemplate = $tblJoin = $productManufacturers = $productAttributes = array();
99
            $product            = $products[$itemCaddy->getVar('caddy_product_id')];
100
            $productForTemplate = $product->toArray(); // Produit
101
            // Est-ce qu'il y a des attributs ?
102
            if ($handlers->h_oledrion_caddy_attributes->getAttributesCountForCaddy($itemCaddy->getVar('caddy_id')) > 0) {
103
                $productAttributes = $handlers->h_oledrion_caddy_attributes->getFormatedAttributesForCaddy($itemCaddy->getVar('caddy_id'), $product);
104
            }
105
            $productForTemplate['product_attributes'] = $productAttributes;
106
107
            $productManufacturers = $productsManufacturers[$product->getVar('product_id')];
108
            foreach ($productManufacturers as $oledrion_productsmanu) {
109
                if (isset($manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')])) {
110
                    $manufacturer = $manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')];
111
                    $tblJoin[]    = $manufacturer->getVar('manu_commercialname') . ' ' . $manufacturer->getVar('manu_name');
112
                }
113
            }
114
            if (count($tblJoin) > 0) {
115
                $productForTemplate['product_joined_manufacturers'] = implode(', ', $tblJoin);
116
            }
117
            $productForTemplate['product_caddy'] = $itemCaddy->toArray();
118
            $xoopsTpl->append('products', $productForTemplate);
119
        }
120
        // Display print page
121
        echo $xoopsTpl->fetch(OLEDRION_PATH . '/templates/oledrion_bill_print.tpl');
122
        break;
@@ 140-162 (lines=23) @@
137
        $handlers = OledrionHandler::getInstance();
138
139
        // Boucle sur le caddy ************************************************************************************************
140
        foreach ($caddy as $itemCaddy) {
141
            $productForTemplate = $tblJoin = $productManufacturers = $productAttributes = array();
142
            $product            = $products[$itemCaddy->getVar('caddy_product_id')];
143
            $productForTemplate = $product->toArray(); // Produit
144
            // Est-ce qu'il y a des attributs ?
145
            if ($handlers->h_oledrion_caddy_attributes->getAttributesCountForCaddy($itemCaddy->getVar('caddy_id')) > 0) {
146
                $productAttributes = $handlers->h_oledrion_caddy_attributes->getFormatedAttributesForCaddy($itemCaddy->getVar('caddy_id'), $product);
147
            }
148
            $productForTemplate['product_attributes'] = $productAttributes;
149
150
            $productManufacturers = $productsManufacturers[$product->getVar('product_id')];
151
            foreach ($productManufacturers as $oledrion_productsmanu) {
152
                if (isset($manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')])) {
153
                    $manufacturer = $manufacturers[$oledrion_productsmanu->getVar('pm_manu_id')];
154
                    $tblJoin[]    = $manufacturer->getVar('manu_commercialname') . ' ' . $manufacturer->getVar('manu_name');
155
                }
156
            }
157
            if (count($tblJoin) > 0) {
158
                $productForTemplate['product_joined_manufacturers'] = implode(', ', $tblJoin);
159
            }
160
            $productForTemplate['product_caddy'] = $itemCaddy->toArray();
161
            $xoopsTpl->append('products', $productForTemplate);
162
        }
163
164
        Oledrion_utils::setCSS();
165
        Oledrion_utils::setLocalCSS($xoopsConfig['language']);