function mainCopy($recnoSource, $defaultValueMd = array()) { $rs = array(); $rs['akce'] = 'error'; $rs['ok'] = FALSE; $rs['report'] = ''; $rs['data'] = ''; $defaultEditGroup = array_key_exists('edit_group', $defaultValue) === TRUE ? $defaultValue['edit_group'] : MICKA_USER; $defaultViewGroup = array_key_exists('view_group', $defaultValue) === TRUE ? $defaultValue['view_group'] : MICKA_USER; $md_record = new MdRecord(); $md_record->setDefaultValueMd($defaultValueMd); $copy = $md_record->copyRecordToTmp($recnoSource, $new_record = TRUE); if ($copy['recno_tmp'] < 0 || $copy['report'] != 'ok') { $rs['report'] = $copy['report']; //return $rs; require PHPINC_DIR . '/templates/404_record.php'; } else { $rs['akce'] = 'edit'; $rs['ok'] = TRUE; $rs['data'] = $copy['recno_tmp']; unset($md_record); //return $rs; setEditId2Session('recno', 'new'); setEditId2Session('recnoTmp', $copy['recno_tmp']); $redirectUrl = substr(htmlspecialchars($_SERVER['PHP_SELF']), 0, strrpos($_SERVER['PHP_SELF'], '/')) . '?ak=edit&recno=new'; setUrlEdit2Session($redirectUrl); return $redirectUrl; } }