write_string(0,0,'Usuarios: Usuarios no migrados'); 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; // filtré par un statut sélectionné if ($empr_statut_edit) { if ($empr_statut_edit!=0) $restrict_statut = " empr_statut='$empr_statut_edit' and"; else $restrict_statut=""; } $sql="SELECT column_name from INFORMATION_SCHEMA.columns where table_schema='pmb' and table_name='empr' AND column_name='empr_Migrado'"; $existeMigrado=@pmb_mysql_query($sql, $dbh); //Si el campo empr_Tipo no existe se crea if (@pmb_mysql_num_rows($existeMigrado)==0){ $restrict_migrado= " (ISNULL(empr_NIA) || empr_NIA='')"; }else{ $restrict_migrado= " ((ISNULL(empr_NIA) || empr_NIA='') ||(NOT ISNULL(empr_NIA) and empr_Migrado='N'))"; } // 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 = "SELECT COUNT(1) FROM empr where " .$restrict_statut.$restrict_migrado; $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 = " empr_statut='$empr_statut_edit' and"; else $restrict_statut=""; } $requete="UPDATE empr set empr_statut='$empr_chang_statut_edit' where ".$restrict_statut.$restrict_migrado; @pmb_mysql_query($requete); } $requete = "SELECT id_empr,empr_cb,empr_nom,empr_prenom,empr_adr1,empr_adr2,empr_ville,empr_Migrado,empr_date_expiration,empr_statut FROM empr where "; $restrict_requete = $restrict_statut.$restrict_migrado; $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++; } } $spreadsheet->download('no_migrados.xls'); break; case "TABLEAUHTML": $res = @pmb_mysql_query($requete, $dbh); $empr_list = "" ; $empr_list .=""; while(($empr=pmb_mysql_fetch_object($res))) { $empr_list .= ""; $empr_list .= " "; $empr_list .= ""; $empr_list .= ""; $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]
$empr->empr_cb $empr->empr_nom $empr->empr_prenom $empr->empr_adr1 $empr->empr_adr2 $empr->empr_ville $empr->empr_Migrado".$empr->aff_empr_date_expiration."".$empr->statut_libelle."
" ; 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 .= "[$msg[48]]"; for($i = 1; $i <= $nbepages; $i++) { if($i==$page) $nav_bar .= "page $i/$nbepages"; } if($suivante<=$nbepages) $nav_bar .= "[$msg[49]]"; // affichage du résultat echo "
$nav_bar $msg[circ_afficher] $msg[1905]  
Export tableau EXCEL   Export tableau HTML  
"; if ($pmb_lecteurs_localises) echo docs_location::gen_combo_box_empr($empr_location_id); echo gen_liste("select idstatut, statut_libelle from empr_statut","idstatut","statut_libelle","empr_statut_edit","",$empr_statut_edit,-1,"",0,$msg["all_statuts_empr"]); $sort_params = array('empr_nom' => $msg['readerlist_name'], 'empr_cb' => $msg['readerlist_code'], 'empr_ville' => $msg['readerlist_ville'], 'empr_date_expiration' => $msg['readerlist_dateexpiration']); echo " ".$msg["sort_by"].": "; echo ''; echo "   "; if ($empr_show_caddie) $bt_add_panier="  "; else $bt_add_panier=""; echo "

"; print ""; switch ($sub) { default : print pmb_bidi("".$empr_list."
"); break; } echo "
"; if ($sub=="limite" || $sub=="depasse") echo " "; echo "$bt_add_panier
".$msg["empr_chang_statut"]."  ".gen_liste("select idstatut, statut_libelle from empr_statut","idstatut","statut_libelle","empr_chang_statut_edit","","",0,"",0,"")."  
"; break; } //switch($dest) } else { // la requête n'a produit aucun résultat switch($dest) { case "TABLEAU": break; case "TABLEAUHTML": break; default: echo "
$nav_bar $msg[circ_afficher] $msg[1905]  
Export tableau EXCEL   Export tableau HTML  
"; if ($pmb_lecteurs_localises) echo docs_location::gen_combo_box_empr($empr_location_id); echo gen_liste("select idstatut, statut_libelle from empr_statut","idstatut","statut_libelle","empr_statut_edit","",$empr_statut_edit,-1,"",0,$msg["all_statuts_empr"]); $sort_params = array('empr_nom' => $msg['readerlist_name'], 'empr_cb' => $msg['readerlist_code'], 'empr_ville' => $msg['readerlist_ville'], 'empr_date_expiration' => $msg['readerlist_dateexpiration']); echo " ".$msg["sort_by"].": "; echo ''; echo "   "; echo "

"; echo "
"; error_message($msg[46], str_replace('!!form_cb!!', $form_cb, $msg['edit_lect_aucun_trouve']), 1, './edit.php?categ=empr&sub='.$sub); } }