コード例 #1
0
ファイル: expl.class.php プロジェクト: hogsim/PMB
 function fill_form(&$form, $action)
 {
     global $charset;
     global $msg;
     global $pmb_antivol;
     global $option_num_auto;
     global $dbh;
     global $pmb_expl_show_dates;
     global $thesaurus_concepts_active;
     if (isset($option_num_auto)) {
         $requete = "DELETE from exemplaires_temp where sess not in (select SESSID from sessions)";
         pmb_mysql_query($requete, $dbh);
         //Appel à la fonction de génération automatique de cb
         $code_exemplaire = init_gen_code_exemplaire($this->id_notice, $this->id_bulletin);
         do {
             $code_exemplaire = gen_code_exemplaire($this->id_notice, $this->id_bulletin, $code_exemplaire);
             $requete = "select expl_cb from exemplaires WHERE expl_cb='{$code_exemplaire}'";
             $res0 = pmb_mysql_query($requete, $dbh);
             $requete = "select cb from exemplaires_temp WHERE cb='{$code_exemplaire}' AND sess <>'" . SESSid . "'";
             $res1 = pmb_mysql_query($requete, $dbh);
         } while (pmb_mysql_num_rows($res0) || pmb_mysql_num_rows($res1));
         //Memorise dans temps le cb et la session pour le cas de multi utilisateur session
         $this->cb = $code_exemplaire;
         $requete = "INSERT INTO exemplaires_temp (cb ,sess) VALUES ('{$this->cb}','" . SESSid . "')";
         pmb_mysql_query($requete, $dbh);
     }
     $form = str_replace('!!action!!', $action, $form);
     if ($this->id_notice) {
         $form = str_replace('!!id!!', $this->id_notice, $form);
     } else {
         $form = str_replace('!!id!!', $this->id_bulletin, $form);
     }
     $form = str_replace('!!cb!!', htmlentities($this->cb, ENT_QUOTES, $charset), $form);
     $form = str_replace('!!nbparts!!', htmlentities($this->nbparts, ENT_QUOTES, $charset), $form);
     $form = str_replace('!!note!!', htmlentities($this->note, ENT_QUOTES, $charset), $form);
     $form = str_replace('!!comment!!', htmlentities($this->expl_comment, ENT_QUOTES, $charset), $form);
     if ($this->id_notice) {
         $form = str_replace('!!cote!!', htmlentities(prefill_cote($this->id_notice, $this->cote), ENT_QUOTES, $charset), $form);
     } else {
         $form = str_replace('!!cote!!', htmlentities(prefill_cote($this->id_bulletin_notice, $this->cote), ENT_QUOTES, $charset), $form);
     }
     $form = str_replace('!!prix!!', htmlentities($this->prix, ENT_QUOTES, $charset), $form);
     // select "type document"
     $form = str_replace('!!type_doc!!', do_selector('docs_type', 'f_ex_typdoc', $this->typdoc_id), $form);
     // select "section"
     $form = str_replace('!!section!!', $this->do_selector(), $form);
     // select "statut"
     $form = str_replace('!!statut!!', do_selector('docs_statut', 'f_ex_statut', $this->statut_id), $form);
     // select "localisation"
     //visibilité des exemplaires
     global $explr_visible_mod, $pmb_droits_explr_localises;
     if ($pmb_droits_explr_localises) {
         $where_clause_explr = "idlocation in (" . $explr_visible_mod . ") and";
     }
     $form = str_replace('!!localisation!!', gen_liste("select distinct idlocation, location_libelle from docs_location, docsloc_section where {$where_clause_explr} num_location=idlocation order by 2 ", "idlocation", "location_libelle", 'f_ex_location', "calcule_section(this);", $this->location_id, "", "", "", "", 0), $form);
     // select "code statistique"
     $form = str_replace('!!codestat!!', do_selector('docs_codestat', 'f_ex_cstat', $this->codestat_id), $form);
     if ($pmb_antivol) {
         global $value_deflt_antivol;
         if ($this->type_antivol == "") {
             $this->type_antivol = $value_deflt_antivol;
         }
         // select "type_antivol"
         $selector = "<select name='type_antivol' id='type_antivol'>";
         $selector .= "<option value='0'";
         if ($this->type_antivol == 0) {
             $selector .= ' selected="selected"';
         }
         $selector .= '>';
         $selector .= $msg["type_antivol_aucun"] . '</option>';
         $selector .= "<option value='1'";
         if ($this->type_antivol == 1) {
             $selector .= ' selected="selected"';
         }
         $selector .= '>';
         $selector .= $msg["type_antivol_magnetique"] . '</option>';
         $selector .= "<option value='2'";
         if ($this->type_antivol == 2) {
             $selector .= ' selected="selected"';
         }
         $selector .= '>';
         $selector .= $msg["type_antivol_autre"] . '</option>';
         $selector .= '</select>';
     } else {
         $selector = "";
     }
     $form = str_replace('!!type_antivol!!', $selector, $form);
     // select "owner"
     $form = str_replace('!!owner!!', do_selector('lenders', 'f_ex_owner', $this->owner_id), $form);
     //dates creation / modification
     if ($this->expl_id && ($pmb_expl_show_dates == '1' || $pmb_expl_show_dates == '3')) {
         $form = str_replace('<!-- msg_exp_cre_date -->', "<label class='etiquette' >" . htmlentities($msg['exp_cre_date'], ENT_QUOTES, $charset) . "</label>", $form);
         $form = str_replace('<!-- exp_cre_date -->', format_date($this->create_date), $form);
         $form = str_replace('<!-- msg_exp_upd_date -->', "<label class='etiquette' >" . htmlentities($msg['exp_upd_date'], ENT_QUOTES, $charset) . "</label>", $form);
         $form = str_replace('<!-- exp_upd_date -->', format_date($this->update_date), $form);
     }
     //dates dépôt / retour
     if ($this->expl_id && ($pmb_expl_show_dates == '2' || $pmb_expl_show_dates == '3')) {
         $form = str_replace('<!-- msg_exp_filing_date -->', "<label class='etiquette' >" . htmlentities($msg['filing_date'], ENT_QUOTES, $charset) . "</label>", $form);
         $form = str_replace('<!-- exp_filing_date -->', format_date($this->date_depot), $form);
         $form = str_replace('<!-- msg_exp_return_date -->', "<label class='etiquette' >" . htmlentities($msg['return_date'], ENT_QUOTES, $charset) . "</label>", $form);
         $form = str_replace('<!-- exp_return_date -->', format_date($this->date_retour), $form);
     }
     // Indexation concept
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->expl_id, TYPE_EXPL);
         $form = str_replace('<!-- index_concept_form -->', $index_concept->get_form("expl"), $form);
     }
     $p_perso = new parametres_perso("expl");
     if (!$p_perso->no_special_fields) {
         $c = 0;
         $perso = "<hr />";
         $perso_ = $p_perso->show_editable_fields($this->expl_id);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($c == 0) {
                 $perso .= "<div class='row'>\n";
             }
             $perso .= "<div class='colonne2'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label><div class='row'>" . $p["AFF"] . "</div></div>\n";
             $c++;
             if ($c == 2) {
                 $perso .= "</div>\n";
                 $c = 0;
             }
         }
         if ($c == 1) {
             $perso .= "<div class='colonne2'>&nbsp;</div>\n</div>\n";
         }
         $perso = $perso_["CHECK_SCRIPTS"] . "\n" . $perso;
     } else {
         $perso = "\n<script>function check_form() { return true; }</script>\n";
     }
     $form = str_replace("!!champs_perso!!", $perso, $form);
     //Remplissage ajax de la cote
     global $pmb_prefill_cote_ajax, $pmb_antivol;
     if ($pmb_prefill_cote_ajax) {
         $expl_ajax_cote = " completion='expl_cote' listfield='" . $this->ajax_cote_fields . ",f_ex_cb,f_ex_typdoc,f_ex_location,f_ex_owner,f_ex_statut,f_ex_cstat" . ($pmb_antivol > 0 ? ",type_antivol" : "") . "' ";
     } else {
         $expl_ajax_cote = "";
     }
     $form = str_replace("!!expl_ajax_cote!!", $expl_ajax_cote, $form);
 }
