<th>Pr&eacute;nom</th>
							<th>Email</th>
							<th>Donn&eacute;e 1</th>
							<th>Donn&eacute;e 2</th>
							<th>&nbsp;</th>
						  </tr>
						  <tr>
						  </tr>
						</thead>
						<tbody>
						  <?php 
    foreach ($data_out['liste_forms'] as $form) {
        ?>
						<tr>
							<td align="center" valign="top" nowrap="nowrap"><?php 
        echo $form['date_add'] != '' ? Lib_enToFr($form['date_add']) : '';
        ?>
</td>
							<td align="left" valign="top" nowrap="nowrap"><?php 
        echo $form['nom'];
        ?>
</td>
							<td align="left" valign="top" nowrap="nowrap"><?php 
        echo $form['prenom'];
        ?>
</td>
							<td align="left" valign="top" nowrap="nowrap"><?php 
        echo $form['form1'];
        ?>
</td>
							<td align="left" valign="top" nowrap="nowrap"><?php 
 /**
 Retourne un tableau de factures correspondant aux champs du tableau en argument.
 @param $args
 */
 function Factures_chercher($args)
 {
     $tab_result = array();
     $sql = " SELECT * \n\t\t\t\tFROM " . $GLOBALS['prefix'] . "factures\n\t\t\t\tWHERE 1";
     if (!isset($args['id_facture']) && !isset($args['id_pere']) && !isset($args['type_pere']) && !isset($args['etat']) && !isset($args['date_facture_debut']) && !isset($args['date_facture_fin']) && !isset($args['date_facture']) && !isset($args['num_facture']) && !isset($args['order_by']) && !isset($args['tab_ids_factures'])) {
         return $tab_result;
     }
     $condition = "";
     if (isset($args['id_facture']) && $args['id_facture'] != "*") {
         $condition .= " AND id_facture = '" . $args['id_facture'] . "' ";
     }
     if (isset($args['id_pere']) && $args['id_pere'] != "*") {
         $condition .= " AND id_pere = " . $args['id_pere'] . " ";
     }
     if (isset($args['type_pere']) && $args['type_pere'] != "*") {
         $condition .= " AND type_pere LIKE '" . $args['type_pere'] . "' ";
     }
     if (isset($args['etat']) && $args['etat'] != "*") {
         $condition .= " AND etat = '" . $args['etat'] . "' ";
     }
     if (isset($args['date_facture']) && $args['date_facture'] != "*") {
         $condition .= " AND date_facture = '" . Lib_frToEn($args['date_facture']) . "' ";
     }
     if (isset($args['date_facture_debut']) && $args['date_facture_debut'] != "*") {
         $condition .= " AND date_facture >= '" . Lib_frToEn($args['date_facture_debut']) . "' ";
     }
     if (isset($args['date_facture_fin']) && $args['date_facture_fin'] != "*") {
         $condition .= " AND date_facture <= '" . Lib_frToEn($args['date_facture_fin']) . "' ";
     }
     if (isset($args['num_facture']) && $args['num_facture'] != "*") {
         $condition .= " AND num_facture LIKE '" . $args['num_facture'] . "' ";
     }
     if (isset($args['tab_ids_factures']) && $args['tab_ids_factures'] != "*") {
         $ids = implode(",", $args['tab_ids_factures']);
         $condition .= " AND id_facture IN (0" . $ids . ") ";
     }
     $sql .= $condition;
     if (isset($args['order_by']) && !isset($args['asc_desc'])) {
         $sql .= " ORDER BY " . $args['order_by'] . " ASC";
     }
     if (isset($args['order_by']) && isset($args['asc_desc'])) {
         $sql .= " ORDER BY " . $args['order_by'] . " " . $args['asc_desc'];
     }
     if (isset($args['limit']) && !isset($args['start'])) {
         $sql .= " LIMIT " . $args['limit'];
     }
     if (isset($args['limit']) && isset($args['start'])) {
         $sql .= " LIMIT " . $args['start'] . "," . $args['limit'];
     }
     /*=============*/
     Lib_myLog("SQL: {$sql}");
     $result = mysql_query($sql);
     if ($result) {
         while ($row = mysql_fetch_array($result)) {
             $id = $row['id_facture'];
             $tab_result[$id]["id_facture"] = $id;
             $tab_result[$id]["id_pere"] = $row['id_pere'];
             $tab_result[$id]["type_pere"] = $row['type_pere'];
             $tab_result[$id]["montant_ttc"] = $row['montant_ttc'];
             $tab_result[$id]["etat"] = $row['etat'];
             $tab_result[$id]["date_facture"] = Lib_enToFr($row['date_facture']);
             $tab_result[$id]["num_facture"] = $row['num_facture'];
             $tab_result[$id]["message"] = Lib_prepareTexteAffichage($row['message']);
             $tab_result[$id]["produit"] = Lib_prepareTexteAffichage($row['produit']);
             $tab_result[$id]["id_mode_reglement"] = $row['id_mode_reglement'];
             $tab_result[$id]["id_delai_reglement"] = $row['id_delai_reglement'];
             $tab_result[$id]["code_client"] = $row['code_client'];
             $tab_result[$id]["nom_fact"] = Lib_prepareTexteAffichage($row['nom_fact']);
             $tab_result[$id]["ligne1_fact"] = Lib_prepareTexteAffichage($row['ligne1_fact']);
             $tab_result[$id]["ligne2_fact"] = Lib_prepareTexteAffichage($row['ligne2_fact']);
             $tab_result[$id]["ligne3_fact"] = Lib_prepareTexteAffichage($row['ligne3_fact']);
             $tab_result[$id]["cp_fact"] = $row['cp_fact'];
             $tab_result[$id]["ville_fact"] = Lib_prepareTexteAffichage($row['ville_fact']);
             $tab_result[$id]["tel1_fact"] = $row['tel1_fact'];
             $tab_result[$id]["tel2_fact"] = $row['tel2_fact'];
             $tab_result[$id]["fax_fact"] = $row['fax_fact'];
             $tab_result[$id]["email_fact"] = $row['email_fact'];
             $tab_result[$id]["date_add"] = $row['date_add'];
             $tab_result[$id]["date_upd"] = $row['date_upd'];
             $tab_result[$id]["info_facture"] = $row['info_facture'];
         }
     }
     if (count($tab_result) == 1 && ($args['id_facture'] != '' && $args['id_facture'] != '*')) {
         $tab_result = array_pop($tab_result);
     }
     return $tab_result;
 }
Example #3
0
 /**
  Renvoie le lang, le prélang et l'identifiant des personnes ayant les données passées en argument sous forme d'un tableau
  @param id_tache
  @param langPersonne
  @param textePersonne
  ...
 */
 function Taches_chercher($args)
 {
     $tab_result = array();
     $sql = " SELECT * \n\t\t\tFROM " . $GLOBALS['prefix'] . "taches\n\t\t\tWHERE 1";
     if (!isset($args['id_tache']) && !isset($args['code']) && !isset($args['code_news']) && !isset($args['date']) && !isset($args['lang']) && !isset($args['titre']) && !isset($args['position']) && !isset($args['titre_data1']) && !isset($args['data1']) && !isset($args['titre_data2']) && !isset($args['data2']) && !isset($args['titre_data3']) && !isset($args['data3']) && !isset($args['titre_data4']) && !isset($args['data4']) && !isset($args['titre_data5']) && !isset($args['data5']) && !isset($args['titre_data6']) && !isset($args['data6']) && !isset($args['texte']) && !isset($args['etat']) && !isset($args['position_une']) && !isset($args['not_position_une']) && !isset($args['code']) && !isset($args['titre_canonize']) && !isset($args['tab_ids_taches']) && !isset($args['categorie'])) {
         return $tab_result;
     }
     $condition = "";
     if (isset($args['id_tache']) && $args['id_tache'] != "*") {
         $condition .= " AND id_tache = " . Sql_prepareTexteStockage($args['id_tache']) . " ";
     }
     if (isset($args['code_news'])) {
         $condition .= " AND code_news LIKE '" . Sql_prepareTexteStockage($args['code_news']) . "' ";
     }
     if (isset($args['position']) && $args['position'] != "*") {
         $condition .= " AND position = '" . $args['position'] . "' ";
     }
     if (isset($args['position_une'])) {
         $condition .= " AND position_une = " . $args['position_une'] . " ";
     }
     if (isset($args['not_position_une'])) {
         $condition .= " AND position_une != " . $args['not_position_une'] . " ";
     }
     if (isset($args['position_une_min'])) {
         $condition .= " AND position_une >= " . $args['position_une_min'] . " ";
     }
     if (isset($args['code'])) {
         $condition .= " AND code = '" . $args['code'] . "' ";
     }
     if (isset($args['lang'])) {
         $condition .= " AND lang = '" . $args['lang'] . "' ";
     }
     if (isset($args['texte'])) {
         $condition .= " AND texte LIKE '" . Sql_prepareTexteStockage($args['texte']) . "' ";
     }
     if (isset($args['titre'])) {
         $condition .= " AND titre LIKE '" . Sql_prepareTexteStockage($args['titre']) . "' ";
     }
     if (isset($args['etat'])) {
         $condition .= " AND etat = '" . $args['etat'] . "' ";
     }
     if (isset($args['meta_titre'])) {
         $condition .= " AND meta_titre = '" . $args['meta_titre'] . "' ";
     }
     if (isset($args['meta_description'])) {
         $condition .= " AND meta_description = '" . $args['meta_description'] . "' ";
     }
     if (isset($args['meta_mots_clefs'])) {
         $condition .= " AND meta_mots_clefs = '" . $args['meta_mots_clefs'] . "' ";
     }
     if (isset($args['meta_url'])) {
         $condition .= " AND meta_url = '" . $args['meta_url'] . "' ";
     }
     if (isset($args['titre_canonize'])) {
         $condition .= " AND titre_canonize LIKE '" . $args['titre_canonize'] . "' ";
     }
     if (isset($args['categorie'])) {
         $condition .= " AND categorie LIKE '" . $args['categorie'] . "' ";
     }
     if (isset($args['titre_data1'])) {
         $condition .= " AND titre_data1 LIKE '" . $args['titre_data1'] . "' ";
     }
     if (isset($args['titre_data2'])) {
         $condition .= " AND titre_data2 LIKE '" . $args['titre_data2'] . "' ";
     }
     if (isset($args['titre_data3'])) {
         $condition .= " AND titre_data3 LIKE '" . $args['titre_data3'] . "' ";
     }
     if (isset($args['titre_data4'])) {
         $condition .= " AND titre_data4 LIKE '" . $args['titre_data4'] . "' ";
     }
     if (isset($args['titre_data5'])) {
         $condition .= " AND titre_data5 LIKE '" . $args['titre_data5'] . "' ";
     }
     if (isset($args['titre_data6'])) {
         $condition .= " AND titre_data6 LIKE '" . $args['titre_data6'] . "' ";
     }
     if (isset($args['titre_data7'])) {
         $condition .= " AND titre_data7 LIKE '" . $args['titre_data7'] . "' ";
     }
     if (isset($args['titre_data8'])) {
         $condition .= " AND titre_data8 LIKE '" . $args['titre_data8'] . "' ";
     }
     if (isset($args['titre_data9'])) {
         $condition .= " AND titre_data9 LIKE '" . $args['titre_data9'] . "' ";
     }
     if (isset($args['titre_data10'])) {
         $condition .= " AND titre_data10 LIKE '" . $args['titre_data10'] . "' ";
     }
     if (isset($args['titre_data11'])) {
         $condition .= " AND titre_data11 LIKE '" . $args['titre_data11'] . "' ";
     }
     if (isset($args['titre_data12'])) {
         $condition .= " AND titre_data12 LIKE '" . $args['titre_data12'] . "' ";
     }
     if (isset($args['titre_data13'])) {
         $condition .= " AND titre_data13 LIKE '" . $args['titre_data13'] . "' ";
     }
     if (isset($args['titre_data14'])) {
         $condition .= " AND titre_data14 LIKE '" . $args['titre_data14'] . "' ";
     }
     if (isset($args['titre_data15'])) {
         $condition .= " AND titre_data15 LIKE '" . $args['titre_data15'] . "' ";
     }
     if (isset($args['titre_data16'])) {
         $condition .= " AND titre_data16 LIKE '" . $args['titre_data16'] . "' ";
     }
     if (isset($args['titre_data17'])) {
         $condition .= " AND titre_data17 LIKE '" . $args['titre_data17'] . "' ";
     }
     if (isset($args['titre_data18'])) {
         $condition .= " AND titre_data18 LIKE '" . $args['titre_data18'] . "' ";
     }
     if (isset($args['titre_data19'])) {
         $condition .= " AND titre_data19 LIKE '" . $args['titre_data19'] . "' ";
     }
     if (isset($args['titre_data20'])) {
         $condition .= " AND titre_data620 LIKE '" . $args['titre_data20'] . "' ";
     }
     if (isset($args['data1'])) {
         $condition .= " AND data1 LIKE '" . $args['data1'] . "' ";
     }
     if (isset($args['data2'])) {
         $condition .= " AND data2 LIKE '" . $args['data2'] . "' ";
     }
     if (isset($args['data3'])) {
         $condition .= " AND data3 LIKE '" . $args['data3'] . "' ";
     }
     if (isset($args['data4'])) {
         $condition .= " AND data4 LIKE '" . $args['data4'] . "' ";
     }
     if (isset($args['data5'])) {
         $condition .= " AND data5 LIKE '" . $args['data5'] . "' ";
     }
     if (isset($args['data6'])) {
         $condition .= " AND data6 LIKE '" . $args['data6'] . "' ";
     }
     if (isset($args['data7'])) {
         $condition .= " AND data7 LIKE '" . $args['data7'] . "' ";
     }
     if (isset($args['data8'])) {
         $condition .= " AND data8 LIKE '" . $args['data8'] . "' ";
     }
     if (isset($args['data9'])) {
         $condition .= " AND data9 LIKE '" . $args['data9'] . "' ";
     }
     if (isset($args['data10'])) {
         $condition .= " AND data10 LIKE '" . $args['data10'] . "' ";
     }
     if (isset($args['data11'])) {
         $condition .= " AND data11 LIKE '" . $args['data11'] . "' ";
     }
     if (isset($args['data12'])) {
         $condition .= " AND data12 LIKE '" . $args['data12'] . "' ";
     }
     if (isset($args['data13'])) {
         $condition .= " AND data13 LIKE '" . $args['data13'] . "' ";
     }
     if (isset($args['data14'])) {
         $condition .= " AND data14 LIKE '" . $args['data14'] . "' ";
     }
     if (isset($args['data15'])) {
         $condition .= " AND data15 LIKE '" . $args['data15'] . "' ";
     }
     if (isset($args['data16'])) {
         $condition .= " AND data16 LIKE '" . $args['data16'] . "' ";
     }
     if (isset($args['data17'])) {
         $condition .= " AND data17 LIKE '" . $args['data17'] . "' ";
     }
     if (isset($args['data18'])) {
         $condition .= " AND data18 LIKE '" . $args['data18'] . "' ";
     }
     if (isset($args['data19'])) {
         $condition .= " AND data19 LIKE '" . $args['data19'] . "' ";
     }
     if (isset($args['data20'])) {
         $condition .= " AND data20 LIKE '" . $args['data20'] . "' ";
     }
     if (isset($args['tab_ids_taches'])) {
         $ids = implode(",", $args['tab_ids_taches']);
         $condition .= " AND id_tache IN (" . $ids . ") ";
     }
     if (!isset($args['etat'])) {
         $condition .= " AND etat != 'supprime' ";
     }
     if (isset($args['order_by']) && $args['order_by'] != "*") {
         $condition .= " ORDER BY " . $args['order_by'] . " ASC ";
     } else {
         $condition .= " ORDER BY id_tache ASC ";
     }
     $sql .= $condition;
     /*=============*/
     Lib_myLog("SQL: {$sql}");
     $result = Sql_query($sql);
     if ($result && Sql_errorCode($result) === "00000") {
         while ($row = Sql_fetch($result)) {
             $id = $row['id_tache'];
             $tab_result[$id]["id_tache"] = $id;
             $tab_result[$id]["code"] = $row['code'];
             $tab_result[$id]["lang"] = $row['lang'];
             $tab_result[$id]["position_une"] = $row['position_une'];
             $tab_result[$id]["position"] = $row['position'];
             $tab_result[$id]["code_news"] = $row['code_news'];
             $tab_result[$id]["contenu"] = $row['contenu'];
             $tab_result[$id]["date"] = Lib_enToFr($row['date']);
             $tab_result[$id]["texte"] = Sql_prepareTexteAffichage($row['texte']);
             $tab_result[$id]["etat"] = $row['etat'];
             $tab_result[$id]["image_intro"] = Sql_prepareTexteAffichage($row['image_intro']);
             $tab_result[$id]["texte_intro"] = Sql_prepareTexteAffichage($row['texte_intro']);
             $tab_result[$id]["titre"] = Sql_prepareTexteAffichage($row['titre']);
             $tab_result[$id]["titre_page"] = Sql_prepareTexteAffichage($row['titre_page']);
             $tab_result[$id]["meta_titre"] = Sql_prepareTexteAffichage($row['meta_titre']);
             $tab_result[$id]["meta_description"] = Sql_prepareTexteAffichage($row['meta_description']);
             $tab_result[$id]["meta_mots_clefs"] = Sql_prepareTexteAffichage($row['meta_mots_clefs']);
             $tab_result[$id]["meta_url"] = Sql_prepareTexteAffichage($row['meta_url']);
             $tab_result[$id]["titre_canonize"] = $row['titre_canonize'];
             $tab_result[$id]["url_vignette"] = $row['url_vignette'];
             $tab_result[$id]["url_image"] = $row['url_image'];
             $tab_result[$id]["url_image2"] = $row['url_image2'];
             $tab_result[$id]["categorie"] = $row['categorie'];
             $tab_result[$id]["titre_data1"] = Sql_prepareTexteAffichage($row['titre_data1']);
             $tab_result[$id]["data1"] = Sql_prepareTexteAffichage($row['data1']);
             $tab_result[$id]["titre_data2"] = Sql_prepareTexteAffichage($row['titre_data2']);
             $tab_result[$id]["data2"] = Lib_enToFr($row['data2']);
             $tab_result[$id]["titre_data3"] = Sql_prepareTexteAffichage($row['titre_data3']);
             $tab_result[$id]["data3"] = Lib_enToFr($row['data3']);
             $tab_result[$id]["titre_data4"] = Sql_prepareTexteAffichage($row['titre_data4']);
             $tab_result[$id]["data4"] = Lib_enToFr($row['data4']);
             $tab_result[$id]["titre_data5"] = Sql_prepareTexteAffichage($row['titre_data5']);
             $tab_result[$id]["data5"] = Sql_prepareTexteAffichage($row['data5']);
             $tab_result[$id]["titre_data6"] = Sql_prepareTexteAffichage($row['titre_data6']);
             $tab_result[$id]["data6"] = Sql_prepareTexteAffichage($row['data6']);
             $tab_result[$id]["titre_data7"] = Sql_prepareTexteAffichage($row['titre_data7']);
             $tab_result[$id]["data7"] = Sql_prepareTexteAffichage($row['data7']);
             $tab_result[$id]["titre_data8"] = Sql_prepareTexteAffichage($row['titre_data8']);
             $tab_result[$id]["data8"] = Sql_prepareTexteAffichage($row['data8']);
             $tab_result[$id]["titre_data9"] = Sql_prepareTexteAffichage($row['titre_data9']);
             $tab_result[$id]["data9"] = Sql_prepareTexteAffichage($row['data9']);
             $tab_result[$id]["titre_data10"] = Sql_prepareTexteAffichage($row['titre_data10']);
             $tab_result[$id]["data10"] = Sql_prepareTexteAffichage($row['data10']);
             $tab_result[$id]["titre_data11"] = Sql_prepareTexteAffichage($row['titre_data11']);
             $tab_result[$id]["data11"] = Sql_prepareTexteAffichage($row['data11']);
             $tab_result[$id]["titre_data12"] = Sql_prepareTexteAffichage($row['titre_data12']);
             $tab_result[$id]["data12"] = Sql_prepareTexteAffichage($row['data12']);
             $tab_result[$id]["titre_data13"] = Sql_prepareTexteAffichage($row['titre_data13']);
             $tab_result[$id]["data13"] = Sql_prepareTexteAffichage($row['data13']);
             $tab_result[$id]["titre_data14"] = Sql_prepareTexteAffichage($row['titre_data14']);
             $tab_result[$id]["data14"] = Sql_prepareTexteAffichage($row['data14']);
             $tab_result[$id]["titre_data15"] = Sql_prepareTexteAffichage($row['titre_data15']);
             $tab_result[$id]["data15"] = Sql_prepareTexteAffichage($row['data15']);
             $tab_result[$id]["titre_data16"] = Sql_prepareTexteAffichage($row['titre_data16']);
             $tab_result[$id]["data16"] = Sql_prepareTexteAffichage($row['data16']);
             $tab_result[$id]["titre_data17"] = Sql_prepareTexteAffichage($row['titre_data17']);
             $tab_result[$id]["data17"] = Sql_prepareTexteAffichage($row['data17']);
             $tab_result[$id]["titre_data18"] = Sql_prepareTexteAffichage($row['titre_data18']);
             $tab_result[$id]["data18"] = Sql_prepareTexteAffichage($row['data18']);
             $tab_result[$id]["titre_data19"] = Sql_prepareTexteAffichage($row['titre_data19']);
             $tab_result[$id]["data19"] = Sql_prepareTexteAffichage($row['data19']);
             $tab_result[$id]["titre_data20"] = Sql_prepareTexteAffichage($row['titre_data20']);
             $tab_result[$id]["data20"] = Sql_prepareTexteAffichage($row['data20']);
             $tab_result[$id]["titre_fichier1"] = Sql_prepareTexteAffichage($row['titre_fichier1']);
             $tab_result[$id]["fichier1"] = Sql_prepareTexteAffichage($row['fichier1']);
             $tab_result[$id]["titre_fichier2"] = Sql_prepareTexteAffichage($row['titre_fichier1']);
             $tab_result[$id]["fichier2"] = Sql_prepareTexteAffichage($row['fichier2']);
             $tab_result[$id]["titre_fichier3"] = Sql_prepareTexteAffichage($row['titre_fichier3']);
             $tab_result[$id]["fichier3"] = Sql_prepareTexteAffichage($row['fichier3']);
             $tab_result[$id]["titre_fichier4"] = Sql_prepareTexteAffichage($row['titre_fichier4']);
             $tab_result[$id]["fichier4"] = Sql_prepareTexteAffichage($row['fichier4']);
             $tab_result[$id]["titre_fichier5"] = Sql_prepareTexteAffichage($row['titre_fichier5']);
             $tab_result[$id]["fichier5"] = Sql_prepareTexteAffichage($row['fichier5']);
             $tab_result[$id]["date_add"] = $row['date_add'];
             $tab_result[$id]["date_upd"] = $row['date_upd'];
             $tab_result[$id]["info_tache"] = Sql_prepareTexteAffichage($row['info_tache']);
         }
     }
     if (count($tab_result) == 1 && ($args['id_tache'] != '' && $args['id_tache'] != '*')) {
         $tab_result = array_pop($tab_result);
     }
     if (count($tab_result) == 1 && $args['code'] != '' && $args['lang'] != '') {
         $tab_result = array_pop($tab_result);
     }
     return $tab_result;
 }
 /**
 Retourne un tableau de commandes correspondant aux champs du tableau en argument.
 @param $args
 */
 function Commandes_chercher($args)
 {
     $count = 0;
     $tab_result = array();
     if (isset($args['count'])) {
         $sql = " SELECT count(*) nb_enregistrements \n\t\t\t\t\tFROM " . $GLOBALS['prefix'] . "commande\n\t\t\t\t\tWHERE 1";
     } else {
         $sql = " SELECT * \n\t\t\t\t\tFROM " . $GLOBALS['prefix'] . "commande\n\t\t\t\t\tWHERE 1";
     }
     if (!isset($args['id_commande']) && !isset($args['id_utilisateur']) && !isset($args['id_customer']) && !isset($args['id_pg_vg']) && !isset($args['date_commande']) && !isset($args['etat']) && !isset($args['order_by']) && !isset($args['etat']) && !isset($args['tab_ids_commandes'])) {
         return $tab_result;
     }
     $condition = "";
     if (isset($args['id_commande']) && $args['id_commande'] != "*") {
         $condition .= " AND id_commande = '" . $args['id_commande'] . "' ";
     }
     if (isset($args['id_utilisateur']) && $args['id_utilisateur'] != "*") {
         $condition .= " AND id_utilisateur = '" . $args['id_utilisateur'] . "' ";
     }
     if (isset($args['id_customer']) && $args['id_customer'] != "*") {
         $condition .= " AND id_customer = '" . $args['id_customer'] . "' ";
     }
     if (isset($args['id_pg_vg']) && $args['id_pg_vg'] != "*") {
         $condition .= " AND id_pg_vg = '" . $args['id_pg_vg'] . "' ";
     }
     if (isset($args['date_commande']) && $args['date_commande'] != "*") {
         $condition .= " AND date_commande = '" . Lib_frToEn($args['date_commande']) . "' ";
     }
     if (isset($args['etat']) && $args['etat'] != "*") {
         $condition .= " AND etat = '" . $args['etat'] . "' ";
     }
     if (isset($args['tab_ids_commandes']) && $args['tab_ids_commandes'] != "*") {
         $ids = implode(",", $args['tab_ids_commandes']);
         $condition .= " AND id_commande IN (0" . $ids . ") ";
     }
     if (!isset($args['etat'])) {
         $condition .= " AND etat != 'supprime' ";
     }
     $sql .= $condition;
     if (isset($args['order_by']) && !isset($args['asc_desc'])) {
         $sql .= " ORDER BY " . $args['order_by'] . " ASC";
     }
     if (isset($args['order_by']) && isset($args['asc_desc'])) {
         $sql .= " ORDER BY " . $args['order_by'] . " " . $args['asc_desc'];
     }
     if (isset($args['limit']) && !isset($args['start'])) {
         $sql .= " LIMIT " . $args['limit'];
     }
     if (isset($args['limit']) && isset($args['start'])) {
         $sql .= " LIMIT " . $args['start'] . "," . $args['limit'];
     }
     /*=============*/
     Lib_myLog("SQL: {$sql}");
     $result = Sql_query($sql);
     if (isset($args['count'])) {
         if ($result && Sql_errorCode($result) === "00000") {
             $row = Sql_fetch($result);
             $count = $row['nb_enregistrements'];
         }
         return $count;
     } else {
         if ($result && Sql_errorCode($result) === "00000") {
             while ($row = Sql_fetch($result)) {
                 $id = $row['id_commande'];
                 $tab_result[$id]["id_commande"] = $id;
                 $tab_result[$id]["id_utilisateur"] = $row['id_utilisateur'];
                 $tab_result[$id]["id_customer"] = $row['id_customer'];
                 $tab_result[$id]["id_pg_vg"] = $row['id_pg_vg'];
                 $tab_result[$id]["date_commande"] = Lib_enToFr($row['date_commande']);
                 $tab_result[$id]["nb_imp"] = $row['nb_imp'];
                 $tab_result[$id]["num_lot"] = Sql_prepareTexteAffichage($row['num_lot']);
                 $tab_result[$id]["etat"] = $row['etat'];
                 $tab_result[$id]["date_add"] = $row['date_add'];
                 $tab_result[$id]["date_upd"] = $row['date_upd'];
                 $tab_result[$id]["info_commande"] = Sql_prepareTexteAffichage($row['info_commande']);
             }
         }
         if (count($tab_result) == 1 && ($args['id_commande'] != '' && $args['id_commande'] != '*')) {
             $tab_result = array_pop($tab_result);
         }
     }
     return $tab_result;
 }
 /**
 Retourne un tableau de reglements correspondant aux champs du tableau en argument.
 @param $args
 */
 function Reglements_chercher($args)
 {
     $tab_result = array();
     $sql = " SELECT * \n\t\t\t\tFROM " . $GLOBALS['prefix'] . "facture_reglements\n\t\t\t\tWHERE 1";
     if (!isset($args['id_reglement']) && !isset($args['id_facture']) && !isset($args['date_reglement']) && !isset($args['id_mode_reglement']) && !isset($args['order_by']) && !isset($args['tab_ids_reglements'])) {
         return $tab_result;
     }
     $condition = "";
     if (isset($args['id_reglement']) && $args['id_reglement'] != "*") {
         $condition .= " AND id_reglement = '" . $args['id_reglement'] . "' ";
     }
     if (isset($args['id_facture']) && $args['id_facture'] != "*") {
         $condition .= " AND id_facture = '" . $args['id_facture'] . "' ";
     }
     if (isset($args['date_reglement']) && $args['date_reglement'] != "*") {
         $condition .= " AND date_reglement = '" . Lib_frToEn($args['date_reglement']) . "' ";
     }
     if (isset($args['id_mode_reglement']) && $args['id_mode_reglement'] != "*") {
         $condition .= " AND id_mode_reglement = '" . $args['id_mode_reglement'] . "' ";
     }
     if (isset($args['tab_ids_reglements']) && $args['tab_ids_reglements'] != "*") {
         $ids = implode(",", $args['tab_ids_reglements']);
         $condition .= " AND id_reglement IN (0" . $ids . ") ";
     }
     $sql .= $condition;
     if (isset($args['order_by']) && !isset($args['asc_desc'])) {
         $sql .= " ORDER BY " . $args['order_by'] . " ASC";
     }
     if (isset($args['order_by']) && isset($args['asc_desc'])) {
         $sql .= " ORDER BY " . $args['order_by'] . " " . $args['asc_desc'];
     }
     if (isset($args['limit']) && !isset($args['start'])) {
         $sql .= " LIMIT " . $args['limit'];
     }
     if (isset($args['limit']) && isset($args['start'])) {
         $sql .= " LIMIT " . $args['start'] . "," . $args['limit'];
     }
     /*=============*/
     Lib_myLog("SQL: {$sql}");
     $result = mysql_query($sql);
     if ($result) {
         while ($row = mysql_fetch_array($result)) {
             $id = $row['id_reglement'];
             $tab_result[$id]["id_reglement"] = $id;
             $tab_result[$id]["id_facture"] = $row['id_facture'];
             $tab_result[$id]["montant"] = $row['montant'];
             $tab_result[$id]["date_reglement"] = Lib_enToFr($row['date_reglement']);
             $tab_result[$id]["id_mode_reglement"] = $row['id_mode_reglement'];
             $tab_result[$id]["date_add"] = $row['date_add'];
             $tab_result[$id]["date_upd"] = $row['date_upd'];
             $tab_result[$id]["info_reglement"] = $row['info_reglement'];
         }
     }
     if (count($tab_result) == 1 && ($args['id_reglement'] != '' && $args['id_reglement'] != '*')) {
         $tab_result = array_pop($tab_result);
     }
     return $tab_result;
 }