<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>I am trying to import departments into librecat using the methods
documented here:
<a class="moz-txt-link-freetext" href="https://github.com/LibreCat/LibreCat/wiki/Import-Departments">https://github.com/LibreCat/LibreCat/wiki/Import-Departments</a> </p>
<p>First I tried using the 'tree' method but it did not work. My
yaml syntax looks good and I even tried to do an import of the
example in the documentation:</p>
<pre lang="(YAML)"><code># Tree.yml
---
tree:
GUK:
name: Global Campus Korea
display: Global Campus Korea (GUK)
tree:
KR01:
name: Department of Environmental Technology, Food Technology and Molecular Biotechnology
display: Department of Environmental Technology, Food Technology and Molecular Biotechnology (KR01)
KR71:
name: Admissions and enrollment office
display: Admissions and enrollment office (KR71)
KR73:
name: Recruitment office
display: Recruitment office (KR73)
...
</code><code></code>
</pre>
<code></code>I added the above to a file called test_import.yml and
ran 'bin/librecat department tree /path/to/test_import.yml', but
nothing was imported.<br>
<br>
Looking into the code, in 'LibreCat/Cmd/department.pm':<br>
<br>
from line 150, in sub _tree_parse:<br>
<br>
my $importer = Catmandu->importer('YAML', file =>
$file);<br>
my $HASH = $importer->first;<br>
my $helper = LibreCat::App::Helper::Helpers->new;<br>
<br>
print "$HASH \n";<br>
<pre lang="(YAML)"><code></code>
</pre>
My print statement gives the error: Use of uninitialized value $HASH
in concatenation (.) or string <br>
<br>
So the problem seems to be in the Catmandu importer, but I don't
know were to begin looking for the problem in there.<br>
<br>
<br>
Second I tried importing using the other format:<br>
<br>
<pre lang="(YAML)"><code>---
_id: KR73
name: Recruitment office
display: Recruitment office (KR73)
layer: 2
tree:
- _id: GUK
...</code></pre>
<br>
I tried this:<br>
<br>
---<br>
_id: IST<br>
name: IST Austria<br>
display: IST Austria<br>
layer: 1<br>
---<br>
_id: Barton<br>
name: Barton<br>
display: Barton Group<br>
layer: 2<br>
tree:<br>
- _id: IST<br>
...<br>
<br>
But only the Barton group is inserted and I get this message:<br>
<br>
IST<br>
ERROR: not a valid department<br>
/tree: Missing property.<br>
added Barton<br>
<br>
And in the interface Barton is under a node named '0'.<br>
<br>
I've tried a lot of different variations of the format above trying
to have IST as my root node with Barton underneath it but could not
achieve this, I could only get them to exist at the same level or to
both exist under two separate nodes called '0'.<br>
<br>
I would have thought you would need no 'tree' attribute when
defining a root note but I get the 'missing property' error whenever
it is left out.<br>
<br>
<br>
Can anyone give me some advice on what to do here? It would be great
if the 'tree' import worked as I already have a full representation
of our organization in this format.<br>
<br>
Thanks,<br>
Jonathan Norris,<br>
IST Austria<br>
<br>
<br>
</body>
</html>