diff --git a/library/Class/Import/Typo3.php b/library/Class/Import/Typo3.php index f2aecfb25991bc3a8ad3c22619a00c5d714ad9bc..05491930863be69696f41d340fa91a1c7f6d5416 100644 --- a/library/Class/Import/Typo3.php +++ b/library/Class/Import/Typo3.php @@ -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; } diff --git a/library/Class/Import/Typo3/Logs.php b/library/Class/Import/Typo3/Logs.php index 161c4bacc35ef5d293ac72c8cc89a39c6d0da4f4..b04e837c0467940cb77a4ce533b13001c07a66aa 100644 --- a/library/Class/Import/Typo3/Logs.php +++ b/library/Class/Import/Typo3/Logs.php @@ -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; }