function bulletinage($bulletin_id, $serial_id = 0, $link_explnum = '', $localisation = 0, $make_display = true) { global $dbh; global $pmb_droits_explr_localises, $explr_invisible; global $pmb_sur_location_activate; global $xmlta_doctype_bulletin; global $deflt_notice_is_new; $this->bulletin_id = $bulletin_id; if ($this->bulletin_id) { $this->fetch_bulletin_data(); } else { $this->b_is_new = $deflt_notice_is_new; } if ($serial_id) { $this->bulletin_notice = $serial_id; } $tmp_link = $this->notice_link; //On vide les liens entre notices car ils sont appliqués pour le serial dans le $this if ($this->serial($this->bulletin_notice)) { $this->notice_link = array(); $this->notice_link = $tmp_link; } unset($tmp_link); // si le bulletin n'a pas de notice associée, son typedoc par défaut sera celui de la notice chapeau if ($xmlta_doctype_bulletin) { if (!$this->b_typdoc) { $this->b_typdoc = $xmlta_doctype_bulletin; } } else { if (!$this->b_typdoc) { $this->b_typdoc = $this->typdoc; } } if ($make_display) { //Je ne crée la partie affichage que quand j'en ai besoin $this->make_display(); $this->make_short_display(); } // on récupère les données d'exemplaires liés $this->expl = array(); if ($this->bulletin_id) { $requete = "SELECT count(1) from analysis where analysis_bulletin='" . $this->bulletin_id . "'"; $query_nb_analysis = pmb_mysql_query($requete, $dbh); $this->nb_analysis = pmb_mysql_result($query_nb_analysis, 0, 0); // visibilité des exemplaires: if ($pmb_droits_explr_localises && $explr_invisible) { $where_expl_localises = " and expl_location not in ({$explr_invisible})"; } else { $where_expl_localises = ""; } if ($localisation > 0) { $where_localisation = " and expl_location={$localisation} "; } else { $where_localisation = ""; } $requete = "SELECT exemplaires.*, tdoc_libelle, section_libelle"; $requete .= ", statut_libelle, location_libelle"; $requete .= ", codestat_libelle, lender_libelle, pret_flag "; $requete .= " FROM exemplaires, docs_type, docs_section, docs_statut, docs_location, docs_codestat, lenders "; $requete .= " WHERE exemplaires.expl_bulletin=" . $this->bulletin_id . "{$where_expl_localises} {$where_localisation}"; $requete .= " AND docs_type.idtyp_doc=exemplaires.expl_typdoc"; $requete .= " AND docs_section.idsection=exemplaires.expl_section"; $requete .= " AND docs_statut.idstatut=exemplaires.expl_statut"; $requete .= " AND docs_location.idlocation=exemplaires.expl_location"; $requete .= " AND docs_codestat.idcode=exemplaires.expl_codestat"; $requete .= " AND lenders.idlender=exemplaires.expl_owner"; $myQuery = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($myQuery)) { while ($expl = pmb_mysql_fetch_object($myQuery)) { if ($pmb_sur_location_activate) { $sur_loc = sur_location::get_info_surloc_from_location($expl->expl_location); $expl->sur_loc_libelle = $sur_loc->libelle; $expl->sur_loc_id = $sur_loc->id; } $this->expl[] = $expl; } /* note : le tableau est constitué d'objet dont les propriétés sont : id exemplaire expl_id; code-barre expl_cb; notice expl_notice; bulletinage expl_bulletin; type doc expl_typdoc; libelle type doc tdoc_libelle; cote expl_cote; section expl_section; libelle section section_libelle; statut expl_statut; libelle statut statut_libelle; localisation expl_location; libelle localisation location_libelle; code statistique expl_codestat; libelle code_stat codestat_libelle; libelle proprietaire lender_libelle; date de dépot BDP par exemple expl_date_depot; date de retour expl_date_retour; note expl_note; prix expl_prix; owner $expl->expl_owner; */ } $requete = "SELECT explnum.* FROM explnum WHERE explnum_bulletin='" . $this->bulletin_id . "' "; $myQuery = pmb_mysql_query($requete, $dbh); $this->nbexplnum = pmb_mysql_num_rows($myQuery); if ($make_display && $this->nbexplnum) { //Je ne crée la partie affichage que quand j'en ai besoin $this->explnum = show_explnum_per_notice(0, $this->bulletin_id, $link_explnum); } } return $this->bulletin_id; }
function get_expl_info($id, $lien_notice = 1) { global $dbh; global $cart_link_non; global $pmb_sur_location_activate; $query = " select * from exemplaires expl, docs_location location"; $query .= ", docs_section section, docs_statut statut, docs_type dtype, docs_codestat codestat"; $query .= " where expl.expl_id='{$id}'"; $query .= " and location.idlocation=expl.expl_location"; $query .= " and section.idsection=expl.expl_section"; $query .= " and statut.idstatut=expl.expl_statut"; $query .= " and dtype.idtyp_doc=expl.expl_typdoc"; $query .= " and codestat.idcode=expl.expl_codestat"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $expl = pmb_mysql_fetch_object($result); if ($expl->expl_notice) { if (SESSrights & CATALOGAGE_AUTH && $lien_notice) { $notice = new mono_display($expl->expl_notice, 1, "./catalog.php?categ=isbd&id=" . $expl->expl_notice, 0); } else { $notice = new mono_display($expl->expl_notice, 1, "", 0); } $expl->isbd = $notice->isbd; $expl->code = $notice->notice->code; $expl->aff_reduit = $notice->header; $expl->titre = $notice->tit1; } elseif ($expl->expl_bulletin) { $bl = new bulletinage_display($expl->expl_bulletin); $expl->isbd = $bl->display; if ($cart_link_non) { $expl->aff_reduit = $bl->header; } else { $expl->aff_reduit = "<a href='./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$expl->expl_bulletin}'>" . $bl->header . "</a>"; } } if ($expl->expl_lastempr) { $lastempr = new emprunteur($expl->expl_lastempr, '', FALSE, 0); $expl->lastempr_nom = $lastempr->nom; $expl->lastempr_prenom = $lastempr->prenom; $expl->lastempr_cb = $lastempr->cb; } if ($pmb_sur_location_activate) { $sur_loc = sur_location::get_info_surloc_from_location($expl->expl_location); $expl->sur_loc_libelle = $sur_loc->libelle; $expl->sur_loc_id = $sur_loc->id; } return $expl; } else { return FALSE; } }
function exemplaire($cb = '', $id = 0, $id_notice = 0, $id_bulletin = 0) { global $dbh; global $class_path; global $pmb_sur_location_activate; // on checke si l'exemplaire est connu if ($cb && !$id) { $clause_where = " WHERE expl_cb like '{$cb}' "; } if (!$cb && $id || $cb && $id) { $clause_where = " WHERE expl_id = '{$id}' "; } if ($cb || $id) { $requete = "SELECT *, section_libelle, location_libelle"; $requete .= " FROM exemplaires LEFT JOIN docs_section ON (idsection = expl_section) LEFT JOIN docs_location ON (idlocation = expl_location)"; $requete .= $clause_where; $result = @pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($result)) { $item = pmb_mysql_fetch_object($result); $this->expl_id = $item->expl_id; $this->cb = $item->expl_cb; $this->id_notice = $item->expl_notice; $this->id_bulletin = $item->expl_bulletin; $this->typdoc_id = $item->expl_typdoc; $this->typdoc = $item->tdoc_libelle; $this->duree_pret = $item->duree_pret; $this->cote = $item->expl_cote; $this->section_id = $item->expl_section; $this->section = $item->section_libelle; $this->statut_id = $item->expl_statut; //$this->statut = $item->statut_libelle; //$this->pret = $item->pret_flag; $this->location_id = $item->expl_location; $this->location = $item->location_libelle; $this->codestat_id = $item->expl_codestat; //$this->codestat = $item->codestat_libelle; $this->date_depot = $item->expl_date_depot; $this->date_retour = $item->expl_date_retour; $this->note = $item->expl_note; $this->prix = $item->expl_prix; $this->owner_id = $item->expl_owner; $this->lastempr = $item->expl_lastempr; $this->last_loan_date = $item->last_loan_date; $this->create_date = $item->create_date; $this->update_date = $item->update_date; $this->type_antivol = $item->type_antivol; $this->transfert_location_origine = $item->transfert_location_origine; $this->transfert_statut_origine = $item->transfert_statut_origine; $this->transfert_section_origine = $item->transfert_section_origine; $this->expl_comment = $item->expl_comment; $this->nbparts = $item->expl_nbparts; $this->expl_retloc = $item->expl_retloc; if ($pmb_sur_location_activate) { $sur_loc = sur_location::get_info_surloc_from_location($item->expl_location); $this->sur_loc_libelle = $sur_loc->libelle; $this->sur_loc_id = $sur_loc->id; } // visibilite des exemplaires global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises; if ($pmb_droits_explr_localises) { $tab_invis = explode(",", $explr_invisible); $tab_unmod = explode(",", $explr_visible_unmod); $as_invis = array_search($this->location_id, $tab_invis); $as_unmod = array_search($this->location_id, $tab_unmod); if ($as_invis !== FALSE && $as_invis !== NULL) { $this->explr_acces_autorise = "INVIS"; } elseif ($as_unmod !== FALSE && $as_unmod !== NULL) { $this->explr_acces_autorise = "UNMOD"; } else { $this->explr_acces_autorise = "MODIF"; } } else { $this->explr_acces_autorise = "MODIF"; } } else { // rien trouvé en base $this->cb = $cb; $this->id_notice = $id_notice; $this->id_bulletin = $id_bulletin; global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises; if ($pmb_droits_explr_localises) { if ($explr_visible_mod) { $this->explr_acces_autorise = "MODIF"; } else { $this->explr_acces_autorise = "UNMOD"; } } else { $this->explr_acces_autorise = "MODIF"; } } } else { // rien de fourni apparemment $this->cb = $cb; $this->id_notice = $id_notice; $this->id_bulletin = $id_bulletin; global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises; if ($pmb_droits_explr_localises) { if ($explr_visible_mod) { $this->explr_acces_autorise = "MODIF"; } else { $this->explr_acces_autorise = "UNMOD"; } } else { $this->explr_acces_autorise = "MODIF"; } } if ($this->id_bulletin) { $qb = "select bulletin_notice from bulletins where bulletin_id='" . $this->id_bulletin . "' "; $rb = @pmb_mysql_query($qb, $dbh); if (pmb_mysql_num_rows($rb)) { $this->id_bulletin_notice = pmb_mysql_result($rb, 0, 0); } } }
$admin_location_form = str_replace('!!loc_state!!', htmlentities($state, ENT_QUOTES, $charset), $admin_location_form); $admin_location_form = str_replace('!!loc_country!!', htmlentities($country, ENT_QUOTES, $charset), $admin_location_form); $admin_location_form = str_replace('!!loc_phone!!', $phone, $admin_location_form); $admin_location_form = str_replace('!!loc_email!!', $email, $admin_location_form); $admin_location_form = str_replace('!!loc_website!!', $website, $admin_location_form); $admin_location_form = str_replace('!!loc_logo!!', $logo, $admin_location_form); $admin_location_form = str_replace('!!loc_commentaire!!', htmlentities($commentaire, ENT_QUOTES, $charset), $admin_location_form); $requete = "SELECT id_infopage, title_infopage FROM infopages where valid_infopage=1 ORDER BY title_infopage "; $infopages = gen_liste($requete, "id_infopage", "title_infopage", "form_num_infopage", "", $num_infopage, 0, $msg["location_no_infopage"], 0, $msg["location_no_infopage"], 0); $admin_location_form = str_replace('!!loc_infopage!!', $infopages, $admin_location_form); $admin_location_form = str_replace('!!css_style!!', $css_style, $admin_location_form); print confirmation_delete("./admin.php?categ=docs&sub=location&action=del&id="); print $admin_location_form; } if ($pmb_sur_location_activate) { $sur_loc = sur_location::get_info_surloc_from_location($id); $sur_loc_selector = $sur_loc->get_list("form_sur_localisation", $sur_loc->id, 1); } switch ($action) { case 'update': // vérification validité des données fournies. if ($form_actif) { $requete = " SELECT count(1) FROM docs_location WHERE (location_libelle='{$form_libelle}' AND idlocation!='{$id}' ) LIMIT 1 "; $res = pmb_mysql_query($requete, $dbh); $nbr = pmb_mysql_result($res, 0, 0); if ($nbr > 0) { error_form_message($form_libelle . $msg["docs_label_already_used"]); } else { if (!$form_sur_localisation) { $form_location_use_surloc = 0; }
function fetch_info_suite() { global $dbh; global $msg; global $charset; global $val_list_empr; global $pmb_gestion_financiere, $pmb_gestion_abonnement, $pmb_gestion_tarif_prets, $pmb_gestion_amende, $empr_header_format; global $deflt_docs_location; global $pmb_sur_location_activate; global $pmb_resa_planning; //Comptes si gestion financiere $compte = ""; $n_c = 0; $neg = "<span class='erreur'>%s</span>"; $pos = "%s"; if ($pmb_gestion_financiere) { $compte .= "<div class='row'><hr /></div><div class='row'>"; if ($pmb_gestion_abonnement) { $cpt_id = comptes::get_compte_id_from_empr($this->id, 1); $cpt = new comptes($cpt_id); $solde = $cpt->update_solde(); $novalid = $cpt->summarize_transactions("", "", 0, 0); if ($cpt_id) { $compte .= "<div class='colonne4'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=1'>" . $msg["finance_solde_abt"] . "</a></strong> " . comptes::format($solde) . "</div>"; if ($novalid) { $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>"; } $compte .= "</div>"; } $n_c++; } if ($pmb_gestion_tarif_prets) { $cpt_id = comptes::get_compte_id_from_empr($this->id, 3); $cpt = new comptes($cpt_id); $solde = $cpt->update_solde(); $novalid = $cpt->summarize_transactions("", "", 0, 0); if ($cpt_id) { $compte .= "<div class='colonne4'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=3'>" . $msg["finance_solde_pret"] . "</a></strong> " . comptes::format($solde) . "</div>"; if ($novalid) { $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>"; } $compte .= "</div>"; } $n_c++; } if ($pmb_gestion_amende) { $cpt_id = comptes::get_compte_id_from_empr($this->id, 2); $cpt = new comptes($cpt_id); $solde = $cpt->update_solde(); $novalid = $cpt->summarize_transactions("", "", 0, 0); if ($cpt_id) { //Calcul des amendes $amende = new amende($this->id, true); $total_amende = $amende->get_total_amendes(); $this->nb_amendes = $amende->nb_amendes; $compte .= "<div class='colonne4'><div><strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=2'>" . $msg["finance_solde_amende"] . "</a></strong> " . comptes::format($solde) . "</div>"; if ($novalid) { $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>"; } if ($total_amende) { $compte .= "<div> " . $msg["finance_pret_amende_en_cours"] . " : " . comptes::format($total_amende) . "</div>"; } $compte .= "</div>"; } $n_c++; } // Autre compte, que s'il y a des types de transaction $transactype = new transactype_list(); if ($transactype->get_count()) { $cpt_id = comptes::get_compte_id_from_empr($this->id, 4); $cpt = new comptes($cpt_id); $solde = $cpt->update_solde(); $novalid = $cpt->summarize_transactions("", "", 0, 0); $compte .= "\n\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<strong><a href='./circ.php?categ=pret&sub=compte&id=" . $this->id . "&typ_compte=4'>" . $msg["transactype_empr_compte"] . "</a></strong> " . comptes::format($solde) . "</div>"; if ($novalid) { $compte .= "<div>" . $msg["finance_not_validated"] . " : " . comptes::format($novalid) . "</div>"; } $n_c++; } if ($n_c < 3) { for ($i = $n_c; $i < 4; $i++) { $compte .= "<div class='colonne4'> </div>"; } } $compte .= "</div><div class='row'></div>"; } $this->compte = $compte; if ($pmb_gestion_amende && $pmb_gestion_financiere) { $this->relance .= $this->do_tablo_relance(); } // ces propriétés sont absentes de la table emprunteurs pour le moment // $this->adate = $empr->empr_??? ; // date d'abonnement // $this->rdate = $empr->empr_??? ; // date de réabonnement if ($this->message) { $this->message = $empr->message . '<hr />' . $this->message; } else { $this->message = $empr->message; } $order = " order by p.pret_retour, p.pret_date, e.expl_cb"; $requete_nb_pret = "select count(1) as nb_pret from pret where pret_idempr=" . $this->id; $result_nb_pret = mysql_query($requete_nb_pret, $dbh); $r_nb_pret = mysql_fetch_object($result_nb_pret); $this->nb_pret = $r_nb_pret->nb_pret; // récupération du tableau des exemplaires empruntés // il nous faut : code barre exemplaire, titre/auteur, type doc, date de pret, date de retour $requete = "select e.expl_cb, e.expl_id, e.expl_notice, docs_location.location_libelle, docs_location.idlocation, docs_section.section_libelle, e.expl_bulletin,"; $requete .= " p.pret_date, p.pret_retour, p.short_loan_flag, t.tdoc_libelle,"; $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour,"; $requete .= " if (pret_retour< CURDATE(),1 ,0 ) as retard , date_format(retour_initial, '" . $msg["format_date"] . "') as aff_retour_initial, cpt_prolongation"; $requete .= " from pret p, exemplaires e, docs_type t, docs_location, docs_section "; $requete .= " where p.pret_idempr=" . $this->id; $requete .= " and p.pret_idexpl=e.expl_id"; $requete .= " and e.expl_section=docs_section.idsection"; $requete .= " and e.expl_location=docs_location.idlocation"; $requete .= " and t.idtyp_doc=e.expl_typdoc"; $requete .= " " . $order; $result = mysql_query($requete, $dbh); $this->retard = 0; while ($pret = mysql_fetch_object($result)) { if ($pmb_sur_location_activate) { $sur_loc = sur_location::get_info_surloc_from_location($pret->idlocation); } if ($pret->expl_notice) { $notice = new mono_display($pret->expl_notice, 0); $this->prets[] = array('cb' => $pret->expl_cb, 'id' => $pret->expl_id, 'libelle' => $notice->header, 'typdoc' => $pret->tdoc_libelle, 'section' => $pret->section_libelle, 'location' => $pret->location_libelle, 'idlocation' => $pret->idlocation, 'date_pret' => $pret->aff_pret_date, 'date_retour' => $pret->aff_pret_retour, 'short_loan_flag' => $pret->short_loan_flag, 'sql_date_retour' => $pret->pret_retour, 'org_ret_date' => str_replace('-', '', $pret->pret_retour), 'pret_retard' => $pret->retard, 'retour_initial' => $pret->aff_retour_initial, 'cpt_prolongation' => $pret->cpt_prolongation, 'sur_location' => $sur_loc->libelle); } if ($pret->expl_bulletin) { $bulletin = new bulletinage_display($pret->expl_bulletin); $this->prets[] = array('cb' => $pret->expl_cb, 'id' => $pret->expl_id, 'libelle' => $bulletin->display, 'typdoc' => $pret->tdoc_libelle, 'section' => $pret->section_libelle, 'location' => $pret->location_libelle, 'idlocation' => $pret->idlocation, 'date_pret' => $pret->aff_pret_date, 'date_retour' => $pret->aff_pret_retour, 'short_loan_flag' => $pret->short_loan_flag, 'sql_date_retour' => $pret->pret_retour, 'org_ret_date' => str_replace('-', '', $pret->pret_retour), 'pret_retard' => $pret->retard, 'retour_initial' => $pret->aff_retour_initial, 'cpt_prolongation' => $pret->cpt_prolongation, 'sur_location' => $sur_loc->libelle); } $this->retard = $this->retard + $pret->retard; } $requete_resa = "select count(1) as nb_reservations "; $requete_resa .= " from resa "; $requete_resa .= " where resa_idempr=" . $this->id; $result_resa = mysql_query($requete_resa, $dbh); $resa = mysql_fetch_object($result_resa); $this->nb_reservations = $resa->nb_reservations; if ($pmb_resa_planning) { $requete_resa_planning = "select count(1) as nb_previsions "; $requete_resa_planning .= " from resa_planning "; $requete_resa_planning .= " where resa_idempr=" . $this->id; $result_resa_planning = mysql_query($requete_resa_planning, $dbh); $resa_planning = mysql_fetch_object($result_resa_planning); $this->nb_previsions = $resa_planning->nb_previsions; } return TRUE; }
<?php // +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: sur_location.inc.php,v 1.1 2011-04-20 06:27:21 ngantier Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } // gestion des sur-localisations require_once "{$class_path}/sur_location.class.php"; $sur_loc = new sur_location($id); switch ($action) { case 'update': $sur_loc->update(); print $sur_loc->do_list(); break; case 'add': print $sur_loc->do_form(); break; case 'modif': print $sur_loc->do_form(); break; case 'del': $sur_loc->delete(); print $sur_loc->do_list(); break; default: print $sur_loc->do_list(); break; }