17 include_once (
"FDL/import_file.php");
20 $usage->setDefinitionText(
"to big importation");
26 $fdoc = fopen($cvsfile,
"r");
35 while (!feof($fdoc)) {
37 $buffer = rtrim(fgets($fdoc, 16384));
38 $data = explode(
";", $buffer);
41 if (
$data[0] ==
'ORDER') {
42 if (is_numeric(
$data[1])) $orfromid =
$data[1];
46 $ta = $cdoc->GetTitleAttributes();
47 $titles[$orfromid] = array();
48 foreach ($ta as $k => $v) {
49 $titles[$orfromid][] = $v->id;
52 foreach (
$idoc->fields as $k => $v) {
53 if ($cdoc->$v !=
"") $tval[$orfromid][$v] =
"'" . $cdoc->$v .
"'";
55 $tval[$orfromid][
"id"] =
"(select nextval ('seq_id_doc'))";
56 $tval[$orfromid][
"initid"] =
"(select currval ('seq_id_doc'))";
57 $tval[$orfromid][
"owner"] = $action->user->id;
58 }
else if (
$data[0] ==
'DOC') {
62 if (!isset($tval[$fromid])) {
63 print "-- order not defined for $fromid;\n";
67 $ini = $tval[$fromid];
70 foreach ($tcolorder[$fromid] as $k => $v) {
71 $ini[$v] =
"'" . pg_escape_string(
$data[$idx]) .
"'";
75 foreach ($titles[$orfromid] as $k => $v) {
76 $title.= substr($ini[$v], 1, -1) .
" ";
78 $ini[
"title"] =
"'" . pg_escape_string(trim(
$title)) .
"'";
80 $sval = implode($ini,
",");
81 $skey = implode(array_keys($ini) ,
",");
82 $sql = sprintf(
"INSERT INTO doc%d (%s) values (%s);\n", $fromid, $skey, $sval);
87 foreach ($titles as $fromid => $v) {
88 $sql = sprintf(
"select setval ('seq_doc%d',(select max(id) from doc%d));\n", $fromid, $fromid);
getOrder(array $orderdata)
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
getFamIdFromName($dbaccess, $name)
Verify arguments for wsh programs.