Skip to content
Snippets Groups Projects
Commit eb87373b authored by Laurent's avatar Laurent
Browse files

dev #17990 fix logs

parent 5a61ceb6
Branches
Tags
2 merge requests!565Dev#17990 miop integration suite,!561Dev#17990 miop integration suite
......@@ -129,7 +129,8 @@ class Class_Import_Typo3 {
$element = $this->traceUnknownKohaUrls(
function() use ($new){
return $this->createSito($new);
});
},
$new['uid']);
}
......@@ -146,7 +147,7 @@ class Class_Import_Typo3 {
if (!$element->save()) {
$this->report['sitotheque_errors']++;
$this->errors[] = "site with uid : " . $new['uid'] . ' (' . $new['title'] . ') - ' . implode(', ', $element->getErrors());
Class_Import_Typo3_Logs::getInstance()->addErrorRow("site with uid : " . $new['uid'] . ' (' . $new['title'] . ') - ' . implode(', ', $element->getErrors()));
return $element;
}
......@@ -302,7 +303,8 @@ class Class_Import_Typo3 {
$element = $this->traceUnknownKohaUrls(
function() use ($new, $id_cat){
return $this->createArticle($new, $id_cat);
});
},
$new['uid']);
$this->news_categories_map->setDomainsFor($element,
......@@ -364,7 +366,8 @@ class Class_Import_Typo3 {
foreach($cal_news as $new) {
$this->traceUnknownKohaUrls( function() use ($new) {
return $this->createCalendar($new);
});
},
$new['uid']);
}
return $this;
}
......@@ -393,7 +396,7 @@ class Class_Import_Typo3 {
if (!$element->save()) {
$this->report['calendar_errors']++;
$this->errors[] = 'calendar with uid: ' . $new['uid'] . '(' . $new['title'] . ') - ' . implode(', ', $element->getErrors());
Class_Import_Typo3_Logs::getInstance()->addErrorRow('calendar with uid: ' . $new['uid'] . '(' . $new['title'] . ') - ' . implode(', ', $element->getErrors()));
return $element;
}
......@@ -417,7 +420,8 @@ class Class_Import_Typo3 {
$this->traceUnknownKohaUrls(
function() use ($new, $pages_cat){
return $this->createArticlePage($new, $pages_cat);
});
},
$new['uid']);
$this->report['pages_created']++;
}
......@@ -444,18 +448,19 @@ class Class_Import_Typo3 {
if (!$element->save()) {
$this->report['pages_errors']++;
$this->errors[] = 'pages with uid: ' . $new['uid'] . ' (' . $new['title'] . ') - ' . implode(', ', $element->getErrors());
Class_Import_Typo3_Logs::getInstance()->addErrorRow('pages with uid: ' . $new['uid'] . ' (' . $new['title'] . ') - ' . implode(', ', $element->getErrors()));
}
return $element;
}
public function traceUnknownKohaUrls($closure) {
public function traceUnknownKohaUrls($closure,$uid) {
$this->unknown_koha_urls = [];
$element = $closure();
foreach($this->unknown_koha_urls as $url) {
Class_Import_Typo3_Logs::getInstance()->addUnknownUrl($element,
$url);
$url,
$uid);
}
return $element;
}
......
......@@ -57,8 +57,8 @@ class Class_Import_Typo3_logs {
return $this->_logs;
}
public function addUnknownUrl($element, $url) {
$this->addLogRow(get_class($element).' id:'.$element->getId().' unknown URL: '.$url);
public function addUnknownUrl($element, $url, $uid) {
$this->addLogRow(get_class($element).' id:'.$element->getId().' , typo3 uid: '.$uid.', unknown URL: '.$url);
}
......@@ -101,6 +101,11 @@ class Class_Import_Typo3_logs {
public function addErrorRow($error) {
$this->_errors .= $error . '\n';
if ($this->_output_activated) {
echo "[ERROR] $error\n";
}
return $this;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment