$delete = FALSE; } } if ($delete) { reset($site_item_attribute_type_rs); while (list(, $site_item_attribute_type_r) = each($site_item_attribute_type_rs)) { if (!delete_s_item_attribute_type($v_s_item_type, $site_item_attribute_type_r['s_attribute_type'], $site_item_attribute_type_r['order_no'])) { $errors[] = array('error' => 'System Item Attribute Type (s_item_type=' . $v_s_item_type . ', s_attribute_type=' . $site_item_attribute_type_r['s_attribute_type'] . ', order_no=' . $site_item_attribute_type_r['order_no'] . ') not deleted', 'detail' => db_error()); } } } } else { if ($value == 'include') { for ($i = 0; $i < count($site_attribute_type_r); $i++) { if (!is_exists_item_attribute_type($v_s_item_type, $site_attribute_type_r[$i], 0)) { if (!insert_s_item_attribute_type($v_s_item_type, $site_attribute_type_r[$i], 0, NULL, 'N', 'N', 'N', 'N')) { $errors[] = array('error' => 'System Item Attribute Type (s_item_type=' . $v_s_item_type . ', s_attribute_type=' . $site_item_attribute_type_r['s_attribute_type'] . ', order_no=' . $site_attribute_type_r['order_no'] . ') not inserted', 'detail' => db_error()); } } } } } } } } //if(is_not_empty_array($HTTP_VARS['s_item_type'])) // return to edit mode $HTTP_VARS['op'] = 'edit_site_plugin_item_types'; } else { //if(is_not_empty_array($site_attribute_type_r)) $errors[] = array('error' => 'Site Plugin attribute type\'s not found');
} else { //if(is_exists_item_attribute_type($HTTP_VARS['s_item_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['old_order_no'][$i])) $errors[] = array('error' => 'Item Attribute type (' . $HTTP_VARS['s_attribute_type'][$i] . '[' . $HTTP_VARS['old_order_no'][$i] . ']) not found', 'detail' => db_error()); } } //if($HTTP_VARS['exists_ind'][$i] == 'Y') } //for($i=0; $i<count($HTTP_VARS['s_attribute_type']); $i++) // 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_item_attribute_type($HTTP_VARS['s_item_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['order_no'][$i])) { if (!insert_s_item_attribute_type($HTTP_VARS['s_item_type'], $HTTP_VARS['s_attribute_type'][$i], $HTTP_VARS['order_no'][$i], $HTTP_VARS['prompt'][$i], $HTTP_VARS['instance_attribute_ind'][$i], $HTTP_VARS['compulsory_ind'][$i], $HTTP_VARS['rss_ind'][$i], $HTTP_VARS['printable_ind'][$i])) { $errors[] = array('error' => 'Item 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. $sait_already_exists[] = array('s_attribute_type' => $HTTP_VARS['s_attribute_type'][$i], 'order_no' => $HTTP_VARS['order_no'][$i], 'prompt' => $HTTP_VARS['prompt'][$i], 'instance_attribute_ind' => $HTTP_VARS['instance_attribute_ind'][$i], 'compulsory_ind' => $HTTP_VARS['compulsory_ind'][$i], 'rss_ind' => $HTTP_VARS['rss_ind'][$i], 'printable_ind' => $HTTP_VARS['printable_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) } } } } else {