write_string(0,0,'Usuarios: Usuarios duplicados');
break;
case "TABLEAUHTML":
echo "
".$titre_page."
" ;
break;
default:
echo "".$titre_page."
" ;
break;
}
// nombre de références par pages
if ($nb_per_page_empr != "")
$nb_per_page = $nb_per_page_empr ;
else
$nb_per_page = 10;
// restriction localisation le cas échéant
if ($pmb_lecteurs_localises) {
if ($empr_location_id=="")
$empr_location_id = $deflt2docs_location ;
if ($empr_location_id!=0)
$restrict_localisation = " AND empr_location='$empr_location_id' ";
else
$restrict_localisation = "";
}
// filtré par un statut sélectionné
if ($empr_statut_edit) {
if ($empr_statut_edit!=0)
$restrict_statut = " AND empr_statut='$empr_statut_edit' ";
else
$restrict_statut="";
}
// on récupére le nombre de lignes
if(!$nbr_lignes) {
$requete="Select count(*) from empr inner join (select id_empr,empr_nom,empr_prenom, count(*)as Total from empr group by empr_nom, empr_prenom having Total >1) empr2 on empr.empr_nom=empr2.empr_nom and empr.empr_prenom=empr2.empr_prenom,empr_statut WHERE empr_statut=idstatut";
$requete = $requete.$restrict_localisation.$restrict_statut;
$res = pmb_mysql_query($requete, $dbh);
$nbr_lignes = @pmb_mysql_result($res, 0, 0);
}
//Si aucune limite_page n'a été passée, valeur par défaut $nb_per_page
if (!$limite_page)
$limite_page = $nb_per_page;
else
$nb_per_page = $limite_page;
$nbpages= $nbr_lignes / $limite_page;
if(!$page) $page=1;
$debut =($page-1)*$nb_per_page;
if($nbr_lignes) {
if ($statut_action=="modify") {
if ($empr_statut_edit) {
if ($empr_statut_edit!=0)
$restrict_statut = " WHERE empr_statut='$empr_statut_edit' ";
else
$restrict_statut="";
}
$requete="UPDATE empr inner join (select id_empr,empr_nom,empr_prenom,count(*)as Total from empr group by empr_nom, empr_prenom having Total >1) empr2 on empr.empr_nom=empr2.empr_nom AND empr.empr_prenom=empr2.empr_prenom set empr_statut='$empr_chang_statut_edit'".$restrict_statut;
$restrict_statut = " AND empr_statut='$empr_chang_statut_edit' ";
@pmb_mysql_query($requete);
}
$requete = "Select empr.* ,statut_libelle, date_format(empr_date_expiration, '".$msg["format_date"]."') as aff_empr_date_expiration from empr inner join (select id_empr,empr_nom, empr_prenom, count(*)as Total from empr group by empr_nom, empr_prenom having Total >1) empr2 on empr.empr_nom=empr2.empr_nom and empr.empr_prenom=empr2.empr_prenom, empr_statut WHERE empr_statut=idstatut";
$restrict_requete = $restrict_localisation.$restrict_statut;
$requete .= $restrict_requete;
if (!isset($sortby))
$sortby = 'empr_nom';
$requete .= " ORDER BY $sortby ";
switch($dest) {
case "TABLEAU":
$res = @pmb_mysql_query($requete, $dbh);
$nbr_champs = @pmb_mysql_num_fields($res);
for($n=0; $n < $nbr_champs; $n++) {
//$worksheet->write(2,$n,pmb_mysql_field_name($res,$n));
$spreadsheet->write_string(2,$n, pmb_mysql_field_name($res,$n));
}
for($i=0; $i < $nbr_lignes; $i++) {
$row = pmb_mysql_fetch_row($res);
$j=0;
foreach($row as $dummykey=>$col) {
if(!$col) $col=" ";
//$worksheet->write(($i+3),$j,$col);
$spreadsheet->write_string(($i+3),$j,$col);
$j++;
}
}
//$workbook->close();
//$fh=fopen($fname, "rb");
//fpassthru($fh);
//unlink($fname);
$spreadsheet->download('duplicados.xls');
break;
case "TABLEAUHTML":
$res = @pmb_mysql_query($requete, $dbh);
$empr_list = "" ;
$empr_list .="
$msg[code_barre_empr] |
$msg[nom_prenom_empr] |
$msg[adresse_empr] |
|
$msg[ville_empr] |
$msg[empr_migrado] |
$msg[readerlist_dateexpiration] |
$msg[statut_empr] |
";
while(($empr=pmb_mysql_fetch_object($res))) {
$empr_list .= "";
$empr_list .= "
$empr->empr_cb
|
$empr->empr_nom $empr->empr_prenom
|
$empr->empr_adr1 |
$empr->empr_adr2 |
$empr->empr_ville |
$empr->empr_Migrado | ";
$empr_list .= "".$empr->aff_empr_date_expiration." | ";
$empr_list .= "".$empr->statut_libelle." | ";
$empr_list .= "
";
}
$empr_list .= "
" ;
echo $empr_list ;
break;
default:
$requete .= "LIMIT $debut,$nb_per_page ";
$res = @pmb_mysql_query($requete, $dbh);
$parity=1;
$empr_list .="
$msg[code_barre_empr] |
$msg[nom_prenom_empr] |
$msg[adresse_empr] |
$msg[ville_empr] |
$msg[empr_migrado] |
$msg[readerlist_dateexpiration] |
$msg[statut_empr] | ";
$empr_list .="
";
while(($empr=pmb_mysql_fetch_object($res))) {
if ($parity % 2)
$pair_impair = "even";
else
$pair_impair = "odd";
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" ";
$script="onclick=\"document.location='./circ.php?categ=pret&form_cb=".rawurlencode($empr->empr_cb)."';\"";
$empr_list .= "";
$empr_list .= "
$empr->empr_cb
|
$empr->empr_nom $empr->empr_prenom
|
$empr->empr_adr1 |
$empr->empr_ville |
$empr->empr_Migrado | ";
$empr_list .= "".$empr->aff_empr_date_expiration." | ";
$empr_list .= "".$empr->statut_libelle." | ";
$empr_list .= "
";
$parity += 1;
}
pmb_mysql_free_result($res);
// constitution des liens
$nbepages = ceil($nbr_lignes/$nb_per_page);
$suivante = $page+1;
$precedente = $page-1;
// affichage du lien précédent si nécéssaire
if($precedente > 0)
$nav_bar .= "";
for($i = 1; $i <= $nbepages; $i++) {
if($i==$page)
$nav_bar .= "page $i/$nbepages";
}
if($suivante<=$nbepages)
$nav_bar .= "";
// affichage du résultat
echo "
";
print "";
switch ($sub) {
default :
print pmb_bidi("");
break;
}
echo "
";
break;
} //switch($dest)
} else {
// la requête n'a produit aucun résultat
switch($dest) {
case "TABLEAU":
break;
case "TABLEAUHTML":
break;
default:
echo "
";
echo "
";
error_message($msg[46], str_replace('!!form_cb!!', $form_cb, $msg['edit_lect_aucun_trouve']), 1, './edit.php?categ=empr&sub='.$sub);
}
}