sub loadArticleSelection {
$lang = $query->param("lang") ;
my $country_swiss = $query->param("country_swiss");
my $country_france = $query->param("country_france");
my $with_lang_french = $query->param("with_lang_french");
my $with_lang_german = $query->param("with_lang_german");
my $with_lang_italian = $query->param("with_lang_italian");
my $with_lang_english = $query->param("with_lang_english");
my $cat = shift || '';
my $type = shift || '';
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();
my $date = sprintf "%4d-%02d-%02d \n",$year+1900,$mon+1,$mday;
my $depot = $query->param("depot");
$depot =~ s/[^A-Za-z0-9 ]/;
my $string = "";
my $index = '0';
my $total = '0';
my $add;
my $add2;
my $dep;
if ($country_swiss eq '1') {
$add .= "AND article.ref_pays = 1";
}
if ($country_france eq '1') {
if ($country_swiss) {
$add .= "OR article.ref_pays = 2";
}else {
$add .= "AND article.ref_pays = 2";
}
}
if ($type) {
$add2 = "AND id_categorie = '$type'";
} else {
$add2 = "";
}
if ($depot) {
$dep = "AND ref_depot = (SELECT id_depot FROM depot WHERE ville = '$depot')";
}
my ($c)= $mydb->sqlSelectMany("DISTINCT article.nom,marque,label,prix, pochette",
"article,met_en_vente",
"ref_article = id_article AND met_en_vente.notre_selection = '1' AND ref_statut = '3' AND article.quantite > 0");
while( ($ARTICLE{'name'},$ARTICLE{'author'},$ARTICLE{'label'},$ARTICLE{'price'},$ARTICLE{'pochette'},$ARTICLE{'genre'})=$c->fetchrow()) {
$total +=1;
}
my $nb_page = arrondi ($total / 40, 1);
my $min_index = '0';
my $max_index = '40';
#print "Content-Type: text/html\n\n";
for (my $i = '0'; $i < $nb_page + 1;$i++) {
#my $x =
my $j;
#print "valeur de i $i
";
if ($i <= 9) {
$j = "0$i";
}else {
$j = $i;
}
$string .= "<-$j-> ";
$min_index += 40;
}
if (($nb_page % 10) > 0) {
$string .= "
";
}
return $string;
}
sub arrondi {
my $n = shift || '';
my $arrondi = sprintf("%.0f", $n);
return $arrondi;
}