Exemple #1
0
function get_expl($expl, $show_in_reception = 0, $return_count = false)
{
    global $msg, $dbh, $charset;
    global $base_path, $class_path;
    global $cart_link_non;
    global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises;
    global $pmb_transferts_actif;
    global $pmb_expl_list_display_comments;
    global $pmb_sur_location_activate;
    global $pmb_expl_data;
    // attention, $bul est un array
    if (!sizeof($expl) || !is_array($expl)) {
        return $msg["bull_no_expl"];
    }
    $explr_tab_invis = explode(",", $explr_invisible);
    $explr_tab_unmod = explode(",", $explr_visible_unmod);
    $explr_tab_modif = explode(",", $explr_visible_mod);
    //	$th_sur_location="";
    //	if($pmb_sur_location_activate)$th_sur_location="<th>".$msg["sur_location_expl"]."</th>";
    //
    //	$result  = "<table border=\"0\" cellspacing=\"1\">";
    //	$result .= "<tr><th>".$msg[293]."</th><th>".$msg[4016]."</th>$th_sur_location<th>".$msg[4017]."</th><th>".$msg[4018]."</th><th>".$msg[4019]."</th><th>".$msg[4015]."</th><th></th>";
    //	while(list($cle, $valeur) = each($expl)) {
    //		$requete = "SELECT pret_idempr, ";
    //		$requete .= " date_format(pret_retour, '".$msg["format_date"]."') as aff_pret_retour ";
    //		$requete .= " FROM pret ";
    //		$requete .= " WHERE pret_idexpl='$valeur->expl_id' ";
    //		$result_prets = pmb_mysql_query($requete, $dbh) or die ("<br />".pmb_mysql_error()."<br />".$requete);
    //		if (pmb_mysql_num_rows($result_prets)) $expl_pret = pmb_mysql_fetch_object($result_prets) ;
    //		else $expl_pret="";
    //		$situation = "";
    //		// prêtable ou pas s'il est prêté, on affiche son état
    //		if (is_object($expl_pret) && $expl_pret->pret_idempr) {
    //			// exemplaire sorti
    //			$rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='$expl_pret->pret_idempr' ";
    //			$res_empr = pmb_mysql_query($rqt_empr, $dbh) ;
    //			$res_empr_obj = pmb_mysql_fetch_object($res_empr) ;
    //			$situation = "<strong>${msg[358]} ".$expl_pret->aff_pret_retour."</strong>";
    //			global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
    //			if (!$show_in_reception && $empr_show_caddie && (SESSrights & CIRCULATION_AUTH)) {
    //				$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=".$expl->pret_idempr."', 'cart', 600, 700, -2, -2, '$selector_prop_ajout_caddie_empr')\">&nbsp;";
    //			} else {
    //				$img_ajout_empr_caddie="";
    //			}
    //			if (!$show_in_reception) {
    //				$situation .= "<br />$img_ajout_empr_caddie<a href='./circ.php?categ=pret&form_cb=".rawurlencode($res_empr_obj->empr_cb)."'>$res_empr_obj->empr_prenom $res_empr_obj->empr_nom</a>";
    //			} else {
    //				$situation .= "<br />$res_empr_obj->empr_prenom $res_empr_obj->empr_nom";
    //			}
    //		} else {
    //			// tester si réservé
    //			$result_resa = pmb_mysql_query("select 1 from resa where resa_cb='".addslashes($valeur->expl_cb)."' ", $dbh) or die ();
    //			$reserve = pmb_mysql_num_rows($result_resa);
    //			if ($reserve)
    //				$situation = "<strong>".$msg['expl_reserve']."</strong>"; // exemplaire réservé
    //			elseif ($valeur->pret_flag)
    //				$situation = "<strong>${msg[359]}</strong>"; // exemplaire disponible
    //			else
    //				$situation = "";
    //		}
    //
    //		if(!$show_in_reception && (SESSrights & CATALOGAGE_AUTH)){
    //			$selector_prop = "toolbar=no, dependent=yes, resizable=yes, scrollbars=yes";
    //			$cart_click_expl = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!item!!', 'cart', 600, 700, -2, -2, '$selector_prop')\"";
    //			$cart_link = "<img src='./images/basket_small_20x20.gif' align='center' alt='middle' title=\"${msg[400]}\" $cart_click_expl>";
    //			$ajout_expl_panier = str_replace('!!item!!', $valeur->expl_id, $cart_link) ;
    //		}else{
    //			$ajout_expl_panier ="";
    //		}
    //
    //		//si les transferts sont activés
    //		if (!$show_in_reception && $pmb_transferts_actif) {
    //			//si l'exemplaire n'est pas transferable on a une image vide
    //			$dispo_pour_transfert = transfert::est_transferable ( $valeur->expl_id );
    //			if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert)
    //				//l'icon de demande de transfert
    //				$ajout_expl_panier .= "<a href=\"#\" onClick=\"openPopUp('./catalog/transferts/transferts_popup.php?expl=" . $valeur->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\">" . "<img src='./images/peb_in.png' align='center' border=0 alt=\"" . $msg ["transferts_alt_libelle_icon"] . "\" title=\"" . $msg ["transferts_alt_libelle_icon"] . "\"></a>";
    //			else
    //				$ajout_expl_panier .= "<img src='./images/spacer.gif' align='center' height=20 width=20>";
    //
    //		}
    //
    //		$as_invis = false;
    //		$as_unmod = false;
    //		$as_modif = true;
    //		global $flag_no_delete_bulletin;
    //		$flag_no_delete_bulletin=0;
    //		//visibilité des exemplaires
    //		if ($pmb_droits_explr_localises) {
    //			$as_invis = in_array($valeur->expl_location,$explr_tab_invis);
    //			$as_unmod = in_array($valeur->expl_location,$explr_tab_unmod);
    //			//$as_modif = in_array($valeur->expl_location,$explr_tab_modif);
    //
    //			if(!($as_modif=in_array  ($valeur->expl_location,$explr_tab_modif) )) $flag_no_delete_bulletin=1;
    //
    //		}
    //		if ($show_in_reception || $cart_link_non || !(SESSrights & CATALOGAGE_AUTH))
    //			$link =  htmlentities($valeur->expl_cb,ENT_QUOTES, $charset);
    //		else {
    //			if ($as_modif) {
    //				$link = "<a href=\"./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=".$valeur->expl_bulletin."&expl_id=".$valeur->expl_id."\">".htmlentities($valeur->expl_cb,ENT_QUOTES, $charset)."</a>";
    //			} else {
    //				$link = htmlentities($valeur->expl_cb,ENT_QUOTES, $charset);
    //			}
    //		}
    //
    //		if ($situation) $situation="<br />".$situation;
    //		if(!$show_in_reception && SESSrights & CATALOGAGE_AUTH){
    //			$ajout_expl_panier.="<span id='EXPL_drag_".$valeur->expl_id."'  dragicon=\"$base_path/images/icone_drag_notice.png\" dragtext=\"".htmlentities($valeur->expl_cb,ENT_QUOTES, $charset)."\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"".$base_path."/images/notice_drag.png\"/></span>";
    //		}
    //
    //		$line = "<tr>";
    //		if (($valeur->expl_note || $valeur->expl_comment) && $pmb_expl_list_display_comments) $line .= "<td rowspan='2'>$link</td>";
    //		else $line .= "<td>$link</td>";
    //		$line .= "<td>$valeur->expl_cote</td>";
    //		if($pmb_sur_location_activate) $line .= "<td>$valeur->sur_loc_libelle</td>";
    //		$line .= "<td>$valeur->location_libelle</td>";
    //		$line .= "<td>$valeur->section_libelle</td>";
    //		$line .= "<td>$valeur->statut_libelle.$situation</td>";
    //		$line .= "<td>$valeur->tdoc_libelle</td>";
    //		$line .= "<td>$ajout_expl_panier</td>";
    //		if (($valeur->expl_note || $valeur->expl_comment) && $pmb_expl_list_display_comments) {
    //			$notcom=array();
    //			$line .= "<tr><td colspan='6'>";
    //			if ($valeur->expl_note && ($pmb_expl_list_display_comments & 1)) $notcom[] .= "<span class='erreur'>$valeur->expl_note</span>";
    //			if ($valeur->expl_comment && ($pmb_expl_list_display_comments & 2)) $notcom[] .= "$valeur->expl_comment";
    //			$line .= implode("<br />",$notcom);
    //			$line .= "</tr>";
    //		}
    //		$result .= $line;
    //	} //while(list($cle, $valeur) = each($expl))
    //
    //	$result .= "</table>";
    //
    //maintenant
    //Liste des champs d'exemplaires
    if ($pmb_sur_location_activate) {
        $surloc_field = "surloc_libelle,";
    }
    if (!$pmb_expl_data) {
        $pmb_expl_data = "expl_cb,expl_cote," . $surloc_field . "location_libelle,section_libelle,statut_libelle,tdoc_libelle";
    }
    $colonnesarray = explode(",", $pmb_expl_data);
    if (!in_array("expl_cb", $colonnesarray)) {
        array_unshift($colonnesarray, "expl_cb");
    }
    $total_columns = count($colonnesarray);
    //Présence de champs personnalisés
    if (strstr($pmb_expl_data, "#")) {
        require_once $class_path . "/parametres_perso.class.php";
        $cp = new parametres_perso("expl");
    }
    if ($return_count) {
        return count($expl);
    }
    if (count($expl)) {
        $result .= "<table border=\"0\" cellspacing=\"1\">";
        //un premier tour pour aller chercher les libellés...
        for ($i = 0; $i < count($colonnesarray); $i++) {
            if (substr($colonnesarray[$i], 0, 1) == "#") {
                //champs personnalisés
                if (!$cp->no_special_fields) {
                    $id = substr($colonnesarray[$i], 1);
                    $entry .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                }
            } else {
                eval("\$colencours=\$msg['expl_header_" . $colonnesarray[$i] . "'];");
                $entry .= "<th>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
            }
        }
        $result .= "<tr>" . $entry . "<th>&nbsp;</th></tr>";
        foreach ($expl as $exemplaire) {
            $requete = "SELECT pret_idempr, ";
            $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour ";
            $requete .= " FROM pret ";
            $requete .= " WHERE pret_idexpl='{$exemplaire->expl_id}' ";
            $result_prets = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
            if (pmb_mysql_num_rows($result_prets)) {
                $expl_pret = pmb_mysql_fetch_object($result_prets);
            } else {
                $expl_pret = "";
            }
            $situation = "";
            // prêtable ou pas s'il est prêté, on affiche son état
            if (is_object($expl_pret) && $expl_pret->pret_idempr) {
                // exemplaire sorti
                $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl_pret->pret_idempr}' ";
                $res_empr = pmb_mysql_query($rqt_empr, $dbh);
                $res_empr_obj = pmb_mysql_fetch_object($res_empr);
                $situation = "<strong>{$msg[358]} " . $expl_pret->aff_pret_retour . "</strong>";
                global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
                if (!$show_in_reception && $empr_show_caddie && SESSrights & CIRCULATION_AUTH) {
                    $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=" . $exemplaire->pret_idempr . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">&nbsp;";
                } else {
                    $img_ajout_empr_caddie = "";
                }
                if (!$show_in_reception) {
                    $situation .= "<br />{$img_ajout_empr_caddie}<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($res_empr_obj->empr_cb) . "'>{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}</a>";
                } else {
                    $situation .= "<br />{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}";
                }
            } else {
                // tester si réservé
                $result_resa = pmb_mysql_query("select 1 from resa where resa_cb='" . addslashes($exemplaire->expl_cb) . "' ", $dbh) or die;
                $reserve = pmb_mysql_num_rows($result_resa);
                if ($reserve) {
                    $situation = "<strong>" . $msg['expl_reserve'] . "</strong>";
                    // exemplaire réservé
                } elseif ($exemplaire->pret_flag) {
                    $situation = "<strong>{$msg[359]}</strong>";
                    // exemplaire disponible
                } else {
                    $situation = "";
                }
            }
            if (!$show_in_reception && SESSrights & CATALOGAGE_AUTH) {
                $selector_prop = "toolbar=no, dependent=yes, resizable=yes, scrollbars=yes";
                $cart_click_expl = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!item!!', 'cart', 600, 700, -2, -2, '{$selector_prop}')\"";
                $cart_link = "<img src='./images/basket_small_20x20.gif' align='center' alt='middle' title=\"{$msg[400]}\" {$cart_click_expl}>";
                $ajout_expl_panier = str_replace('!!item!!', $exemplaire->expl_id, $cart_link);
            } else {
                $ajout_expl_panier = "";
            }
            //si les transferts sont activés
            if (!$show_in_reception && $pmb_transferts_actif) {
                //si l'exemplaire n'est pas transferable on a une image vide
                $dispo_pour_transfert = transfert::est_transferable($exemplaire->expl_id);
                if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert) {
                    //l'icon de demande de transfert
                    $ajout_expl_panier .= "<a href=\"#\" onClick=\"openPopUp('./catalog/transferts/transferts_popup.php?expl=" . $exemplaire->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\">" . "<img src='./images/peb_in.png' align='center' border=0 alt=\"" . $msg["transferts_alt_libelle_icon"] . "\" title=\"" . $msg["transferts_alt_libelle_icon"] . "\"></a>";
                } else {
                    $ajout_expl_panier .= "<img src='./images/spacer.gif' align='center' height=20 width=20>";
                }
            }
            $as_invis = false;
            $as_unmod = false;
            $as_modif = true;
            global $flag_no_delete_bulletin;
            $flag_no_delete_bulletin = 0;
            //visibilité des exemplaires
            if ($pmb_droits_explr_localises) {
                $as_invis = in_array($exemplaire->expl_location, $explr_tab_invis);
                $as_unmod = in_array($exemplaire->expl_location, $explr_tab_unmod);
                //$as_modif = in_array($exemplaire->expl_location,$explr_tab_modif);
                if (!($as_modif = in_array($exemplaire->expl_location, $explr_tab_modif))) {
                    $flag_no_delete_bulletin = 1;
                }
            }
            if ($show_in_reception || $cart_link_non || !(SESSrights & CATALOGAGE_AUTH)) {
                $link = htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset);
            } else {
                if ($as_modif) {
                    $link = "<a href=\"./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=" . $exemplaire->expl_bulletin . "&expl_id=" . $exemplaire->expl_id . "\">" . htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset) . "</a>";
                } else {
                    $link = htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset);
                }
            }
            if ($situation) {
                $situation = "<br />" . $situation;
            }
            if (!$show_in_reception && SESSrights & CATALOGAGE_AUTH) {
                $ajout_expl_panier .= "<span id='EXPL_drag_" . $exemplaire->expl_id . "'  dragicon=\"{$base_path}/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($exemplaire->expl_cb, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
            }
            global $pmb_serialcirc_subst;
            if ($pmb_serialcirc_subst) {
                $ajout_expl_panier .= "<img src='./images/print.gif' alt='Imprimer...' title='Imprimer...' align='middle' border='0'\tstyle='padding-left:7px' \t\t\t\n\t\t\t\t\tonclick=\"openPopUp('./ajax.php?module=circ&categ=periocirc&sub=print_cote&expl_id=" . $exemplaire->expl_id . "', 'circulation', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\"\n\t\t\t\t>";
            }
            $line = "<tr>";
            for ($i = 0; $i < count($colonnesarray); $i++) {
                if ($i == 0 && ($exemplaire->expl_note || $exemplaire->expl_comment) && $pmb_expl_list_display_comments) {
                    $expl_rowspan = "rowspan='2'";
                } else {
                    $expl_rowspan = "";
                }
                $aff_column = "";
                if (substr($colonnesarray[$i], 0, 1) == "#") {
                    //champs personnalisés
                    $id = substr($colonnesarray[$i], 1);
                    $cp->get_values($exemplaire->expl_id);
                    if (!$cp->no_special_fields) {
                        $temp = $cp->get_formatted_output($cp->values[$id], $id);
                        if (!$temp) {
                            $temp = "&nbsp;";
                        }
                        $aff_column .= $temp;
                    }
                } else {
                    eval("\$colencours=\$exemplaire->" . $colonnesarray[$i] . ";");
                    if ($colonnesarray[$i] == "expl_cb") {
                        $aff_column = $link;
                    } else {
                        if ($colonnesarray[$i] == "expl_cote") {
                            $aff_column = "<strong>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</strong>";
                        } else {
                            if ($colonnesarray[$i] == "surloc_libelle") {
                                $aff_column = htmlentities($exemplaire->sur_loc_libelle, ENT_QUOTES, $charset);
                            } else {
                                if ($colonnesarray[$i] == "statut_libelle") {
                                    $aff_column = htmlentities($colencours, ENT_QUOTES, $charset) . $situation;
                                } else {
                                    $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                }
                            }
                        }
                    }
                }
                $line .= "<td {$expl_rowspan}>" . $aff_column . "</td>";
            }
            $line .= "<td>{$ajout_expl_panier}</td>";
            $line .= "</tr>";
            if (($exemplaire->expl_note || $exemplaire->expl_comment) && $pmb_expl_list_display_comments) {
                $notcom = array();
                $line .= "<tr><td colspan='" . $total_columns . "'>";
                if ($exemplaire->expl_note && $pmb_expl_list_display_comments & 1) {
                    $notcom[] .= "<span class='erreur'>{$exemplaire->expl_note}</span>";
                }
                if ($exemplaire->expl_comment && $pmb_expl_list_display_comments & 2) {
                    $notcom[] .= "{$exemplaire->expl_comment}";
                }
                $line .= implode("<br />", $notcom);
                $line .= "</tr>";
            }
            $result .= $line;
        }
        $result .= "</table>";
    }
    return $result;
}
Exemple #2
0
 function show_expl_per_notice($no_notice, $link_expl = '', $expl_bulletin = 0)
 {
     global $msg, $dbh, $base_path, $class_path;
     global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises, $transferts_gestion_transferts;
     global $pmb_expl_list_display_comments;
     global $pmb_sur_location_activate;
     global $pmb_url_base, $pmb_expl_data, $charset;
     global $pmb_expl_display_location_without_expl;
     global $pmb_html_allow_expl_cote;
     // params :
     // $no_notice= id de la notice
     // $link_expl= lien associé à l'exemplaire avec !!expl_id!! et !!expl_cb!! à mettre à jour
     if (!$no_notice && !$expl_bulletin) {
         return;
     }
     $explr_tab_invis = explode(",", $explr_invisible);
     $explr_tab_unmod = explode(",", $explr_visible_unmod);
     $explr_tab_modif = explode(",", $explr_visible_mod);
     // récupération du nombre total d'exemplaires
     if ($expl_bulletin) {
         $requete = "SELECT COUNT(1) FROM exemplaires WHERE expl_bulletin='{$expl_bulletin}' ";
     } else {
         $requete = "SELECT COUNT(1) FROM exemplaires WHERE expl_notice='{$no_notice}' ";
     }
     $res = pmb_mysql_query($requete, $dbh);
     $nb_ex = pmb_mysql_result($res, 0, 0);
     if ($nb_ex) {
         // on récupère les données des exemplaires
         // visibilité des exemplaires:
         if ($pmb_droits_explr_localises && $explr_invisible) {
             $where_expl_localises = "and expl_location not in ({$explr_invisible})";
         } else {
             $where_expl_localises = "";
         }
         //Liste des champs d'exemplaires
         if ($pmb_sur_location_activate) {
             $surloc_field = "surloc_libelle,";
         }
         if (!$pmb_expl_data) {
             $pmb_expl_data = "expl_cb,expl_cote," . $surloc_field . "location_libelle,section_libelle,statut_libelle,tdoc_libelle";
         }
         $colonnesarray = explode(",", $pmb_expl_data);
         if (!in_array("expl_cb", $colonnesarray)) {
             array_unshift($colonnesarray, "expl_cb");
         }
         $total_columns = count($colonnesarray);
         //Présence de champs personnalisés
         if (strstr($pmb_expl_data, "#")) {
             require_once $class_path . "/parametres_perso.class.php";
             $cp = new parametres_perso("expl");
         }
         if ($expl_bulletin) {
             $where_expl_notice_expl_bulletin = " expl_bulletin='{$expl_bulletin}' ";
         } else {
             $where_expl_notice_expl_bulletin = " expl_notice='{$no_notice}' ";
         }
         $requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, docs_codestat.*, lenders.*, tdoc_libelle, ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= "sur_location.*, ";
         }
         $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
         $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
         $requete .= " IF(pret_retour>sysdate(),0,1) as retard ";
         $requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl ";
         $requete .= " left join docs_location on exemplaires.expl_location=docs_location.idlocation ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= " left join sur_location on docs_location.surloc_num=sur_location.surloc_id ";
         }
         $requete .= " left join docs_section on exemplaires.expl_section=docs_section.idsection ";
         $requete .= " left join docs_statut on exemplaires.expl_statut=docs_statut.idstatut ";
         $requete .= " left join docs_codestat on exemplaires.expl_codestat=docs_codestat.idcode ";
         $requete .= " left join lenders on exemplaires.expl_owner=lenders.idlender ";
         $requete .= " left join docs_type on exemplaires.expl_typdoc=docs_type.idtyp_doc  ";
         $requete .= " WHERE {$where_expl_notice_expl_bulletin} {$where_expl_localises} ";
         if (in_array("surloc_libelle", $colonnesarray)) {
             $requete .= " order by surloc_libelle,location_libelle, section_libelle, expl_cote, expl_cb ";
         } else {
             $requete .= " order by location_libelle, section_libelle, expl_cote, expl_cb ";
         }
         $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
         $nbr_expl = pmb_mysql_num_rows($result);
         if ($nbr_expl) {
             while ($expl = pmb_mysql_fetch_object($result)) {
                 //visibilité des exemplaires
                 if ($pmb_droits_explr_localises) {
                     $as_invis = array_search($expl->idlocation, $explr_tab_invis);
                     $as_unmod = array_search($expl->idlocation, $explr_tab_unmod);
                     $as_modif = array_search($expl->idlocation, $explr_tab_modif);
                 } else {
                     $as_invis = false;
                     $as_unmod = false;
                     $as_modif = true;
                 }
                 if ($link_expl) {
                     if ($expl_bulletin) {
                         $tlink = "./catalog.php?categ=serials&sub=bulletinage&action=expl_form&bul_id=!!bull_id!!&expl_id=!!expl_id!!";
                         $tlink = str_replace('!!bull_id!!', $expl_bulletin, $tlink);
                         $tlink = str_replace('!!expl_id!!', $expl->expl_id, $tlink);
                         $tlink = str_replace('!!expl_cb!!', rawurlencode($expl->expl_cb), $tlink);
                     } else {
                         $tlink = str_replace('!!expl_id!!', $expl->expl_id, $link_expl);
                         $tlink = str_replace('!!expl_cb!!', rawurlencode($expl->expl_cb), $tlink);
                         $tlink = str_replace('!!notice_id!!', $expl->expl_notice, $tlink);
                     }
                 }
                 $expl_liste .= "<tr>";
                 for ($i = 0; $i < count($colonnesarray); $i++) {
                     if (!(substr($colonnesarray[$i], 0, 1) == "#")) {
                         eval("\$colencours=\$expl->" . $colonnesarray[$i] . ";");
                     }
                     if ($i == 0 && ($expl->expl_note || $expl->expl_comment) && $pmb_expl_list_display_comments) {
                         $expl_rowspan = "rowspan='2'";
                     } else {
                         $expl_rowspan = "";
                     }
                     $aff_column = "";
                     if (substr($colonnesarray[$i], 0, 1) == "#") {
                         //champs personnalisés
                         $id = substr($colonnesarray[$i], 1);
                         $cp->get_values($expl->expl_id);
                         if (!$cp->no_special_fields) {
                             $temp = $cp->get_formatted_output($cp->values[$id], $id);
                             if (!$temp) {
                                 $temp = "&nbsp;";
                             }
                             $aff_column .= $temp;
                         }
                     } else {
                         if ($colonnesarray[$i] == "expl_cb") {
                             if ($tlink && ($as_modif !== FALSE && $as_modif !== NULL)) {
                                 $aff_column .= "<a href='{$tlink}'>" . $colencours . "</a>";
                             } else {
                                 $aff_column .= $colencours;
                             }
                         } else {
                             if ($colonnesarray[$i] == "expl_cote") {
                                 if ($pmb_html_allow_expl_cote) {
                                     $aff_column .= "<strong>" . $colencours . "</strong>";
                                 } else {
                                     $aff_column .= "<strong>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</strong>";
                                 }
                             } else {
                                 if ($colonnesarray[$i] == "statut_libelle") {
                                     if ($expl->pret_retour) {
                                         // exemplaire sorti
                                         $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='{$expl->pret_idempr}' ";
                                         $res_empr = pmb_mysql_query($rqt_empr, $dbh);
                                         $res_empr_obj = pmb_mysql_fetch_object($res_empr);
                                         $situation = "<strong>{$msg[358]} " . $expl->aff_pret_retour . "</strong>";
                                         global $empr_show_caddie, $selector_prop_ajout_caddie_empr;
                                         if ($empr_show_caddie && SESSrights & CIRCULATION_AUTH) {
                                             $img_ajout_empr_caddie = "<img src='" . $base_path . "/images/basket_empr.gif' align='middle' alt='basket' title=\"{$msg[400]}\" onClick=\"openPopUp('" . $base_path . "/cart.php?object_type=EMPR&item=" . $expl->pret_idempr . "', 'cart', 600, 700, -2, -2, '{$selector_prop_ajout_caddie_empr}')\">&nbsp;";
                                         } else {
                                             $img_ajout_empr_caddie = "";
                                         }
                                         switch ($this->print_mode) {
                                             case '2':
                                                 $situation .= "<br />{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}";
                                                 break;
                                             default:
                                                 $situation .= "<br />{$img_ajout_empr_caddie}<a href='" . $base_path . "/circ.php?categ=pret&form_cb=" . rawurlencode($res_empr_obj->empr_cb) . "'>{$res_empr_obj->empr_prenom} {$res_empr_obj->empr_nom}</a>";
                                                 break;
                                         }
                                     } else {
                                         // tester si réservé
                                         $result_resa = pmb_mysql_query("select 1 from resa where resa_cb='" . addslashes($expl->expl_cb) . "' ", $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                                         $reserve = pmb_mysql_num_rows($result_resa);
                                         // tester à ranger
                                         $result_aranger = pmb_mysql_query(" select 1 from resa_ranger where resa_cb='" . addslashes($expl->expl_cb) . "' ", $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                                         $aranger = pmb_mysql_num_rows($result_aranger);
                                         if ($reserve) {
                                             $situation = "<strong>" . $msg['expl_reserve'] . "</strong>";
                                         } elseif ($expl->expl_retloc) {
                                             $situation = $msg['resa_menu_a_traiter'];
                                         } elseif ($aranger) {
                                             $situation = "<strong>" . $msg['resa_menu_a_ranger'] . "</strong>";
                                         } elseif ($expl->pret_flag) {
                                             $situation = "<strong>{$msg[359]}</strong>";
                                         } else {
                                             $situation = "";
                                         }
                                     }
                                     $aff_column .= htmlentities($colencours, ENT_QUOTES, $charset);
                                     if ($situation) {
                                         $aff_column .= "<br />{$situation}";
                                     }
                                 } else {
                                     $aff_column = htmlentities($colencours, ENT_QUOTES, $charset);
                                 }
                             }
                         }
                     }
                     $expl_liste .= "<td {$expl_rowspan}>" . $aff_column . "</td>";
                 }
                 if ($this->print_mode) {
                     $expl_liste .= "<td>&nbsp;</td>";
                 } else {
                     if (SESSrights & CATALOGAGE_AUTH) {
                         //le panier d'exemplaire
                         $cart_click = "onClick=\"openPopUp('" . $base_path . "/cart.php?object_type=EXPL&item=" . $expl->expl_id . "', 'cart', 600, 700, -2, -2, 'toolbar=no, dependent=yes, width=500, height=400, resizable=yes, scrollbars=yes')\"";
                         $cart_link = "<a href='#' {$cart_click}><img src='" . $base_path . "/images/basket_small_20x20.gif' align='center' alt='basket' title=\"{$msg[400]}\"></a>";
                         //l'icon pour le drag&drop de panier
                         $drag_link = "<span onMouseOver='if(init_drag) init_drag();' id='EXPL_drag_" . $expl->expl_id . "'  dragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($expl->expl_cb, ENT_QUOTES, $charset) . "\" draggable=\"yes\" dragtype=\"notice\" callback_before=\"show_carts\" callback_after=\"\" style=\"padding-left:7px\"><img src=\"" . $base_path . "/images/notice_drag.png\"/></span>";
                     } else {
                         $cart_click = "";
                         $cart_link = "";
                         $drag_link = "";
                     }
                     //l'impression de la fiche exemplaire
                     $fiche_click = "onClick=\"openPopUp('" . $base_path . "/pdf.php?pdfdoc=fiche_catalographique&expl_id=" . $expl->expl_id . "', 'Fiche', 500, 400, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes')\"";
                     $fiche_link = "<a href='#' {$fiche_click}><img src='" . $base_path . "/images/print.gif' align='center' alt='" . $msg['print_fiche_catalographique'] . "' title='" . $msg['print_fiche_catalographique'] . "'></a>";
                     global $pmb_transferts_actif;
                     //si les transferts sont activés
                     if ($pmb_transferts_actif) {
                         //si l'exemplaire n'est pas transferable on a une image vide
                         $transfer_link = "<img src='" . $base_path . "/images/spacer.gif' align='center' height=20 width=20>";
                         $dispo_pour_transfert = transfert::est_transferable($expl->expl_id);
                         if (SESSrights & TRANSFERTS_AUTH && $dispo_pour_transfert) {
                             //l'icon de demande de transfert
                             $transfer_link = "<a href=\"#\" onClick=\"openPopUp('" . $base_path . "/catalog/transferts/transferts_popup.php?expl=" . $expl->expl_id . "', 'cart', 600, 450, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\"><img src='" . $base_path . "/images/peb_in.png' align='center' border=0 alt=\"" . $msg["transferts_alt_libelle_icon"] . "\" title=\"" . $msg["transferts_alt_libelle_icon"] . "\"></a>";
                         }
                     }
                     //on met tout dans la colonne
                     $expl_liste .= "<td>{$fiche_link} {$cart_link} {$transfer_link} {$drag_link}</td>";
                 }
                 $expl_liste .= "</tr>";
                 if (($expl->expl_note || $expl->expl_comment) && $pmb_expl_list_display_comments) {
                     $notcom = array();
                     $expl_liste .= "<tr><td colspan='" . $total_columns . "'>";
                     if ($expl->expl_note && $pmb_expl_list_display_comments & 1) {
                         $notcom[] .= "<span class='erreur'>{$expl->expl_note}</span>";
                     }
                     if ($expl->expl_comment && $pmb_expl_list_display_comments & 2) {
                         $notcom[] .= "{$expl->expl_comment}";
                     }
                     $expl_liste .= implode("<br />", $notcom);
                     $expl_liste .= "</tr>";
                 }
             }
             // fin while
         }
         // fin il y a des expl visibles
         if ($expl_liste) {
             $entry = "<table border='0' class='expl-list'><tr>";
             for ($i = 0; $i < count($colonnesarray); $i++) {
                 if (substr($colonnesarray[$i], 0, 1) == "#") {
                     //champs personnalisés
                     if (!$cp->no_special_fields) {
                         $id = substr($colonnesarray[$i], 1);
                         $entry .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                     }
                 } else {
                     eval("\$colencours=\$msg[expl_header_" . $colonnesarray[$i] . "];");
                     $entry .= "<th>" . htmlentities($colencours, ENT_QUOTES, $charset) . "</th>";
                 }
             }
             $entry .= "<th>&nbsp;</th></tr>{$expl_liste}</table>";
         } else {
             $entry = "";
         }
         if ($pmb_expl_display_location_without_expl) {
             if ($pmb_sur_location_activate) {
                 $array_surloc = array();
                 $requete = "SELECT * FROM sur_location ORDER BY surloc_libelle";
                 $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                 $nb_surloc = pmb_mysql_num_rows($result);
                 if ($nb_surloc) {
                     while ($surloc = pmb_mysql_fetch_object($result)) {
                         $array_surloc[] = array("id" => $surloc->surloc_id, "libelle" => $surloc->surloc_libelle, "locations" => array());
                     }
                 }
                 if (count($array_surloc)) {
                     foreach ($array_surloc as $key => $surloc) {
                         $requete = "SELECT idlocation, location_libelle from docs_location where surloc_num=" . $surloc["id"] . " AND \n\t\t\t\t\t\tidlocation not in (SELECT expl_location from exemplaires WHERE expl_notice={$no_notice}) order by location_libelle";
                         $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                         $nb_loc = pmb_mysql_num_rows($result);
                         if ($nb_loc) {
                             while ($loc = pmb_mysql_fetch_object($result)) {
                                 $array_surloc[$key]["locations"][] = array("id" => $loc->idlocation, "libelle" => $loc->location_libelle);
                             }
                         } else {
                             unset($array_surloc[$key]);
                         }
                     }
                 }
                 //Au moins une surloc à afficher
                 if (count($array_surloc)) {
                     $tr_surloc = "";
                     foreach ($array_surloc as $key => $surloc) {
                         $tr_surloc .= "<tr><td>";
                         $tr_loc = "";
                         foreach ($surloc["locations"] as $keyloc => $loc) {
                             $tr_loc .= "<tr><td>" . $loc["libelle"] . "</td></tr>";
                         }
                         $tpl_surloc = "\n\t\t\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t\t\t{$tr_loc}\n\t\t\t\t\t\t\t</table>";
                         $tr_surloc .= gen_plus('surlocation_without_expl' . $key . '_' . $no_notice, $surloc["libelle"], $tpl_surloc, 0);
                         $tr_surloc .= "</td></tr>";
                     }
                     $tpl = "\n\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t{$tr_surloc}\n\t\t\t\t\t</table>";
                     $entry .= gen_plus('location_without_expl' . $no_notice, $msg['expl_surlocation_without_expl'], $tpl, 0);
                 }
             } else {
                 $requete = "SELECT location_libelle from docs_location where\n\t\t\t\tidlocation not in (SELECT expl_location from exemplaires WHERE expl_notice={$no_notice}) order by location_libelle";
                 $result = pmb_mysql_query($requete, $dbh) or die("<br />" . pmb_mysql_error() . "<br />" . $requete);
                 $nb_loc = pmb_mysql_num_rows($result);
                 if ($nb_loc) {
                     $items = "";
                     while ($loc = pmb_mysql_fetch_object($result)) {
                         $items .= "<tr><td>" . $loc->location_libelle . "</td></tr>";
                     }
                     $tpl = "\n\t\t\t\t\t<table border='0' class='expl-list'>\n\t\t\t\t\t\t{$items}\n\t\t\t\t\t</table>";
                     $tpl = gen_plus('location_without_expl' . $no_notice, $msg['expl_location_without_expl'], $tpl, 0);
                     $entry .= $tpl;
                 }
             }
         }
         $this->nb_expl = $nbr_expl;
         return $entry;
     } else {
         return "";
     }
 }
function check_group_transferability($group_id)
{
    $expl_ids = get_group_expls($group_id);
    $transferable = true;
    foreach ($expl_ids as $expl_id) {
        if (!transfert::est_transferable($expl_id)) {
            $transferable = false;
        }
    }
    return $transferable;
}