function get_relance($id_empr) { global $dbh, $charset, $msg, $pmb_gestion_financiere, $pmb_gestion_amende; global $pmb_lecteurs_localises; // liste des relances if ($pmb_gestion_financiere && $pmb_gestion_amende) { $amende = new amende($id_empr); $level = $amende->get_max_level(); $niveau_min = $level["level_min"]; $id_expl = $level["level_min_id_expl"]; $total_amende = $amende->get_total_amendes(); } $niveau_suppose = $level["level_normal"]; $cpt_id = comptes::get_compte_id_from_empr($id_empr, 2); $cpt = new comptes($cpt_id); $frais_relance = $cpt->summarize_transactions("", "", 0, $realisee = -1); if ($frais_relance < 0) { $frais_relance = -$frais_relance; } else { $frais_relance = 0; } $empr = new emprunteur($id_empr, '', FALSE, 0); //Groupes if (count($empr->groupes)) { $lib_groupes = strip_tags(implode(" / ", $empr->groupes)); } else { $lib_groupes = ""; } $info_empr = "\n\t<td>" . $empr->cb . "</td>\n\t<td>" . $empr->nom . "</td>\n\t<td>" . $empr->prenom . "</td>\n\t<td>" . $empr->adr1 . "</td>\n\t<td>" . $empr->adr2 . "</td>\n\t<td>" . $empr->cp . "</td>\n\t<td>" . $empr->ville . "</td>\n\t<td>" . $empr->mail . "</td>\n\t<td>" . $empr->tel1 . "</td>\n\t<td>" . $empr->tel2 . "</td>\n\t" . ($pmb_lecteurs_localises ? "<td>" . $empr->empr_location_l . "</td>" : "") . "\n\t<td>" . $empr->cat_l . "</td>\n\t<td>" . $empr->cstat_l . "</td>\n\t<td>" . $empr->empr_statut_libelle . "</td>\n\t<td>" . $lib_groupes . "</td>\n\t<td>" . $niveau_suppose . "</td>\n\t<td>" . $total_amende . "</td>\n\t<td>" . $frais_relance . "</td>\n\t"; $reqexpl = "select pret_idexpl as expl from pret where pret_retour<CURDATE() and pret_idempr={$id_empr}"; $resexple = pmb_mysql_query($reqexpl, $dbh); while ($liste = pmb_mysql_fetch_object($resexple)) { $dates_resa_sql = " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour "; $requete = "SELECT notices_m.notice_id as m_id, notices_s.notice_id as s_id, pret_idempr, expl_id, expl_cb,expl_cote, pret_date, pret_retour,\n\t\tniveau_relance,\n\t\tdate_relance,\n\t\tprinted,\t\t\n\t\ttdoc_libelle, section_libelle, location_libelle, trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date!='', concat(' (',mention_date,')') ,''))) as tit, " . $dates_resa_sql . ", "; $requete .= " notices_m.tparent_id, notices_m.tnvol "; $requete .= " FROM (((exemplaires LEFT JOIN notices AS notices_m ON expl_notice = notices_m.notice_id ) LEFT JOIN bulletins ON expl_bulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), docs_type, docs_section, docs_location, pret "; $requete .= " WHERE expl_id='" . $liste->expl . "' and expl_typdoc = idtyp_doc and expl_section = idsection and expl_location = idlocation and pret_idexpl = expl_id "; $res_det_expl = pmb_mysql_query($requete); $expl = pmb_mysql_fetch_object($res_det_expl); $amd = $amende->get_amende($liste->expl); $reqlog = "select sum(log.log_printed) as printed, sum(log.log_mail) as mail\n\t\t\tfrom log_retard as log, log_expl_retard as expl where log.idempr={$id_empr} and log.niveau_reel='" . $expl->niveau_relance . "'\n\t\t \tand expl.num_log_retard=log.id_log and expl_id='" . $liste->expl . "' "; $reslog = pmb_mysql_query($reqlog); if ($log = pmb_mysql_fetch_object($reslog)) { $printed = $log->printed; $mail = $log->mail; } else { $printed = 0; $mail = 0; } $info .= "\n\t\t<tr>\n\t\t\t{$info_empr}\n\t\t\t<td>" . htmlentities($expl->tit, ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . htmlentities($expl->expl_cb, ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . format_date($expl->pret_date) . "</td>\n\t\t\t<td>" . format_date($expl->pret_retour) . "</td>\n\t\t\t<td>" . $expl->niveau_relance . "</td>\n\t\t\t<td>" . format_date($expl->date_relance) . "</td>\n\t\t\t<td>" . htmlentities($mail, ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . htmlentities($printed, ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . htmlentities($amd["valeur"], ENT_QUOTES, $charset) . "</td>\n\t\t</tr>\n\t\t"; } return $info; }
function print_relance($id_empr, $mail = true) { global $mailretard_priorite_email, $mailretard_priorite_email_3; global $dbh, $charset, $msg, $pmb_gestion_financiere, $pmb_gestion_amende; global $mail_sended; $mail_sended = 0; $not_mail = 0; if ($pmb_gestion_financiere && $pmb_gestion_amende) { $req = "delete from cache_amendes where id_empr=" . $id_empr; pmb_mysql_query($req); $amende = new amende($id_empr); $level = $amende->get_max_level(); $niveau_min = $level["level_min"]; $id_expl = $level["level_min_id_expl"]; $total_amende = $amende->get_total_amendes(); } //Si mail de rappel affecté au groupe, on envoi au responsable $requete = "select id_groupe,resp_groupe from groupe,empr_groupe where id_groupe=groupe_id and empr_id={$id_empr} and resp_groupe and mail_rappel limit 1"; $res = pmb_mysql_query($requete); if (pmb_mysql_num_rows($res) > 0) { $requete = "select empr_mail from empr where id_empr='" . pmb_mysql_result($res, 0, 1) . "'"; $res = pmb_mysql_query($requete); if (@pmb_mysql_num_rows($res)) { list($empr_mail) = pmb_mysql_fetch_row($res); } } else { $requete = "select empr_mail from empr where id_empr={$id_empr}"; $resultat = pmb_mysql_query($requete); if (@pmb_mysql_num_rows($resultat)) { list($empr_mail) = pmb_mysql_fetch_row($resultat); } } if ($niveau_min) { //Si c'est un mail if (($mailretard_priorite_email == 1 || $mailretard_priorite_email == 2) && $empr_mail && ($niveau_min < 3 || $mailretard_priorite_email_3) && $mail) { if (send_mail($id_empr, $niveau_min)) { $requete = "update pret set printed=1 where pret_idexpl=" . $id_expl; pmb_mysql_query($requete, $dbh); $mail_sended = 1; } } else { $requete = "update pret set printed=2 where pret_idexpl=" . $id_expl; pmb_mysql_query($requete, $dbh); $not_mail = 1; //Débit du compte lecteur /*$frais="finance_relance_".$niveau_min; global $$frais; if ($$frais) { $id_compte=comptes::get_compte_id_from_empr($id_empr,2); if ($id_compte) { $cpte=new comptes($id_compte); $cpte->record_transaction("",$$frais,-1,sprintf($msg["relance_frais_relance_level"],$niveau_min)); } }*/ } } $req = "delete from cache_amendes where id_empr=" . $id_empr; pmb_mysql_query($req); //On loggue les infos de la lettre $niveau_courant = $niveau_min; if ($niveau_courant) { $niveau_suppose = $level["level_normal"]; $cpt_id = comptes::get_compte_id_from_empr($id_empr, 2); $cpt = new comptes($cpt_id); $solde = $cpt->update_solde(); $frais_relance = $cpt->summarize_transactions("", "", 0, $realisee = -1); if ($frais_relance < 0) { $frais_relance = -$frais_relance; } else { $frais_relance = 0; } $req = "insert into log_retard (niveau_reel,niveau_suppose,amende_totale,frais,idempr,log_printed,log_mail) values('" . $niveau_courant . "','" . $niveau_suppose . "','" . $total_amende . "','" . $frais_relance . "','" . $id_empr . "', '" . $not_mail . "', '" . $mail_sended . "')"; pmb_mysql_query($req, $dbh); $id_log_ret = pmb_mysql_insert_id(); $reqexpl = "select pret_idexpl as expl from pret where pret_retour<\tCURDATE() and pret_idempr={$id_empr}"; $resexple = pmb_mysql_query($reqexpl, $dbh); while ($liste = pmb_mysql_fetch_object($resexple)) { $dates_resa_sql = " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour "; $requete = "SELECT notices_m.notice_id as m_id, notices_s.notice_id as s_id, pret_idempr, expl_id, expl_cb,expl_cote, pret_date, pret_retour, tdoc_libelle, section_libelle, location_libelle, trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date!='', concat(' (',mention_date,')') ,''))) as tit, " . $dates_resa_sql . ", "; $requete .= " notices_m.tparent_id, notices_m.tnvol "; $requete .= " FROM (((exemplaires LEFT JOIN notices AS notices_m ON expl_notice = notices_m.notice_id ) LEFT JOIN bulletins ON expl_bulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), docs_type, docs_section, docs_location, pret "; $requete .= " WHERE expl_id='" . $liste->expl . "' and expl_typdoc = idtyp_doc and expl_section = idsection and expl_location = idlocation and pret_idexpl = expl_id "; $res_det_expl = pmb_mysql_query($requete); $expl = pmb_mysql_fetch_object($res_det_expl); if ($pmb_gestion_financiere && $pmb_gestion_amende) { $amd = $amende->get_amende($liste->expl); } $req_ins = "insert into log_expl_retard (titre,expl_id,expl_cb,date_pret,date_retour,amende,num_log_retard) values('" . addslashes($expl->tit) . "','" . $expl->expl_id . "','" . $expl->expl_cb . "','" . $expl->pret_date . "','" . $expl->pret_retour . "','" . $amd["valeur"] . "','" . $id_log_ret . "')"; pmb_mysql_query($req_ins, $dbh); } } return $not_mail; }
function fetch_data() { global $dbh; global $msg; global $charset; global $val_list_empr; global $pmb_gestion_financiere, $pmb_gestion_abonnement, $pmb_gestion_tarif_prets, $pmb_gestion_amende; global $deflt_docs_location; if (!$this->id_empr || !$dbh) { return FALSE; } $requete = "SELECT e.*, c.libelle AS code1, s.libelle AS code2, es.statut_libelle AS empr_statut_libelle, allow_loan, allow_book, allow_opac, allow_dsi, allow_dsi_priv, allow_sugg, allow_prol, d.location_libelle as localisation, date_format(empr_date_adhesion, '" . $msg["format_date"] . "') as aff_empr_date_adhesion, date_format(empr_date_expiration, '" . $msg["format_date"] . "') as aff_empr_date_expiration FROM empr e left join docs_location as d on e.empr_location=d.idlocation, empr_categ c, empr_codestat s, empr_statut es "; $requete .= " WHERE e.id_empr='" . $this->id_empr . "' "; $requete .= " AND c.id_categ_empr=e.empr_categ"; $requete .= " AND s.idcode=e.empr_codestat"; $requete .= " AND es.idstatut=e.empr_statut"; $requete .= " LIMIT 1"; $result = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . " " . $requete); if (!pmb_mysql_num_rows($result)) { return FALSE; } $empr = pmb_mysql_fetch_object($result); // affectation des propriétés $this->empr_cb = $empr->empr_cb; // code barre emprunteur $this->empr_nom = $empr->empr_nom; // nom emprunteur $this->empr_prenom = $empr->empr_prenom; // prénom mprunteur $this->empr_adr1 = $empr->empr_adr1; // adresse ligne 1 $this->empr_adr2 = $empr->empr_adr2; // adresse ligne 2 $this->empr_cp = $empr->empr_cp; // code postal $this->empr_ville = $empr->empr_ville; // ville $this->empr_pays = $empr->empr_pays; // ville $this->empr_mail = $empr->empr_mail; // adresse email $this->empr_tel1 = $empr->empr_tel1; // téléphone 1 $this->empr_tel2 = $empr->empr_tel2; // téléphone 2 $this->empr_prof = $empr->empr_prof; // profession $this->empr_year = $empr->empr_year; // année de naissance $this->empr_categ = $empr->empr_categ; // catégorie emprunteur $this->empr_codestat = $empr->empr_codestat; // code statistique $this->empr_creation = $empr->empr_creation; // date de création $this->empr_modif = $empr->empr_modif; // date de modification $this->empr_sexe = $empr->empr_sexe; // sexe de l'emprunteur $this->empr_login = $empr->empr_login; // login pour services OPAC $this->empr_password = $empr->empr_password; // mot de passe OPAC $this->empr_ldap = $empr->empr_ldap; $this->type_abt = $empr->type_abt; // type d'abonnement $this->empr_location = $empr->empr_location; // localisation $this->empr_location_l = $empr->localisation; // localisation $this->date_fin_blocage = $empr->date_fin_blocage; // Date de fin de blocage de l'emprunteur $this->empr_statut = $empr->empr_statut; $this->empr_statut_l = $empr->empr_statut_libelle; $this->total_loans = $empr->total_loans; $this->date_adhesion = $empr->empr_date_adhesion; // début adhésion $this->date_expiration = $empr->empr_date_expiration; // fin adhésion $this->aff_date_adhesion = $empr->aff_empr_date_adhesion; // début adhésion $this->aff_date_expiration = $empr->aff_empr_date_expiration; // fin adhésion $this->empr_msg = $empr->empr_msg; // message emprunteur $this->cat_l = $empr->code1; // libellé catégorie emprunteur $this->cstat_l = $empr->code2; // libellé code statistique. voir ce bug avec Eric $this->allow_loan = $empr->allow_loan; $this->allow_book = $empr->allow_book; $this->allow_opac = $empr->allow_opac; $this->allow_dsi = $empr->allow_dsi; $this->allow_dsi_priv = $empr->allow_dsi_priv; $this->allow_sugg = $empr->allow_sugg; $this->allow_prol = $empr->allow_prol; global $selector_prop_ajout_caddie_empr, $empr_show_caddie; if ($empr_show_caddie) { $this->img_ajout_empr_caddie = "<img src='./images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('./cart.php?object_type=EMPR&item=" . $this->id . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">"; } else { $this->img_ajout_empr_caddie = ""; } $this->lien_nom_prenom = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($this->cb) . "'>{$this->nom}, {$this->prenom}</a>"; $date_blocage = array(); $date_blocage = explode("-", $this->date_fin_blocage); if (mktime(0, 0, 0, $date_blocage[1], $date_blocage[2], $date_blocage[0]) > time()) { $this->blocage_active = true; } //Groupes $requete = "select id_groupe, libelle_groupe from groupe, empr_groupe where empr_id='" . $this->id . "' and id_groupe=groupe_id"; $result = pmb_mysql_query($requete); if (pmb_mysql_num_rows($result)) { while ($grp_temp = pmb_mysql_fetch_object($result)) { $this->groupes[] = "<a href='./circ.php?categ=groups&action=showgroup&groupID=" . $grp_temp->id_groupe . "'>" . htmlentities($grp_temp->libelle_groupe, ENT_QUOTES, $charset) . "</a>"; } } else { $this->groupes = array(); } //Paramètres perso //Liste des champs $p_perso = new parametres_perso("empr"); $perso_ = $p_perso->show_fields($this->id_empr); $perso = ""; $class = "colonne3"; $c = 0; if (count($perso_["FIELDS"])) { for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; $perso .= "<div class='{$class}'>"; $perso .= "<div class='row'>" . $p["TITRE"]; $perso .= $p["AFF"] . "</div>"; $perso .= "</div>"; if ($c == 0) { $c = 1; } else { if ($c == 1) { $class = "colonne_suite"; $c = 2; } else { if ($c == 2) { $class = "colonne3"; $c = 0; } } } } $reste = 2 - $c; if ($c != 0) { for ($i = 0; $i < $reste; $i++) { $perso .= "<div class='colonne3'> </div>"; $c++; } $perso .= "<div class='colonne_suite'> </div>"; } } $this->perso = $perso; //Comptes si gestion financiere if ($pmb_gestion_financiere) { $compte = ""; $n_c = 0; $neg = "<span class='erreur'>%s</span>"; $pos = "%s"; $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='colonne3'><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='colonne3'><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); $total_amende = $amende->get_total_amendes(); $compte .= "<div class='colonne3'><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++; } if ($n_c < 2) { for ($i = $n_c; $i < 3; $i++) { $compte .= "<div class='colonne3'> </div>"; } } $compte .= "</div><div class='row'></div>"; } $this->compte = $compte; }
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]; }
function do_fiche_compte($typ_compte) { global $msg, $charset; global $empr_comptes_tmpl; global $empr_autre_compte_tmpl; global $show_transactions, $date_debut; $this->fiche_compte = ""; if ($typ_compte == 4) { $form = $empr_autre_compte_tmpl; } else { $form = $empr_comptes_tmpl; } $form = str_replace("!!nom!!", $this->nom, $form); $form = str_replace("!!prenom!!", $this->prenom, $form); $form = str_replace("!!info_nb_pret!!", $this->nb_pret, $form); $form = str_replace("!!info_nb_resa!!", $this->nb_reservations, $form); $id_compte = comptes::get_compte_id_from_empr($this->id, $typ_compte); if ($id_compte) { $cpte = new comptes($id_compte); if (!$show_transactions) { $show_transactions = 2; } $form = str_replace("!!id_compte!!", $id_compte, $form); $form = str_replace("!!type_compte!!", $cpte->get_typ_compte_lib($typ_compte), $form); $form = str_replace("!!typ_compte!!", $typ_compte, $form); $form = str_replace("!!solde!!", comptes::format($cpte->get_solde()), $form); $form = str_replace("!!non_valide!!", comptes::format($cpte->summarize_transactions("", "", 0, 0)), $form); $form = str_replace("!!show_transactions!!", $show_transactions, $form); $form = str_replace("!!date_debut!!", htmlentities(stripslashes($date_debut), ENT_QUOTES, $charset), $form); if (!$show_transactions) { $show_transactions = 1; } for ($i = 1; $i <= 3; $i++) { if ($i == $show_transactions) { $form = str_replace("!!checked{$i}!!", "checked", $form); } else { $form = str_replace("!!checked{$i}!!", "", $form); } } } if ($typ_compte == 4) { // autre compte: afficher les types de transaction... $transactype = new transactype_list(); $type_transac_list = $transactype->get_data(); foreach ($type_transac_list as $transac) { if ($transac["quick_allowed"] && $transac["unit_price"] > 0) { $transac_form .= "\r\n\t\t\t\t\t<input type='button' class='bouton_small' value='" . htmlentities($transac["name"], ENT_QUOTES, $charset) . "'\n\t\t\t\t\t id='transactype_" . $transac["id"] . "' unit_price='" . $transac["unit_price"] . "' \n\t\t\t\t\t onclick=\"sel_type_transactype('" . $transac["id"] . "',this.id,this.value,this.getAttribute('unit_price'));\" align='middle'\r\n\t\t\t\t\t>"; } elseif ($transac["quick_allowed"]) { $transac_form .= "\r\n\t\t\t\t\t<input type='button' class='bouton_small' value='" . htmlentities($transac["name"], ENT_QUOTES, $charset) . "'\n\t\t\t\t\t id='" . $transac["id"] . "' unit_price='" . $transac["unit_price"] . "' \n\t\t\t\t\t onclick=\"sel_type_transactype('" . $transac["id"] . "',this.id,this.value,this.getAttribute('unit_price'));\" align='middle'\n\t\t\t\t\t>"; } } $form = str_replace("!!transactype_list!!", $transac_form, $form); } $this->fiche_compte = $form; }
function lettre_retard_par_lecteur($id_empr) { global $dbh, $msg, $pmb_gestion_financiere, $pmb_gestion_amende, $niveau; //Pour les amendes $valeur = 0; //Calcul des frais de relance if ($pmb_gestion_financiere && $pmb_gestion_amende) { $id_compte = comptes::get_compte_id_from_empr($id_empr, 2); if ($id_compte) { $cpte = new comptes($id_compte); $frais_relance = $cpte->summarize_transactions("", "", 0, $realisee = -1); if ($frais_relance < 0) { $frais_relance = -$frais_relance; } else { $frais_relance = 0; } } } if ($niveau != 3) { $rqt = "select expl_cb from pret, exemplaires where pret_idempr='" . $id_empr . "' and pret_retour < curdate() and pret_idexpl=expl_id order by pret_date "; $req = mysql_query($rqt, $dbh) or die($msg['err_sql'] . '<br />' . $rqt . '<br />' . mysql_error()); while ($data = mysql_fetch_array($req)) { $valeur += $this->expl_retard($data['expl_cb']); } $this->print_amendes($valeur, $frais_relance); $retards = "\t<retards>\n" . $this->expl_info . "\t</retards>\n"; } else { $requete = "select expl_cb from exemplaires, pret where pret_idempr={$id_empr} and pret_idexpl=expl_id and niveau_relance=3"; $res_recouvre = mysql_query($requete); while ($rrc = mysql_fetch_object($res_recouvre)) { $liste_r3[] = $rrc->expl_cb; } $rqt = "select expl_cb from pret, exemplaires where pret_idempr='" . $id_empr . "' and pret_retour < curdate() and pret_idexpl=expl_id order by pret_date "; $req = mysql_query($rqt, $dbh) or die($msg['err_sql'] . '<br />' . $rqt . '<br />' . mysql_error()); while ($data = mysql_fetch_object($req)) { // Pas répéter les retard si déjà en niveau 3 if (in_array($data->expl_cb, $liste_r3) === false) { $liste_r[] = $data->expl_cb; } } if ($liste_r) { // Il y a des retard simple: on affiche d'abord les retards simples foreach ($liste_r as $cb_expl) { $valeur += $this->expl_retard($cb_expl); } // affiche retards niveau 3 foreach ($liste_r3 as $cb_expl) { $valeur += $this->expl_retard($cb_expl, 3); } $this->print_amendes($valeur, $frais_relance); $retards = "\t<retards>\n" . $this->expl_info . "\t</retards>\n"; } else { // il n'y a que des retards niveau 3 foreach ($liste_r3 as $cb_expl) { $valeur += $this->expl_retard($cb_expl, 3); $retards .= $this->expl_info; } $this->print_amendes($valeur, $frais_relance); $retards = "\t<retards>\n" . $this->expl_info . "\t</retards>\n"; } } return $retards; }
function lettre_retard_par_lecteur($id_empr) { global $ourPDF, $dbh, $msg, $nb_page, $nb_1ere_page, $nb_par_page, $pmb_gestion_financiere, $pmb_gestion_amende, $niveau; global $pmb_pdf_font; // les variables sont lues en dehors global $marge_page_gauche, $marge_page_droite, $largeur_page, $fdp, $after_list, $limite_after_list, $before_list, $madame_monsieur, $nb_1ere_page, $nb_par_page, $taille_bloc_expl, $debut_expl_1er_page, $debut_expl_page, $before_recouvrement, $after_recouvrement; global $pmb_afficher_numero_lecteur_lettres; global $pmb_hide_biblioinfo_letter; //Pour les amendes $valeur = 0; $ourPDF->addPage(); //date_jour($largeur_page-$marge_page_droite-30,10); date_jour(($largeur_page - $marge_page_droite - $marge_page_gauche) / 2, 98); if (!$pmb_hide_biblioinfo_letter) { biblio_info($marge_page_gauche, 15); } lecteur_adresse($id_empr, $marge_page_gauche + 90, 45, $dbh, !$pmb_afficher_numero_lecteur_lettres, true, true); $rqt = "select empr_nom, empr_prenom from empr where id_empr='" . $id_empr . "'"; $req = mysql_query($rqt) or die('Erreur SQL !<br />' . $rqt . '<br />' . mysql_error()); $r = mysql_fetch_object($req); $texte_madame_monsieur = str_replace("!!empr_name!!", $r->empr_nom, $madame_monsieur); $texte_madame_monsieur = str_replace("!!empr_first_name!!", $r->empr_prenom, $texte_madame_monsieur); $ourPDF->SetXY($marge_page_gauche, 105); $ourPDF->setFont($pmb_pdf_font, '', 10); $ourPDF->multiCell($largeur_page - $marge_page_droite - $marge_page_gauche, 8, $texte_madame_monsieur, 0, 'L', 0); $ourPDF->SetXY($marge_page_gauche, $ourPDF->GetY() + 4); $ourPDF->multiCell($largeur_page - $marge_page_droite - $marge_page_gauche, 5, $before_list, 0, 'J', 0); //Calcul des frais de relance if ($pmb_gestion_financiere && $pmb_gestion_amende) { $id_compte = comptes::get_compte_id_from_empr($id_empr, 2); if ($id_compte) { $cpte = new comptes($id_compte); $frais_relance = $cpte->summarize_transactions("", "", 0, $realisee = -1); if ($frais_relance < 0) { $frais_relance = -$frais_relance; } else { $frais_relance = 0; } } } if ($niveau != 3) { $rqt = "select expl_cb from pret, exemplaires where pret_idempr='" . $id_empr . "' and pret_retour < curdate() and pret_idexpl=expl_id order by pret_date "; $req = mysql_query($rqt, $dbh) or die($msg['err_sql'] . '<br />' . $rqt . '<br />' . mysql_error()); while ($data = mysql_fetch_array($req)) { if (($pos_page = $ourPDF->GetY()) > 260) { $ourPDF->addPage(); $pos_page = $debut_expl_page; } $valeur += expl_retard($data['expl_cb'], $marge_page_gauche, $pos_page, $largeur_page - $marge_page_droite - $marge_page_gauche, 10, $dbh); } print_amendes($valeur, $frais_relance); $ourPDF->SetX($marge_page_gauche); $ourPDF->setFont($pmb_pdf_font, '', 10); } else { $requete = "select expl_cb from exemplaires, pret where pret_idempr={$id_empr} and pret_idexpl=expl_id and niveau_relance=3"; $res_recouvre = mysql_query($requete); while ($rrc = mysql_fetch_object($res_recouvre)) { $liste_r3[] = $rrc->expl_cb; } $rqt = "select expl_cb from pret, exemplaires where pret_idempr='" . $id_empr . "' and pret_retour < curdate() and pret_idexpl=expl_id order by pret_date "; $req = mysql_query($rqt, $dbh) or die($msg['err_sql'] . '<br />' . $rqt . '<br />' . mysql_error()); while ($data = mysql_fetch_object($req)) { // Pas répéter les retard si déjà en niveau 3 if (in_array($data->expl_cb, $liste_r3) === false) { $liste_r[] = $data->expl_cb; } } if ($liste_r) { // Il y a des retard simple: on affiche d'abord les retards simples foreach ($liste_r as $cb_expl) { if (($pos_page = $ourPDF->GetY()) > 260) { $ourPDF->addPage(); $pos_page = $debut_expl_page; } $valeur += expl_retard($cb_expl, $marge_page_gauche, $pos_page, $largeur_page - $marge_page_droite - $marge_page_gauche, 10, $dbh); } $ourPDF->setFont($pmb_pdf_font, '', 10); $ourPDF->multiCell($largeur_page - $marge_page_droite - $marge_page_gauche, 5, $before_recouvrement, 0, 'J', 0); // affiche retards niveau 3 foreach ($liste_r3 as $cb_expl) { if (($pos_page = $ourPDF->GetY()) > 260) { $ourPDF->addPage(); $pos_page = $debut_expl_page; } $valeur += expl_retard($cb_expl, $marge_page_gauche, $pos_page, $largeur_page - $marge_page_droite - $marge_page_gauche, 10, $dbh); } print_amendes($valeur, $frais_relance); } else { // il n'y a que des retards niveau 3 foreach ($liste_r3 as $cb_expl) { if (($pos_page = $ourPDF->GetY()) > 260) { $ourPDF->addPage(); $pos_page = $debut_expl_page; } $valeur += expl_retard($cb_expl, $marge_page_gauche, $pos_page, $largeur_page - $marge_page_droite - $marge_page_gauche, 10, $dbh); } print_amendes($valeur, $frais_relance); $ourPDF->setFont($pmb_pdf_font, '', 10); $ourPDF->multiCell($largeur_page - $marge_page_droite - $marge_page_gauche, 5, $after_recouvrement, 0, 'J', 0); } //if (($niveau==3)&&(($pmb_gestion_financiere)&&($pmb_gestion_amende))) { } $pos_page = $ourPDF->GetY(); //Récupère la position dans la page pour prendre en compte l'ajout ou non des informations d'amendes et éviter la superposition d'informations if ($pos_page + $taille_bloc_expl > $limite_after_list) { $ourPDF->addPage(); $pos_after_list = $debut_expl_page; } else { $pos_after_list = $pos_page + $taille_bloc_expl; } $ourPDF->SetXY($marge_page_gauche, $pos_after_list); $ourPDF->setFont($pmb_pdf_font, '', 10); $ourPDF->multiCell($largeur_page - $marge_page_droite - $marge_page_gauche, 5, $after_list, 0, 'J', 0); $ourPDF->setFont($pmb_pdf_font, 'I', 10); $ourPDF->multiCell($largeur_page - $marge_page_droite - $marge_page_gauche, 5, $fdp, 0, 'R', 0); }