예제 #1
0
function rec_pret($reader, $line)
{
    global $msg, $dbh;
    //Recherche du lecteur
    $requete = "select id_empr from empr where empr_cb='" . addslashes($reader) . "'";
    $resultat = pmb_mysql_query($requete);
    if (pmb_mysql_num_rows($resultat)) {
        $id_empr = pmb_mysql_result($resultat, 0, 0);
        //Recherche du lecteur
        $requete = "select expl_id from exemplaires where expl_cb='" . addslashes($line) . "'";
        $resultat = pmb_mysql_query($requete);
        if (pmb_mysql_num_rows($resultat)) {
            $expl_id = pmb_mysql_result($resultat, 0, 0);
            print pmb_bidi("<div class='erreur'>Prêt <a href='./circ.php?categ=visu_ex&form_cb_expl=" . rawurlencode($line) . "'>" . $line . "</a> pour <a href='./circ.php?categ=pret&form_cb=" . rawurlencode($reader) . "'>" . $reader . "</a></div>");
            if (check_empr_secouru($id_empr)) {
                $empr_temp = new emprunteur($id_empr, '', FALSE, 1);
                $statut = check_document($expl_id, $id_empr);
                if ($statut->flag & ALREADY_LOANED || $statut->flag & ALREADY_BORROWED) {
                    if ($statut->flag & ALREADY_LOANED) {
                        print "\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t\t\t\t<span class='erreur'>{$msg['386']}</span></div>\n\t\t\t\t\t\t\t\t\t\t\t<br />";
                    }
                    if ($statut->flag & ALREADY_BORROWED) {
                        print "\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t\t\t\t<span class='erreur'>{$msg['387']}</span></div>\n\t\t\t\t\t\t\t\t\t\t\t<br />";
                    }
                } else {
                    if ($statut->flag && $statut->flag & HAS_RESA_GOOD) {
                        // archivage resa
                        $rqt_arch = "UPDATE resa_archive, resa SET resarc_pretee = 1 WHERE id_resa = '" . $statut->id_resa . "' AND resa_arc = resarc_id ";
                        pmb_mysql_query($rqt_arch, $dbh);
                        // suppression de la resa pour ce lecteur
                        del_resa($id_empr, $statut->idnotice, $statut->idbulletin, $statut->expl_cb);
                    }
                    // ajout du prêt
                    add_pret($id_empr, $expl_id, $line);
                    print "<div class='erreur'>effectué</div>";
                }
            } else {
                print "<div class='erreur'>" . $reader . " : Lecteur inconnu" . "</div>";
            }
        } else {
            print "<div class='erreur'>" . $line . " : Exemplaire inconnu" . "</div>";
        }
    } else {
        print "<div class='erreur'>" . $reader . " : Lecteur inconnu" . "</div>";
    }
}
예제 #2
0
파일: pret.inc.php 프로젝트: hogsim/PMB
 if ($pmb_antivol > 0) {
     $rqt = "SELECT type_antivol FROM exemplaires WHERE expl_id='" . $id_expl . "' ";
     $result = pmb_mysql_query($rqt, $dbh);
     $expl = pmb_mysql_fetch_object($result);
     $type_antivol = $expl->type_antivol;
     if ($type_antivol == 1) {
         // c'est un support non magnétique (livre, revue...)
         print "{$script_magnetique}" . "magnetise('DDD');</script>";
     }
     if ($type_antivol == 2) {
         //c'est un support magnétique (cassette)
         print "{$script_magnetique}" . "magnetise('SSS');</script>";
     }
 }
 //Vérification de la validité du document
 $statut = check_document($id_expl, $id_empr);
 // check_document remonte $statut->notice_id et $statut->bulletin_id
 if ($statut->notice_id) {
     $notice_temp = new mono_display($statut->notice_id, 0);
     $titre_prete = $notice_temp->header;
 } elseif ($statut->bulletin_id) {
     $bulletin_temp = new bulletinage_display($statut->bulletin_id);
     $titre_prete = $bulletin_temp->display;
 } else {
     $titre_prete = "";
 }
 $titre_prete = "<b>" . $titre_prete . "<br />" . $cb_doc . "</b> {$statut->tdoc_libelle} {$statut->location_libelle} {$statut->section_libelle} <b>{$statut->expl_cote}</b>";
 //Y-a-t-il un quota ?
 if (!$expl_todo && $deflt_docs_location) {
     $sql = "SELECT expl_retloc FROM exemplaires where expl_retloc='" . $deflt_docs_location . "' and  expl_id='" . $id_expl . "' ";
     $req = pmb_mysql_query($sql) or die($msg["err_sql"] . "<br />" . $sql . "<br />" . pmb_mysql_error());