예제 #1
0
파일: expl.class.php 프로젝트: hogsim/PMB
 function save_to_agnostic_warehouse($expl_ids = array(), $source_id = 0, $keep_expl = 1)
 {
     global $base_path, $class_path, $include_path, $dbh;
     if (is_array($expl_ids) && count($expl_ids) && $source_id * 1) {
         $export_params = array('genere_lien' => 1, 'notice_mere' => 1, 'notice_fille' => 1, 'mere' => 0, 'fille' => 0, 'bull_link' => 1, 'perio_link' => 1, 'art_link' => 0, 'bulletinage' => 0, 'notice_perio' => 0, 'notice_art' => 0, 'export_only_expl_ids' => $expl_ids);
         $notice_ids = array();
         $bulletin_ids = array();
         $perio_ids = array();
         $q = 'select expl_notice,expl_bulletin,bulletin_notice from exemplaires left join bulletins on expl_bulletin=bulletin_id and expl_bulletin!=0 where expl_id in (' . implode(',', $expl_ids) . ')';
         $r = pmb_mysql_query($q, $dbh);
         if (pmb_mysql_num_rows($r)) {
             while ($row = pmb_mysql_fetch_object($r)) {
                 if ($row->expl_notice) {
                     $notice_ids[] = $row->expl_notice;
                 }
                 if ($row->expl_bulletin) {
                     $bulletin_ids[] = $row->expl_bulletin;
                 }
                 if ($row->bulletin_notice) {
                     $perio_ids[] = $row->bulletin_notice;
                 }
             }
         }
         if (count($notice_ids) || count($bulletin_ids)) {
             require_once $base_path . '/admin/convert/export.class.php';
             require_once $base_path . "/admin/connecteurs/in/agnostic/agnostic.class.php";
             $conn = new agnostic($base_path . '/admin/connecteurs/in/agnostic');
             $source_params = $conn->get_source_params($source_id);
             $export_params['docnum'] = 1;
             $export_params['docnum_rep'] = $source_params['REP_UPLOAD'];
         }
         if (count($notice_ids)) {
             $notice_ids = array_unique($notice_ids);
             $e = new export($notice_ids);
             $records = array();
             do {
                 $nn = $e->get_next_notice('', array(), array(), $keep_expl, $export_params);
                 if ($e->notice) {
                     $records[] = $e->xml_array;
                 }
             } while ($nn);
             $conn->rec_records_from_xml_array($records, $source_id);
         }
         if (count($bulletin_ids)) {
             $bulletin_ids = array_unique($bulletin_ids);
             $perio_ids = array_unique($perio_ids);
             $e = new export($perio_ids);
             $e->expl_bulletin_a_exporter = $bulletin_ids;
             $records = array();
             do {
                 $nn = $e->get_next_bulletin('', array(), array(), $keep_expl, $export_params);
                 if ($e->notice) {
                     $records[] = $e->xml_array;
                 }
             } while ($nn);
             $conn->rec_records_from_xml_array($records, $source_id);
         }
     }
 }
