public function get_data_empr($id_empr)
 {
     global $dbh, $pmb_gestion_financiere, $pmb_gestion_abonnement, $pmb_gestion_tarif_prets, $pmb_gestion_amende;
     $empr = get_info_empr($id_empr);
     $i = count($this->data["empr_list"]);
     $this->data["empr_list"][$i]["name"] = $empr->nom;
     $this->data["empr_list"][$i]["fistname"] = $empr->prenom;
     $this->data["empr_list"][$i]["cb"] = $empr->cb;
     $this->data["empr_list"][$i]["aff_date_adhesion"] = $empr->aff_date_adhesion;
     $this->data["empr_list"][$i]["aff_date_expiration"] = $empr->aff_date_expiration;
     $this->data["empr_list"][$i]["categorie"] = $empr->cat_l;
     if ($pmb_gestion_financiere) {
         $this->data["empr_list"][$i]["compte_abonnement"]["solde"] = "";
         $this->data["empr_list"][$i]["compte_abonnement"]["novalid"] = "";
         // abonnement
         if ($pmb_gestion_abonnement) {
             $cpt_id = comptes::get_compte_id_from_empr($id_empr, 1);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             $this->data["empr_list"][$i]["compte_abonnement"]["solde"] = $solde;
             $this->data["empr_list"][$i]["compte_abonnement"]["novalid"] = $novalid;
         }
         // prets
         $this->data["empr_list"][$i]["compte_pret"]["solde"] = "";
         $this->data["empr_list"][$i]["compte_pret"]["novalid"] = "";
         if ($pmb_gestion_tarif_prets) {
             $cpt_id = comptes::get_compte_id_from_empr($id_empr, 3);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             $this->data["empr_list"][$i]["compte_pret"]["solde"] = $solde;
             $this->data["empr_list"][$i]["compte_pret"]["novalid"] = $novalid;
         }
         // amendes
         $this->data["empr_list"][$i]["compte_amende"]["solde"] = "";
         $this->data["empr_list"][$i]["compte_amende"]["novalid"] = "";
         if ($pmb_gestion_amende) {
             $cpt_id = comptes::get_compte_id_from_empr($id_empr, 2);
             $cpt = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             $this->data["empr_list"][$i]["compte_amende"]["solde"] = $solde;
             $this->data["empr_list"][$i]["compte_amende"]["novalid"] = $novalid;
         }
         // Autre compte
         $this->data["empr_list"][$i]["compte_autre"]["solde"] = "";
         $this->data["empr_list"][$i]["compte_autre"]["novalid"] = "";
         $transactype = new transactype_list();
         if ($transactype->get_count()) {
             $cpt_id = comptes::get_compte_id_from_empr($id_empr, 4);
             $cpte = new comptes($cpt_id);
             $solde = $cpt->update_solde();
             $novalid = $cpt->summarize_transactions("", "", 0, 0);
             $this->data["empr_list"][$i]["compte_autre"]["solde"] = $solde;
             $this->data["empr_list"][$i]["compte_autre"]["novalid"] = $novalid;
         }
     }
     return $this->data["empr_list"][$i];
 }
示例#2
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'>&nbsp;</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;
 }