Code Duplication    Length = 23-23 lines in 2 locations

invoice.php 2 locations

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