コード例 #2
0
            print "impossible d'accéder à cet exemplaire.";
        }
    } else {
        // création d'un exemplaire
        // avant toute chose, on regarde si ce cb n'existe pas déjà
        $requete = "SELECT count(1) FROM exemplaires WHERE expl_cb='" . $noex . "' ";
        $myQuery = pmb_mysql_query($requete, $dbh);
        if (!pmb_mysql_result($myQuery, 0, 0)) {
            $expl = new stdClass();
            $expl->expl_cb = $noex;
            $expl->expl_id = 0;
            $expl->expl_bulletin = $bul_id;
            $expl->expl_location = $deflt_docs_location;
            $expl->expl_section = $deflt_docs_section;
            $expl->expl_codestat = $deflt_docs_codestat;
            $expl->expl_typdoc = $deflt_docs_type;
            $expl->expl_statut = $deflt_docs_statut;
            $expl->expl_owner = $deflt_lenders;
            $expl_create_date = '';
            $expl_update_date = '';
            $bulletin = new bulletinage($bul_id);
            $expl->expl_cote = prefill_cote($bulletin->bulletin_notice);
            print bul_do_form($expl);
        } else {
            print "<div class=\"row\"><div class=\"msg-perio\" size=\"+2\">" . $msg["expl_message_code_utilise"] . "</div></div>";
            print "<div class=\"row\"><a href=\"./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=";
            print $bulletinage->bul_id;
            print "\">Retour</a></div>";
        }
    }
}