예제 #2
0
}
while (list($id) = pmb_mysql_fetch_row($resultat)) {
    if (!$specialexport) {
        $e_notice = array();
        $param = new export_param(EXP_SESSION_CONTEXT);
        $e = new export(array($id), $notice_exporte, $bulletin_exporte);
        do {
            $nn = $e->get_next_notice($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context));
            if ($e->notice) {
                $e_notice[] = $e->notice;
            }
        } while ($nn);
        $notice_exporte = $e->notice_exporte;
        //Pour les exemplaires de bulletin
        do {
            $nn = $e->get_next_bulletin($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context));
            if ($e->notice) {
                $e_notice[] = $e->notice;
            }
        } while ($nn);
        $bulletin_exporte = $e->bulletins_exporte;
    } else {
        $e_notice = _export_($id, $keep_expl);
    }
    if (!is_array($e_notice)) {
        $requete = "insert into import_marc (no_notice, notice, origine) values({$no_notice},'" . addslashes($e_notice) . "', '{$origine}')";
        pmb_mysql_query($requete);
        $no_notice++;
        $z++;
    } else {
        for ($i = 0; $i < sizeof($e_notice); $i++) {
예제 #3
0
 function start_export($id_notice, $type_export, $param_export)
 {
     global $i;
     global $param_path;
     global $specialexport;
     global $output_type;
     global $output_params;
     global $step;
     global $export_type;
     global $base_path;
     global $class_path;
     global $include_path;
     global $msg;
     $step = array();
     if ($id_notice) {
         $this->id_notice = $id_notice;
         $this->export_type = $type_export;
         $export_type = $type_export;
         $this->param_export = $param_export;
         //Récupération du répertoire
         $i = 0;
         $param_path = "";
         if (file_exists("{$base_path}/admin/convert/imports/catalog_subst.xml")) {
             $fic_catal = "{$base_path}/admin/convert/imports/catalog_subst.xml";
         } else {
             $fic_catal = "{$base_path}/admin/convert/imports/catalog.xml";
         }
         _parser_($fic_catal, array("ITEM" => "_item_"), "CATALOG");
         //Lecture des paramètres
         _parser_("{$base_path}/admin/convert/imports/" . $param_path . "/params.xml", array("IMPORTNAME" => "_import_name_", "STEP" => "_step_", "OUTPUT" => "_output_", "INPUT" => "_input_"), "PARAMS");
         //Si l'export est spécial, on charge la fonction d'export
         if ($specialexport) {
             require_once "{$base_path}/admin/convert/imports/" . $param_path . "/export.inc.php";
         }
         //En fonction du type de fichier de sortie, inclusion du script de gestion des sorties
         switch ($output_type) {
             case "xml":
                 require_once "{$base_path}/admin/convert/imports/output_xml.inc.php";
                 break;
             case "iso_2709":
                 require_once "{$base_path}/admin/convert/imports/output_iso_2709.inc.php";
                 break;
             case "custom":
                 require_once "{$base_path}/admin/convert/imports/" . $param_path . "/" . $output_params['SCRIPT'];
                 break;
             case "txt":
                 require_once "{$base_path}/admin/convert/imports/output_txt.inc.php";
                 break;
             default:
                 die($msg["export_cant_find_output_type"]);
         }
         $e_notice = array();
         if ($_SESSION["param_export"]["notice_exporte"]) {
             $notice_exporte = $_SESSION["param_export"]["notice_exporte"];
         } else {
             $notice_exporte = array();
         }
         if ($_SESSION["param_export"]["bulletin_exporte"]) {
             $bulletin_exporte = $_SESSION["param_export"]["bulletin_exporte"];
         } else {
             $bulletin_exporte = array();
         }
         if (!$specialexport) {
             $param = new export_param(EXP_DSI_CONTEXT, $this->param_export);
             $e = new export(array($this->id_notice), $notice_exporte, $bulletin_exporte);
             do {
                 $nn = $e->get_next_notice("", "", "", 0, $param->get_parametres($param->context));
                 if ($e->notice) {
                     $e_notice[] = $e->notice;
                 }
             } while ($nn);
             $notice_exporte = $e->notice_exporte;
             $_SESSION["param_export"]["notice_exporte"] = $notice_exporte;
             //Pour les exemplaires de bulletin
             do {
                 $nn = $e->get_next_bulletin("", "", "", 0, $param->get_parametres($param->context));
                 if ($e->notice) {
                     $e_notice[] = $e->notice;
                 }
             } while ($nn);
             $bulletin_exporte = $e->bulletins_exporte;
             $_SESSION["param_export"]["bulletin_exporte"] = $bulletin_exporte;
         } else {
             $e_notice = _export_($this->id_notice);
         }
         if (!is_array($e_notice)) {
             $this->prepared_notice = $e_notice;
             $this->output_notice .= $this->transform();
         } else {
             for ($i = 0; $i < sizeof($e_notice); $i++) {
                 $this->prepared_notice = $e_notice[$i];
                 $this->output_notice .= $this->transform();
             }
         }
     }
 }