if ($HTTP_VARS['attribute_ind_type'] == 'multi') { $HTTP_VARS['multi_attribute_ind'] = 'Y'; } } if ($HTTP_VARS['attribute_ind_type'] != 'lookup') { if ($HTTP_VARS['input_type'] == 'url') { $HTTP_VARS['file_attribute_ind'] = 'Y'; } } return $HTTP_VARS; } if ($HTTP_VARS['op'] == 'delete') { if (!is_exists_item_attribute_type(NULL, $HTTP_VARS['s_attribute_type'])) { if (!is_reserved_s_attribute_type($HTTP_VARS['s_attribute_type'])) { $s_field_type = fetch_attribute_type_s_field_type($HTTP_VARS['s_attribute_type']); if ($s_field_type == 'ADDRESS' && is_exists_addr_attribute_type_rltshp(NULL, $HTTP_VARS['s_attribute_type'])) { $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => 'Attribute is linked to at least one system address type'); $HTTP_VARS['op'] = ''; } else { if ($s_field_type == 'RATING') { $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => 'Attribute is reserved for ratings'); $HTTP_VARS['op'] = ''; } else { if ($s_field_type != 'ADDRESS' && $s_field_type != 'RATING' && is_exists_item_attribute_type(NULL, $HTTP_VARS['s_attribute_type'])) { $errors[] = array('error' => 'Attribute type not deleted.', 'detail' => 'Attribute is linked to at least one system item type'); $HTTP_VARS['op'] = ''; } else { if ($HTTP_VARS['confirmed'] == 'true') { if (delete_s_attribute_type($HTTP_VARS['s_attribute_type'])) { $HTTP_VARS['op'] = NULL; } else {
if (!update_s_addr_attribute_type_rltshp($HTTP_VARS['s_address_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['order_no'][$i], $HTTP_VARS['prompt'][$i], $HTTP_VARS['closed_ind'][$i])) { $errors[] = array('error' => 'Address Attribute type (' . $HTTP_VARS['s_attribute_type'][$i] . '[' . $HTTP_VARS['old_order_no'][$i] . ']) not updated', 'detail' => db_error()); } } } else { $errors[] = array('error' => 'Address Attribute type (' . $HTTP_VARS['s_attribute_type'][$i] . '[' . $HTTP_VARS['old_order_no'][$i] . ']) not found', 'detail' => db_error()); } } } // Now do the inserts. for ($i = 0; $i < count($HTTP_VARS['s_attribute_type']); $i++) { // Ignore elements that have no order_no or old_order_no specified. if ($HTTP_VARS['exists_ind'][$i] != 'Y') { if (strlen($HTTP_VARS['s_attribute_type'][$i]) > 0) { if (is_numeric($HTTP_VARS['old_order_no'][$i]) || is_numeric($HTTP_VARS['order_no'][$i])) { if (!is_exists_addr_attribute_type_rltshp($HTTP_VARS['s_address_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['order_no'][$i])) { if (!insert_s_addr_attribute_type_rltshp($HTTP_VARS['s_address_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['order_no'][$i], $HTTP_VARS['prompt'][$i], $HTTP_VARS['closed_ind'][$i])) { $errors[] = array('error' => 'Address Attribute type (' . $HTTP_VARS['s_attribute_type'][$i] . '[' . $HTTP_VARS['old_order_no'][$i] . ']) not inserted', 'detail' => db_error()); } } else { // Cache any records that could not be inserted. $saatr_already_exists[] = array('s_attribute_type' => $HTTP_VARS['s_attribute_type'][$i], 'order_no' => $HTTP_VARS['order_no'][$i], 'prompt' => $HTTP_VARS['prompt'][$i], 'compulsory_ind' => $HTTP_VARS['compulsory_ind'][$i]); } } else { $errors[] = array('error' => 'Item Attribute type (' . $HTTP_VARS['s_attribute_type'][$i] . ') not inserted', 'detail' => 'No order_no specified.'); } } //if(strlen($HTTP_VARS['s_attribute_type'][$i])>0) } } }