示例#1
0
 function save_to_agnostic_warehouse($notice_ids = array(), $source_id = 0, $keep_expl = 0)
 {
     global $base_path, $class_path, $include_path;
     if (is_array($notice_ids) && count($notice_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);
         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'];
         $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);
     }
 }
示例#2
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);
         }
     }
 }