function traite_exemplaires() { global $msg, $dbh; global $prix, $notice_id, $info_995, $typdoc_995, $tdoc_codage, $book_lender_id, $section_995, $sdoc_codage, $book_statut_id, $locdoc_codage, $codstatdoc_995, $statisdoc_codage, $cote_mandatory, $book_location_id, $nb_expl_ignores; // la zone 995 est répétable for ($nb_expl = 0; $nb_expl < sizeof($info_995); $nb_expl++) { /* RAZ expl */ $expl = array(); /* préparation du tableau à passer à la méthode */ $expl['cb'] = $info_995[$nb_expl]['a']; if (!$expl['cb']) { $expl['cb'] = "NOTI-" . $notice_id; } $expl['notice'] = $notice_id; $expl['cote'] = $info_995[$nb_expl]['f']; $expl['note'] = $info_995[$nb_expl]['u']; $expl['prix'] = $info_995[$nb_expl]['B']; $expl['date_depot'] = today(); $expl['date_retour'] = today(); // type de support $data_doc = array(); $data_doc['tdoc_libelle'] = "Type doc - " . $info_995[$nb_expl]['c']; $data_doc['duree_pret'] = 0; /* valeur par défaut */ $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['c']; $data_doc['tdoc_owner'] = 0; $expl['typdoc'] = docs_type::import($data_doc); // $expl['section'] = $info_995[$nb_expl]['x']; à chercher dans docs_section $data_doc = array(); $data_doc['section_libelle'] = $info_995[$nb_expl]['x']; $data_doc['sdoc_codage_import'] = $info_995[$nb_expl]['x']; $data_doc['sdoc_owner'] = 0; $expl['section'] = docs_section::import($data_doc); if (!$expl['section']) { $expl['section'] = 31; } // $expl['statut'] $data_doc = array(); $data_doc['statut_libelle'] = "Statut - " . $info_995[$nb_expl]['y']; $data_doc['pret_flag'] = 1; $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['y']; $data_doc['statusdoc_owner'] = 0; $expl['statut'] = docs_statut::import($data_doc); // $expl['location'] $data_doc = array(); $data_doc['location_libelle'] = "Localisation - " . $info_995[$nb_expl]['w']; $data_doc['locdoc_codage_import'] = $info_995[$nb_expl]['w']; $data_doc['locdoc_owner'] = 0; $expl['location'] = docs_location::import($data_doc); // $expl['codestat'] = $info_995[$nb_expl]['O']; (O majuscule, pas zéro) $data_doc = array(); $data_doc['codestat_libelle'] = "Code stat - " . $info_995[$nb_expl]['O']; $data_doc['statisdoc_codage_import'] = $info_995[$nb_expl]['O']; $data_doc['statisdoc_owner'] = 0; $expl['codestat'] = docs_codestat::import($data_doc); if (!$expl['codestat']) { $expl['codestat'] = 38; } // $expl['expl_owner'] $data_doc = array(); $data_doc['lender_libelle'] = $info_995[$nb_expl]['R']; $expl['expl_owner'] = lender::import($data_doc); if (!$expl['expl_owner']) { $expl['expl_owner'] = 3; } $expl['cote_mandatory'] = $cote_mandatory; $expl_id = exemplaire::import($expl); if ($expl_id == 0) { $nb_expl_ignores++; } // Numéro du jeu if ($info_995[$nb_expl]['v'] && $expl_id) { $requete = "insert into expl_custom_values (expl_custom_champ,expl_custom_origine,expl_custom_small_text) values(1,{$expl_id},'" . addslashes($info_995[$nb_expl]['v']) . "')"; mysql_query($requete); } //debug : affichage zone 995 /* echo "995\$a =".$info_995[$nb_expl]['a']."<br />"; echo "995\$b =".$info_995[$nb_expl]['b']."<br />"; echo "995\$c =".$info_995[$nb_expl]['c']."<br />"; echo "995\$d =".$info_995[$nb_expl]['d']."<br />"; echo "995\$f =".$info_995[$nb_expl]['f']."<br />"; echo "995\$k =".$info_995[$nb_expl]['k']."<br />"; echo "995\$m =".$info_995[$nb_expl]['m']."<br />"; echo "995\$n =".$info_995[$nb_expl]['n']."<br />"; echo "995\$o =".$info_995[$nb_expl]['o']."<br />"; echo "995\$q =".$info_995[$nb_expl]['q']."<br />"; echo "995\$r =".$info_995[$nb_expl]['r']."<br />"; echo "995\$u =".$info_995[$nb_expl]['u']."<br /><br />"; */ } // fin for }
function traite_exemplaires() { global $msg, $dbh; global $nb_expl_ignores; global $prix, $notice_id, $info_996, $info_995, $info_001, $info_345_d; global $bulletin_id; global $id_expl_fournisseur_opsys, $id_expl_inventaire_opsys; // Afin de ne pas remettre en cause le script programmé en 995 : $info_995 = $info_996; // lu en 010$d de la notice $price = $prix[0]; // prix dvd et video if ($info_345_d[0]) { $price = $info_345_d[0]; } // la zone 995 est répétable for ($nb_expl = 0; $nb_expl < sizeof($info_995); $nb_expl++) { /* RAZ expl */ $expl = array(); /* préparation du tableau à passer à la méthode */ $expl['notice'] = $notice_id; $expl['cb'] = $info_995[$nb_expl]['f']; $expl['cote'] = $info_995[$nb_expl]['k']; $expl['note'] = $info_995[$nb_expl]['u'] . $info_995[$nb_expl]['5']; $expl['prix'] = $price; $expl['cote_mandatory'] = 0; $expl['date_depot'] = substr($info_995[$nb_expl]['m'], 0, 4) . "-" . substr($info_995[$nb_expl]['m'], 4, 2) . "-" . substr($info_995[$nb_expl]['m'], 6, 2); $expl['date_retour'] = substr($info_995[$nb_expl]['n'], 0, 4) . "-" . substr($info_995[$nb_expl]['n'], 4, 2) . "-" . substr($info_995[$nb_expl]['n'], 6, 2); // propriétaire $owner = array(); $owner['lender_libelle'] = $info_995[$nb_expl]['a']; if (!$owner['lender_libelle']) { $owner['lender_libelle'] = $info_995[$nb_expl]['b']; } if (!$owner['lender_libelle']) { $owner['lender_libelle'] = 'defaut'; } $expl['expl_owner'] = lender::import($owner); $book_lender_id = $expl['expl_owner']; // docs_location $data_doc = array(); $data_doc['location_libelle'] = $info_995[$nb_expl]['v']; $data_doc['locdoc_codage_import'] = $info_995[$nb_expl]['w']; if (!$data_doc['locdoc_codage_import']) { $data_doc['locdoc_codage_import'] = $data_doc['location_libelle']; } //$data_doc['locdoc_owner'] = $book_lender_id ; $data_doc['locdoc_owner'] = 0; $expl['location'] = docs_location::import($data_doc); // docs_section $data_doc = array(); $data_doc['section_libelle'] = $info_995[$nb_expl]['x']; $data_doc['sdoc_codage_import'] = $info_995[$nb_expl]['y']; if (!$data_doc['sdoc_codage_import']) { $data_doc['sdoc_codage_import'] = $data_doc['section_libelle']; } //$data_doc['sdoc_owner'] = $book_lender_id ; $data_doc['sdoc_owner'] = 0; $expl['section'] = docs_section::import($data_doc); // typedoc $data_doc = array(); $data_doc['tdoc_libelle'] = $info_995[$nb_expl]['e']; if (!$data_doc['tdoc_libelle']) { $data_doc['tdoc_libelle'] = $info_995[$nb_expl]['r']; } $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['r']; if (!$data_doc['tdoc_codage_import']) { $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['e']; } $data_doc['duree_pret'] = 28; /* valeur par défaut */ $data_doc['tdoc_owner'] = $book_lender_id; $expl['typdoc'] = docs_type::import($data_doc); // statut doc $data_doc = array(); $data_doc['statut_libelle'] = $info_995[$nb_expl]['1']; $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['2']; if (!$data_doc['statusdoc_codage_import']) { $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['1']; } $data_doc['pret_flag'] = $info_995[$nb_expl]['3']; $data_doc['statusdoc_owner'] = $book_lender_id; $expl['statut'] = docs_statut::import($data_doc); // codestat //$expl['codestat'] = 10 ; $data_codestat['codestat_libelle'] = strtolower($info_995[$nb_expl]['x']); $expl['codestat'] = docs_codestat::import($data_codestat); // quoi_faire // $que_faire vient du formulaire de chargement, à utiliser en attente de l'info dans la zone 996 global $que_faire; if ($que_faire == "") { if ($info_995[$nb_expl]['0']) { $expl['quoi_faire'] = $info_995[$nb_expl]['0']; } else { $expl['quoi_faire'] = 2; } } else { $expl['quoi_faire'] = $que_faire; } // 0 : supprimer, 1 ou vide : Mettre à jour ou ajouter, 2 : ajouter si possible, sinon rien. //print "<pre>";print_r($info_995);print_r($expl);print "</pre>"; $expl_id = exemplaire::import($expl); if ($expl_id == 0) { $nb_expl_ignores++; } list($num_opsys, $type_opsys) = explode(" ", $info_001[0]); if ($type_opsys == 'UMO:13') { $requete = "update exemplaires set expl_notice='0', expl_bulletin='{$bulletin_id}' where expl_id='{$expl_id}' "; //print "$requete <br />"; pmb_mysql_query($requete); } if (!$id_expl_fournisseur_opsys) { $rqt = "select idchamp from expl_custom where name='fournisseur'"; $res = pmb_mysql_query($rqt, $dbh); if ($res && ($r = pmb_mysql_fetch_object($res))) { $id_expl_fournisseur_opsys = $r->idchamp; } } if (!$id_expl_inventaire_opsys) { $rqt = "select idchamp from expl_custom where name='inventaire'"; $res = pmb_mysql_query($rqt, $dbh); if ($res && ($r = pmb_mysql_fetch_object($res))) { $id_expl_inventaire_opsys = $r->idchamp; } } //inventaire en champ perso if ($field = $info_995[$nb_expl]['6']) { $requete = "insert into expl_custom_values (expl_custom_champ,expl_custom_origine,expl_custom_small_text) values({$id_expl_inventaire_opsys},{$expl_id},'" . addslashes($field) . "')"; pmb_mysql_query($requete); } //Fournisseur en champ perso if ($field = $info_995[$nb_expl]['7']) { $requete = "insert into expl_custom_values (expl_custom_champ,expl_custom_origine,expl_custom_small_text) values({$id_expl_fournisseur_opsys},{$expl_id},'" . addslashes($field) . "')"; pmb_mysql_query($requete); } //Date de création if ($field = $info_995[$nb_expl]['8']) { $requete = "update exemplaires set create_date='{$field} 12:00:00' where expl_id='{$expl_id}' "; //print $requete; pmb_mysql_query($requete); } } // fin for }
function traite_exemplaires() { global $msg, $dbh; global $nb_expl_ignores; global $prix, $notice_id, $info_996, $info_995; // Afin de ne pas remettre en cause le script programmé en 995 : $info_995 = $info_996; // lu en 010$d de la notice $price = $prix[0]; // la zone 995 est répétable for ($nb_expl = 0; $nb_expl < sizeof($info_995); $nb_expl++) { /* RAZ expl */ $expl = array(); /* préparation du tableau à passer à la méthode */ $expl['notice'] = $notice_id; $expl['cb'] = $info_995[$nb_expl]['f']; $expl['cote'] = $info_995[$nb_expl]['k']; $expl['note'] = $info_995[$nb_expl]['u']; $expl['prix'] = $price; $expl['cote_mandatory'] = 0; $expl['date_depot'] = substr($info_995[$nb_expl]['m'], 0, 4) . "-" . substr($info_995[$nb_expl]['m'], 4, 2) . "-" . substr($info_995[$nb_expl]['m'], 6, 2); $expl['date_retour'] = substr($info_995[$nb_expl]['n'], 0, 4) . "-" . substr($info_995[$nb_expl]['n'], 4, 2) . "-" . substr($info_995[$nb_expl]['n'], 6, 2); // propriétaire $owner = array(); $owner['lender_libelle'] = $info_995[$nb_expl]['a']; if (!$owner['lender_libelle']) { $owner['lender_libelle'] = $info_995[$nb_expl]['b']; } $expl['expl_owner'] = lender::import($owner); $book_lender_id = $expl['expl_owner']; // docs_location $data_doc = array(); $data_doc['location_libelle'] = $info_995[$nb_expl]['v']; $data_doc['locdoc_codage_import'] = $info_995[$nb_expl]['w']; if (!$data_doc['locdoc_codage_import']) { $data_doc['locdoc_codage_import'] = $data_doc['location_libelle']; } //$data_doc['locdoc_owner'] = $book_lender_id ; $data_doc['locdoc_owner'] = 0; $expl['location'] = docs_location::import($data_doc); // docs_section $data_doc = array(); $data_doc['section_libelle'] = $info_995[$nb_expl]['x']; $data_doc['sdoc_codage_import'] = $info_995[$nb_expl]['y']; if (!$data_doc['sdoc_codage_import']) { $data_doc['sdoc_codage_import'] = $data_doc['section_libelle']; } //$data_doc['sdoc_owner'] = $book_lender_id ; $data_doc['sdoc_owner'] = 0; $expl['section'] = docs_section::import($data_doc); // typedoc $data_doc = array(); $data_doc['tdoc_libelle'] = $info_995[$nb_expl]['e']; $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['r']; if (!$data_doc['tdoc_codage_import']) { $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['e']; } $data_doc['duree_pret'] = 28; /* valeur par défaut */ $data_doc['tdoc_owner'] = $book_lender_id; $expl['typdoc'] = docs_type::import($data_doc); // statut doc $data_doc = array(); $data_doc['statut_libelle'] = $info_995[$nb_expl]['1']; $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['2']; if (!$data_doc['statusdoc_codage_import']) { $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['1']; } $data_doc['pret_flag'] = $info_995[$nb_expl]['3']; $data_doc['statusdoc_owner'] = $book_lender_id; $expl['statut'] = docs_statut::import($data_doc); // codestat $expl['codestat'] = 1; // quoi_faire // $que_faire vient du formulaire de chargement, à utiliser en attente de l'info dans la zone 996 global $que_faire; if ($que_faire == "") { if ($info_995[$nb_expl]['0']) { $expl['quoi_faire'] = $info_995[$nb_expl]['0']; } else { $expl['quoi_faire'] = 2; } } else { $expl['quoi_faire'] = $que_faire; } // 0 : supprimer, 1 ou vide : Mettre à jour ou ajouter, 2 : ajouter si possible, sinon rien. $expl_id = exemplaire::import($expl); if ($expl_id == 0) { $nb_expl_ignores++; } //debug : affichage zone 995 /* echo "995\$a =".$info_995[$nb_expl]['a']."<br />"; echo "995\$b =".$info_995[$nb_expl]['b']."<br />"; echo "995\$c =".$info_995[$nb_expl]['c']."<br />"; echo "995\$d =".$info_995[$nb_expl]['d']."<br />"; echo "995\$f =".$info_995[$nb_expl]['f']."<br />"; echo "995\$k =".$info_995[$nb_expl]['k']."<br />"; echo "995\$m =".$info_995[$nb_expl]['m']."<br />"; echo "995\$n =".$info_995[$nb_expl]['n']."<br />"; echo "995\$o =".$info_995[$nb_expl]['o']."<br />"; echo "995\$q =".$info_995[$nb_expl]['q']."<br />"; echo "995\$r =".$info_995[$nb_expl]['r']."<br />"; echo "995\$u =".$info_995[$nb_expl]['u']."<br /><br />"; */ } // fin for }