Skip to content
Snippets Groups Projects
Commit 8699de1d authored by llaffont's avatar llaffont
Browse files

Ajout script de génération de l'import des avis sous format CSV

parent e157cba5
Branches
Tags
No related merge requests found
...@@ -5610,6 +5610,7 @@ scripts/emacs/popup-0.5/popup-autoloads.el -text ...@@ -5610,6 +5610,7 @@ scripts/emacs/popup-0.5/popup-autoloads.el -text
scripts/emacs/popup-0.5/popup-pkg.el -text scripts/emacs/popup-0.5/popup-pkg.el -text
scripts/emacs/popup-0.5/popup.el -text scripts/emacs/popup-0.5/popup.el -text
scripts/find_tests.php -text scripts/find_tests.php -text
scripts/import_avis_csv.php -text
scripts/import_sitotheque.php -text scripts/import_sitotheque.php -text
scripts/insert_licence.sh -text scripts/insert_licence.sh -text
scripts/iosrd.sh -text scripts/iosrd.sh -text
......
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* AFI-OPAC 2.0 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
define("BASE_URL", "/");
set_include_path('.' . PATH_SEPARATOR . './library'
. PATH_SEPARATOR . '../ZendFramework-1.6.2/library'
. PATH_SEPARATOR . get_include_path());
include_once "local.php";
include_once "fonctions/fonctions.php";
require_once "Zend/Loader.php";
require_once "startup.php";
setupOpac();
$handle = fopen('avis.csv', 'r');
while (($line = fgetcsv($handle, 0)) !== FALSE) {
$id_origine = $line[0];
$entete = $line[1];
$date = $line[2];
$avis=$line[3];
if (!$exemplaire = Class_Exemplaire::findFirstBy(['id_origine' => $id_origine]))
continue;
$id_notice = $exemplaire->getIdNotice();
$datas=['id_user' => 2,
'clef_oeuvre' => $exemplaire->getNotice()->getClefOeuvre(),
'id_notice' => $id_notice,
'date_avis' => implode('-', array_reverse(explode('/', $date))),
'note' => 5,
'entete' => $entete,
'avis' => str_replace('"', '\"', $avis),
'statut' => 1,
'abon_ou_bib' => 1];
echo "insert into notices_avis(id_user, clef_oeuvre, id_notice, date_avis, note, entete, avis, statut, abon_ou_bib) values(\"".implode("\",\"", array_values($datas))."\");\n";
}
?>
\ No newline at end of file
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