Code Duplication    Length = 3-5 lines in 3 locations

includes/librairies/install.class.php 1 location

@@ 485-487 (lines=3) @@
482
                    if (($option_list_for_attribute != '') && (is_array($option_list_for_attribute))) {
483
                        foreach ($option_list_for_attribute as $option_code => $option_value) {
484
                            $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('status' => 'valid', 'creation_date' => current_time('mysql', 0), 'attribute_id' => $attribute_id, 'label' => ((substr($option_code, 0, 2) != '__') ? $option_value : __(substr($option_code, 2), 'wpshop')), 'value' => $option_value));
485
                            if ($option_code == $attribute_def['default_value']) {
486
                                $wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('last_update_date' => current_time('mysql', 0), 'default_value' => $wpdb->insert_id), array('id' => $attribute_id, 'default_value' => $option_code));
487
                            }
488
                        }
489
                    }
490
                }

includes/librairies/eav/attributes.class.php 2 locations

@@ 398-402 (lines=5) @@
395
							}
396
						}
397
398
						if($default_value == $option_key) {
399
							/*	Update an existing a only if the value does not exist into existing list	*/
400
							$wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('last_update_date' => current_time('mysql', 0), 'default_value' => $option_key), array('id' => $id));
401
							$done_options_value[] = str_replace(",", ".", $option_value);
402
						}
403
						$i++;
404
					}
405
				}
@@ 426-430 (lines=5) @@
423
							$done_options_value[] = str_replace(",", ".", $option_value);
424
							$last_insert_id = $wpdb->insert_id;
425
426
							if (empty($default_value)) {
427
								/*	Update an existing a only if the value does not exist into existing list	*/
428
								$wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('last_update_date' => current_time('mysql', 0), 'default_value' => $last_insert_id), array('id' => $id));
429
								$done_options_value[] = str_replace(",", ".", $option_value);
430
							}
431
432
						}
433
						$i++;