} $rv = deleteRectypeGroup($rtgID); if (!array_key_exists('error', $rv)) { $rv['rectypes'] = getAllRectypeStructures(); } break; case 'saveDTG': // Field (detail) type group if (!array_key_exists('dettypegroups', $data) || !array_key_exists('colNames', $data['dettypegroups']) || !array_key_exists('defs', $data['dettypegroups'])) { error_exit("Invalid data structure sent with saveDetailTypeGroup method call to saveStructure.php"); } $colNames = $data['dettypegroups']['colNames']; foreach ($data['dettypegroups']['defs'] as $dtgID => $rt) { if ($dtgID == -1) { // new dettype group array_push($rv, createDettypeGroups($colNames, $rt)); } else { array_push($rv, updateDettypeGroup($colNames, $dtgID, $rt)); } } if (!array_key_exists('error', $rv)) { $rv['detailTypes'] = getAllDetailTypeStructures(); } break; case 'deleteDTG': $dtgID = @$_REQUEST['dtgID']; if (!$dtgID) { error_exit("Invalid or no detail type group ID sent with deleteDetailType method call to saveStructure.php"); } $rv = deleteDettypeGroup($dtgID); if (!array_key_exists('error', $rv)) {
$src_group = $group; $grp_name = $src_group['name']; break; } } //get name and try to find in target $isNotFound = true; foreach ($trg_fieldtypes['groups'] as $idx => $group) { if (is_numeric($idx) && trim($group['name']) == trim($grp_name)) { $group_ft_ids[$grp_id] = $group['id']; $isNotFound = false; break; } } if ($isNotFound) { $res = createDettypeGroups($columnNames, array(array("values" => array($grp_name, $src_group['order'], $src_group['description'])))); $new_grp_id = @$res['result']; if (is_numeric($new_grp_id)) { $group_ft_ids[$grp_id] = $new_grp_id; $trg_fieldtypes['groups'][$new_grp_id] = array('name' => $grp_name); } else { error_exit("Can't add field type group for '" . $grp_name . "'. " . $res['error']); } } } // ------------------------------------------------------------------------------------------------ // V. Add field types $columnNames = $def_dts['commonFieldNames']; array_shift($columnNames); //remove dty_ID $idx_type = $def_dts['fieldNamesToIndex']['dty_Type'];