salut,

j'utilise SQLIIMPORT pour l'import de csv : dans un premier temps tout marche bien aprés quand je refais l'import j'ai une erreur de type :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
[ May 25 2012 16:11:17 ] Unexpected error, the message was : SQLIContentPublisher::addLocationToContent => Cannot directly add a location to a not-yet-published content. Try to use SQLIContent::addLocation() in E:\MyProject\extension\sqliimport\classes\content\sqlicontentpublisher.php on line 286
j'ai créé un import.php dans le dossier module :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
<?php
/**
*/
 
/* initialissation des variables */	
	$http   = eZHTTPTool::instance();
	$Module = $Params['Module'];
	$tpl    = eZTemplate::factory();
 
/* si l'admin clique sur importer fichier */
 
	if($http->hasPostVariable('Upload')){
 
$csvFile = 'var/impact/exemple.csv';
 
$options = new SQLICSVOptions( array(
			'csv_path'    => $csvFile,
			'enclosure'   => '~'
		) );
$csvDoc = new SQLICSVDoc( $options );
$csvDoc->parse();
 
 
		foreach( $csvDoc->rows as $row ) // Iteration
			{
			$remode_id = (string)$row->titre;
		        $contentOptions = new SQLIContentOptions( array(
		            'class_identifier'      => 'machin',
		            'remote_id'             => hash('sha1',$remode_id)
		        ) );
		        $content = SQLIContent::create( $contentOptions );
 
			$content->fields->titre = (string)$row->titre;
		        $content->fields->description = (string)$row->description;
 
		        $content->addLocation(SQLILocation::fromNodeID(2));
 
		        $publisher = SQLIContentPublisher::getInstance();
		        $publisher->publish($content);
 
			}
 
}
 
 
 
 
	$Result = array();
 
	$Result['content'] = $tpl->fetch("design:sqliimport/import.tpl");
 
	$Result['path'] = array(array(	'url' => false,
 
                                	'text' => 'Import sites'));
 
?>
Merci d'avance