Skip to content
Snippets Groups Projects
Commit bd069b01 authored by Alex Arnaud's avatar Alex Arnaud
Browse files

dev#17871 OAI connector - PhaseNotice cleanning process checks integration...

dev#17871 OAI connector - PhaseNotice cleanning process checks integration file size before deleting anything
parent d10b5692
Branches
Tags
2 merge requests!917Dev#17871 oaista la vista,!904Dev#17871 oaista la vista
......@@ -47,6 +47,11 @@ class Class_Cosmogramme_Integration_PhaseNotice extends Class_Cosmogramme_Integr
/** in case of full import, implements what is needed to be done */
protected function _clean($integration) {
if(!filesize($this->_file_path)) {
$this->_log->ecrire('<span class="rouge">Le fichier d\'import total est vide : aucun exemplaire supprimé.</span><br><br>');
return;
}
$id_bib = $integration->getIdBib();
$del_msg = '<br><span class="violet">Supression des exemplaires</span><br>';
$nb = Class_Exemplaire::countBy(['id_bib' => $id_bib]);
......@@ -56,7 +61,7 @@ class Class_Cosmogramme_Integration_PhaseNotice extends Class_Cosmogramme_Integr
Class_NoticeSuccincte::deleteBy(['id_bib' => $id_bib]);
$del_msg .= '<span class="vert">' . $nb . ' exemplaires supprimés</span><br>';
$del_msg .= '<span class="vert">' . $nb1 . ' notices succinctes supprimées</span><br><br>'
$del_msg .= '<span class="vert">' . $nb1 . ' notices succinctes supprimées</span><br><br>';
$this->_log->ecrire($del_msg);
}
......
......@@ -21,6 +21,9 @@
abstract class Class_Cosmogramme_Integration_PhaseOnFile extends Class_Cosmogramme_Integration_PhaseAbstract {
protected $_file_path;
public function _execute() {
$integrations = Class_Cosmogramme_Integration::findAllBy(['traite' => 'non',
'order' => 'id']);
......@@ -44,6 +47,8 @@ abstract class Class_Cosmogramme_Integration_PhaseOnFile extends Class_Cosmogram
if (!($profil = $integration->getProfilDonnees()) || !$this->_validateProfil($profil))
return;
$this->_file_path = Class_CosmoVar::get('integration_path') . $integration->getFichier();
$this->_headerOf($integration);
if ($integration->shouldClean())
......@@ -51,8 +56,7 @@ abstract class Class_Cosmogramme_Integration_PhaseOnFile extends Class_Cosmogram
$this->_initOne();
$file_path = Class_CosmoVar::get('integration_path') . $integration->getFichier();
$parser = Class_Cosmogramme_FileParser::openFor($file_path,
$parser = Class_Cosmogramme_FileParser::openFor($this->_file_path,
$integration->getPointeurReprise(),
$profil);
......
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