THELIA Forum

Welcome to the THELIA support and discusssion forum

Announcement

Rejoignez la communauté sur le Discord Thelia : https://discord.gg/YgwpYEE3y3

Offline


Bonsoir tout le monde,

je viens vers vous car je cherche à afficher des renseignement en plus sur la page commande.php sur le back office.

Personnellement, affiché le mode de paiement (chèque, virement, CB,...) permettrait de voir plus rapidement la commande et de vérifier sans avoir à "ouvrir" la commande en entier. Malheureusement, je n'arrive pas à l'afficher, malgrès plusieurs bidouillages.

De plus l'affichage du numéro de colis ( <?php echo($row->colis); ?> ), est fort utile, notammenent, pour les commandes "en traitement", on voit plus rapidement celle qui sont prête à être expédiées.

Enfin bon si quelqu'un a une idée pour mon problème d'affichage de paiement.

Merci bonne soirée.

Thibault

Offline


Pour afficher le titre du module de paiement :

$mod = new Modules($row->paiement);
$moddesc = new ModulesDesc($mod->nom);
echo $moddesc->titre;

Last edited by roadster31 (07-12-2011 23:51:20)


OpenStudio Toulouse

Offline


Merci pour ta rapidité. Du coup je colle le code de ma page commande.php du Back office si ça peut servir à quelqu'un

<?php
	require_once("pre.php");
	require_once("auth.php");
?>
<?php if(! est_autorise("acces_commandes")) exit; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
	require_once("title.php");
?>
<script src="../lib/jquery/jquery.js" type="text/javascript"></script>
<script src="../lib/jquery/jeditable.js" type="text/javascript"></script>
<script src="../lib/jquery/menu.js" type="text/javascript"></script>
<script type="text/javascript">
function tri(order,critere){
	$.ajax({
		type:"GET",
		url:"ajax/tricommande.php",
		data : 'order='+order+'&critere='+critere,
		success : function(html){
			$("#resul").html(html);
		}
	})
}
</script>
</head>
<?php

	require_once("../classes/Commande.class.php");
	require_once("../classes/Client.class.php");
	require_once("../classes/Venteprod.class.php");
	require_once("../classes/Ventedeclidisp.class.php");
	require_once("../classes/Stock.class.php");
	require_once("../classes/Statut.class.php");
	require_once("../classes/Statutdesc.class.php");
	require_once("../fonctions/divers.php");
	require_once("../classes/Devise.class.php");

	if(!isset($action)) $action="";
	if(!isset($client)) $client="";
	if(!isset($page)) $page=0;
	if(!isset($classement)) $classement="";

?>

<?php
	if($action == "supprimer"){

		$tempcmd = new Commande();
		$tempcmd->charger($id);

		try {
			$modules = new Modules();
			if ($modules->charger_id($tempcmd->paiement))
			{
				$modpaiement = ActionsAdminModules::instance()->instancier($modules->nom);

				$defalqcmd = $modpaiement->defalqcmd;
			}
		} catch (Exception $ex) {
			$defalqcmd = "";
		}

		// On remet le stock si il a été défalqué

        if($defalqcmd || (! $defalqcmd && $tempcmd->statut != "1")){
   			$venteprod = new Venteprod();
   			$query = "select * from $venteprod->table where commande='" . $id . "'";
   			$resul = mysql_query($query, $venteprod->link);

			while($row = mysql_fetch_object($resul)){
				// incrémentation du stock général
    			$produit = new Produit();
				$produit->charger($row->ref);
				$produit->stock = $produit->stock + $row->quantite;
    			$produit->maj();

				$vdec = new Ventedeclidisp();

				$query2 = "select * from $vdec->table where venteprod='" . $row->id . "'";
				$resul2 = mysql_query($query2, $vdec->link);


				while($row2 = mysql_fetch_object($resul2)){
					$stock = new Stock();
					if($stock->charger($row2->declidisp, $produit->id)){
						$stock->valeur = $stock->valeur + $row->quantite;
						$stock->maj();
					}


				}
			}
		}

		$tempcmd->statut = "5";
		$tempcmd->maj();

		ActionsModules::instance()->appel_module("statut", $tempcmd);

	}

?>

<?php
	if(isset($_GET['statut']) && $_GET['statut'] != "")
  		$search="and statut=" . $_GET['statut'];
	else
		 $search="and statut not in (5,4)";

  	if($client != "") $search .= " and client=\"$client\"";
  	$commande = new Commande();
  	if($page=="") $page=1;

   	$query = "select * from $commande->table where 1 $search";
  	$resul = mysql_query($query, $commande->link);
  	$num = mysql_num_rows($resul);

  	$nbpage = 20;
  	$totnbpage = ceil($num/30);

  	$debut = ($page-1) * 30;

  	if($page>1) $pageprec=$page-1;
  	else $pageprec=$page;

  	if($page<$totnbpage) $pagesuiv=$page+1;
  	else $pagesuiv=$page;

  	if($classement == "client") $ordclassement = "order by client";
  	else if($classement == "statut") $ordclassement = "order by statut";
  	else $ordclassement = "order by date desc";

?>

<script type="text/JavaScript">

function supprimer(id){
	if(confirm("Voulez-vous vraiment annuler cette commande ?")) location="commande.php?action=supprimer&id=" + id;

}

</script>

<body>

<div id="wrapper">
<div id="subwrapper">

<?php
	$menu="commande";
	require_once("entete.php");
?>


<div id="contenu_int">
    <p align="left"><a href="accueil.php" class="lien04"><?php echo trad('Accueil'); ?> </a><img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04"><?php echo trad('Gestion_commandes'); ?></a>
    </p>
<div class="entete_liste_client">
	<div class="titre"><?php echo trad('LISTE_COMMANDES'); ?></div><div class="fonction_ajout"><a href="commande_creer.php"><?php echo trad('CREER_COMMANDE'); ?></a> </div>
</div>
<ul id="Nav">
		<li style="height:25px; width:129px; border-left:1px solid #96A8B5;"><?php echo trad('Num_commande', 'admin'); ?></li>	
		<li style="height:25px; width:111px; border-left:1px solid #96A8B5;"><?php echo trad('Date_Heure'); ?></li>		
		<li style="height:25px; width:177px; border-left:1px solid #96A8B5;"><?php echo trad('Nom'); ?> & <?php echo trad('Prenom'); ?></li>
		<li style="height:25px; width:56px; border-left:1px solid #96A8B5;"><?php echo trad('Montant'); ?></li>
        <li style="height:25px; width:177px; border-left:1px solid #96A8B5;"><?php echo trad('Paiement'); ?></li>
		<li style="height:25px; width:77px; border-left:1px solid #96A8B5; background-image: url(gfx/picto_menu_deroulant.gif); background-position:right bottom; background-repeat: no-repeat;"><?php echo trad('Statut'); ?>
			<ul class="Menu">
			 <?php
       	 		$statut = new Statut();
       	 		$query_stat = "select * from $statut->table";
       	 		$resul_stat = mysql_query($query_stat, $statut->link);
       	 		while($row_stat = mysql_fetch_object($resul_stat)){
       	 			$statutdesc = new Statutdesc();
       	 			$statutdesc->charger($row_stat->id, $_SESSION["util"]->lang);
       	 	?>
				<li style="width:84px;"><a href="commande.php?statut=<?php echo $row_stat->id; ?>" name="<?php echo $row_stat->id; ?>"><?php echo $statutdesc->titre; ?></a></li>
			<?php
       	 	}
       	 	?>
			</ul>
		</li>
        <li style="height:25px; width:127px; border-left:1px solid #96A8B5;">Colis</li>
		<li style="height:25px; width:17px; border-left:1px solid #96A8B5;"></li>
		<li style="height:25px; width:17px; border-left:1px solid #96A8B5;"></li>
</ul>

<span id="resul">

  <?php
  	$i=0;

    	$query = "select * from $commande->table where 1 $search $ordclassement limit $debut,30";
  	$resul = mysql_query($query, $commande->link);

  	$venteprod = new Venteprod();
	

  	while($row = mysql_fetch_object($resul)){

  		$client = new Client();
  		$client->charger_id($row->client);

  		$statutdesc = new Statutdesc();
  		$statutdesc->charger($row->statut);

		$devise = new Devise();
		$devise->charger($row->devise);

  		$query2 = "SELECT sum(prixu*quantite) as total FROM $venteprod->table where commande='$row->id'";
  		$resul2 = mysql_query($query2, $venteprod->link);
  		$total = round(mysql_result($resul2, 0, "total"), 2);

		$port = $row->port;
		$total -= $row->remise;
		$total += $port;

  		$jour = substr($row->date, 8, 2);
  		$mois = substr($row->date, 5, 2);
  		$annee = substr($row->date, 2, 2);

  		$heure = substr($row->date, 11, 2);
  		$minute = substr($row->date, 14, 2);
  		$seconde = substr($row->date, 17, 2);
		
		$mod = new Modules($row->paiement);
$moddesc = new ModulesDesc($mod->nom);

	

  		if(!($i%2)) $fond="ligne_claire_rub";
  		else $fond="ligne_fonce_rub";
  		$i++;
  ?>
<ul class="<?php echo($fond); ?>">
	<li style="width:122px;"><?php echo($row->ref); ?></li>
	<li style="width:104px;"><?php echo($jour . "/" . $mois . "/" . $annee . " " . $heure . ":" . $minute . ":" . $seconde); ?></li>
	<li style="width:170px;"><a href="client_visualiser.php?ref=<?php echo($client->ref); ?>"><?php echo($client->nom . " " . $client->prenom); ?></a></li>
	<li style="width:49px;"><?php echo(round($total, 2)); ?> <?php echo $devise->symbole; ?></li>
    <li style="width:170px;"><?php echo $moddesc->titre; ?></li>
	<li style="width:70px;"><?php echo($statutdesc->titre); ?></li>
    <li style="width:120px;"><?php echo("<a href='http://www.coliposte.net/gp/services/main.jsp?m=10003005&colispart=".$row->colis."' target='_blank'>".$row->colis."</a>"); ?></li>
	<li style="width:10px;"><a href="commande_details.php?ref=<?php echo($row->ref); ?>"><img src="gfx/b_edit.png" width="9" height="9" border="0" alt="Editer la commande" /></a></li>
	<li style="width:10px; text-align:center;"><a href="#" onclick="supprimer('<?php echo($row->id); ?>')"><img src="gfx/supprimer.gif" width="9" height="9" border="0" alt="Supprimer la commande"/></a></li>
</ul>
<?php
	}
?>
</span>

<p id="pages">
<?php if($page > 1){ ?>
   <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($pageprec); ?>&statut=<?php echo $_GET['statut']; ?>" >Page précédente</a> |
	<?php } ?>
	<?php if($totnbpage > $nbpage){?>
		<?php if($page>1) {?><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=1&statut=<?php echo $_GET['statut']; ?>">...</a> | <?php } ?>
		<?php if($page+$nbpage-1 > $totnbpage){ $max = $totnbpage; $min = $totnbpage-$nbpage;} else{$min = $page-1; $max=$page+$nbpage-1; }?>
     <?php for($i=$min; $i<$max; $i++){ ?>
    	 <?php if($page != $i+1){ ?>
  	  		 <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($i+1); ?>&classement=<?php echo($classement); ?>&statut=<?php echo $_GET['statut']; ?>" ><?php echo($i+1); ?></a> |
    	 <?php } else {?>
    		 <span class="selected"><?php echo($i+1); ?></span>
    		 |
   		  <?php } ?>
     <?php } ?>
		<?php if($page < $totnbpage){?><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo $totnbpage; ?>&statut=<?php echo $_GET['statut']; ?>">...</a> | <?php } ?>
	<?php }
	else{
		for($i=0; $i<$totnbpage; $i++){ ?>
	    	 <?php if($page != $i+1){ ?>
	  	  		 <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($i+1); ?>&statut=<?php echo $_GET['statut']; ?><?php echo $lien_voir; ?>"><?php echo($i+1); ?></a> |
	    	 <?php } else {?>
	    		 <span class="selected"><?php echo($i+1); ?></span>
	    		|
	   		  <?php } ?>
	     <?php } ?>
	<?php } ?>
     <?php if($page < $totnbpage){ ?>
<a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($pagesuiv); ?>&statut=<?php echo $_GET['statut']; ?>">Page suivante</a></p>
	<?php } ?>
</div>
<?php
	require_once("pied.php");
?>
</div>
</div>
</body>
</html>

Offline


Merci Franck,  Merci Thibs,

Cette petite modification est très utile et il serait peut-être intéressant de l'implémenter dans une prochaine version de thelia.

Offline


Excellent c'est un gros manque dans le BO Thelia.

D'ailleurs je ne trouve pas de paramètre de sortie qui affiche le nom du paiement, seulement l'ID du paiement, et j'aimerai afficher dans la commande envoyée au vendeur le type de paiement.

Quelque chose comme _TYPEPAIMENT_ dans la fabrication des e-mail.

Une idée ?

Last edited by momo-fr (02-04-2013 09:31:39)

Offline


Bonjour, ça fait très longtemps que je ne suis pas venue quémander un truc ;-),
Je fais ce déterrage aujourd'hui car ça fait plusieurs heures que je tourne en rond moi avec cet affichage du type de paiement...

Je suis encore en 1.4.2.1 (oui, je sais, je sais...) sur ma boutique et je voudrais bien afficher le type du paiement comme le fait THIBS mais malgrés le bout de code fournie par Roadster31 et malgrès de multiples tentatives d'adaptation dans le code de ma page commande.php, je n'arrive jamais à afficher ce titre...

Roadster, Pourrais tu me donner le petit bout de code adapté à ma version de Thelia s'il te plait ?

Last edited by solakin (10-08-2015 11:41:14)

Offline


Je n'ai pas de 1.4.2.1 sous la main. Regarde donc dans la classe Modules la mzthode qui permet de charger l'objet avec l'ID du module.


OpenStudio Toulouse

Offline


Bonjour Roadster31,
Merci pour ta réponse super rapide.
Je place ici le code de modules.class.php

<?php
	include_once(realpath(dirname(__FILE__)) . "/Baseobj.class.php");
	include_once(realpath(dirname(__FILE__)) . "/Autorisation_modules.class.php");

	class Modules extends Baseobj{

		var $id;
		var $nom;
		var $type;
		var $actif;
		var $classement;

		var $table="modules";
		var $bddvars = array("id", "nom", "type", "actif", "classement");

		function Modules(){
			$this->Baseobj();	
		}
		
		function charger($nom){
			return $this->getVars("select * from $this->table where nom=\"$nom\"");
		}

		function charger_id($id){
			return $this->getVars("select * from $this->table where id=\"$id\"");
		}	

		function est_autorise(){
			if($_SESSION['util']->profil == "1")
				return 1;
				
			$verif = new Autorisation_modules();
			if($verif->charger($this->id, $_SESSION['util']->id) && $verif->autorise)
				return 1;
			
			return 0;
			
		}
	}


?>

N'étant pas développeur, je t'assure que j'ai bien essayer de comprendre et d'adapter des lignes de codes pour arriver à afficher le titre du plugin de paiement mais je n'arrive à rien, mon code ne retourne que du vide...
Si ça te demande un peu de travail, contacte moi en MP pour négocier une commande de tes services.

Je te remercie de bien vouloir m'aider.

Offline


C'est donc charger_id()


OpenStudio Toulouse

Offline


Ok Roadster, mais moi je patauge grave là donc si tu veux bien me donner les trois lignes à copier coller, tu me sauves du burnout :-) !
Comme je te l'ai dit, si ça te demande un peu de boulot, dit le moi, je t'ai déjà solliciter précédemment pour tes services et c'était bien
donc s'il faut que je te passe cette commande, dis le moi...

Offline


Ok, ok... J'espère que tu sauras où le coller.

$mod = new Modules() ;
$mod->charger_id($row->paiement);
$moddesc = new ModulesDesc($mod->nom);
echo $moddesc->titre;


OpenStudio Toulouse

Offline


Mince, j'y ai cru là !!!
Mais il faut croire que n'ai pas su où le placer... comme tu disais.

Je te place mon code ici, tu vois une erreur ( Je suppose que oui :-) ) ?

En tous cas merci encore de te pencher sur ça.

<?php
	include_once("pre.php");
	include_once("auth.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php include_once("title.php"); ?>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<div id="Wrapper">
<div id="Subwrapper">
<?php

	include_once("../classes/Commande.class.php");
	include_once("../classes/Client.class.php");
	include_once("../classes/Venteprod.class.php");
	include_once("../classes/Ventedeclidisp.class.php");
	include_once("../classes/Venteadr.class.php");
	include_once("../classes/Stock.class.php");
	include_once("../classes/Statutdesc.class.php");
	include_once("../classes/Modules.class.php");
	include_once("../classes/Modulesdesc.class.php");
	include_once("../fonctions/divers.php");

	if(!isset($action)) $action="";
	if(!isset($client)) $client="";
	if(!isset($page)) $page=0;
	if(!isset($classement)) $classement="";

?>

<?php
	if($action == "annuler"){
	
		$tempcmd = new Commande();
		$tempcmd->charger($id);
		
		$tempcmd->statut = "5";
		$tempcmd->maj();


   		$venteprod = new Venteprod();
   		$query = "select * from $venteprod->table where commande='" . $id . "'";
   		$resul = mysql_query($query, $venteprod->link);

		while($row = mysql_fetch_object($resul)){
			// incrémentation du stock général
    		$produit = new Produit();   
			$produit->charger($row->ref);
			$produit->stock = $produit->stock + $row->quantite;
    		$produit->maj();

			$vdec = new Ventedeclidisp();
			
			$query2 = "select * from $vdec->table where venteprod='" . $row->id . "'";
			$resul2 = mysql_query($query2, $vdec->link);
			
			
			while($row2 = mysql_fetch_object($resul2)){
				$stock = new Stock();
				if($stock->charger($row2->declidisp, $produit->id)){
					$stock->valeur = $stock->valeur + $row->quantite;
					$stock->maj();					
				}
				
				
			}
			
		}

		modules_fonction("statut", $tempcmd);
		
	}
	
	if($action == "supprimer"){
    
		$tempcmd = new Commande();
		$tempcmd->charger($id);
                    
		$adresse = new Venteadr();
		$adresse->charger($tempcmd->adrlivr);
		$adresse->delete();
		$adresse->charger($tempcmd->adrfact);
		$adresse->delete();
    
		$tempcmd->supprimer();
        
			if(file_exists("../client/commande/commande-" . $tempcmd->ref . ".pdf")) unlink("../client/commande/commande-" . $tempcmd->ref . ".pdf");    
	}
	
?>

<?php
	if(isset($voir_annule)) {
  		$search="and statut=5";
		$cmd_action="supprimer";
	}
  	else {
		if(isset($voir_envoye))
  			$search="and statut=4";	
		else
			$search="and statut not in (5,4)"; 
		$cmd_action="annuler";
	}
			
  	if($client != "") $search .= " and client=\"$client\"";
  	$commande = new Commande();
  	if($page=="") $page=1;
  		 
   	$query = "select * from $commande->table where 1 $search";
  	$resul = mysql_query($query, $commande->link);
  	$num = mysql_num_rows($resul);
  	
  	$nbpage = ceil($num/50);// Modifié par toi Nico: 50 à la place de 20 pour avoir 50 clients affichés par page. (30 à l'origine )
  	
  	$debut = ($page-1) * 50;// Modifié par toi Nico: 50 à la place de 20 pour avoir 50 clients affichés par page. (30 à l'origine )
  	
  	if($page>1) $pageprec=$page-1;
  	else $pageprec=$page;

  	if($page<$nbpage) $pagesuiv=$page+1;
  	else $pagesuiv=$page;
  	 
  	if($classement == "client") $ordclassement = "order by client";  	
  	else if($classement == "statut") $ordclassement = "order by statut";
  	else $ordclassement = "order by date desc";

?>

<script type="text/JavaScript">

function annuler(id){
	if(confirm("Voulez-vous vraiment ANNULER cette commande ?")) location="commande.php?action=annuler&id=" + id;

}

function supprimer(id){
	if(confirm("Voulez-vous vraiment SUPPRIMER cette commande ?")) location="commande.php?action=supprimer&id=" + id;

}
</script>

<body>

<?php
	$menu="commande";
	include_once("entete.php");
?>

<div id="Contenu_int"> 
    <p align="left"><a href="accueil.php" class="lien04">Accueil </a><img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04">Gestion des commandes</a>              
    </p>
<!--
//Partie ajoutée par toi nico pour avoir les pages précédentes et suivantes en haut de page
//-->
<?php
	$lien_voir = "";
	
	if(isset($voir_annule) && $voir_annule != "")
		$lien_voir .= "&voir_annule=1";
	if(isset($voir_envoye) && $voir_envoye != "")
		$lien_voir .= "&voir_envoye=1";
?>	
	
   <p align="center"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($pageprec); ?><?php echo $lien_voir; ?>">Page pr&eacute;c&eacute;dente</a> |
     <?php for($i=0; $i<$nbpage; $i++){ ?>
    	 <?php if($page != $i+1){ ?>
  	  		 <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($i+1); ?>&classement=<?php echo($classement); ?><?php echo $lien_voir; ?>"><?php echo($i+1); ?></a> |
    	 <?php } else {?>
    		 <?php echo($i+1); ?>
    		 <span>|</span>
   		  <?php } ?>
     <?php } ?>
                   
     <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($pagesuiv); ?><?php echo $lien_voir; ?>">Page suivante</a></p>
	 
<!--
//Fin de l'ajout
//-->	 

   <table width="710" border="0" cellpadding="5" cellspacing="0">
     <tr>
       <td width="450" height="30" class="titre_cellule_tres_sombre"><a href="commande.php" style="color:#fff;">LISTE DES COMMANDES</a></td>
       <td width="450" height="30" class="titre_cellule_tres_sombre"><a href="commande.php?voir_annule=1" style="color:#fff;">Commandes annul&Eacute;es</a></td>
       <td width="450" height="30" class="titre_cellule_tres_sombre"><a href="commande.php?voir_envoye=1" style="color:#fff;">Commandes envoyées</a></td>
     </tr>
   </table>
   <table width="978" border="0" cellpadding="5" cellspacing="0">
     <tr>
       <td width="130" height="30" class="titre_cellule">N&deg; DE COMMANDE </td>
       <td width="120" class="titre_cellule"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($page); ?>&classement=date" style="color:#fff;">DATE &amp; HEURE</a> </td>
       <td width="152" class="titre_cellule"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($page); ?>&classement=client" style="color:#fff;">NOM &amp; PR&Eacute;NOM</a></td>
       <!--<td width="140" class="titre_cellule">SOCI&Eacute;T&Eacute;</td>//-->
       <td width="80" class="titre_cellule">MONTANT</td>
       <td width="85" class="titre_cellule"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($page); ?>&classement=statut" style="color:#fff;">STATUT</a></td>
       <td width="80" class="titre_cellule">EXP&Eacute;DITION</td>
	   <td width="80" class="titre_cellule">D&Eacute;TAILS</td>
       <td width="80" class="titre_cellule">SUPPRIMER / ANNULER</td>
	   
     </tr>

  <?php
  	$i=0;
  	
    $query = "select * from $commande->table where 1 $search $ordclassement limit $debut,50";// Modifié par toi Nico: 50 à la place de 20 pour avoir 50 clients affichés par page. (30 à l'origine )
  	$resul = mysql_query($query, $commande->link);

  	$venteprod = new Venteprod();
  	
  	while($row = mysql_fetch_object($resul)){
  	
  		$client = new Client();
  		$client->charger_id($row->client);
  		
  		$statutdesc = new Statutdesc();
  		$statutdesc->charger($row->statut);
  		
  		$query2 = "SELECT sum(prixu*quantite) as total FROM $venteprod->table where commande='$row->id'"; 
  		$resul2 = mysql_query($query2, $venteprod->link);
  		$total = round(mysql_result($resul2, 0, "total"), 2);

		$port = $row->port;
		$total -= $row->remise;
		$total += $port;
		
  		$jour = substr($row->date, 8, 2);
  		$mois = substr($row->date, 5, 2);
  		$annee = substr($row->date, 2, 2);
  		
  		$heure = substr($row->date, 11, 2);
  		$minute = substr($row->date, 14, 2);
  		$seconde = substr($row->date, 17, 2);
  		 
		$mod = new Modules();
		$mod->charger_id($row->paiement);
		$moddesc = new ModulesDesc($mod->nom);

  		if(!($i%2)) $fond="cellule_sombre";
  		else $fond="cellule_claire";

  		$i++;
  ?>
  
     <tr>
       <td height="30" class="<?php echo($fond); ?>"><?php echo($row->ref); ?></td>
       <td class="<?php echo($fond); ?>"><?php echo($jour . "/" . $mois . "/" . $annee . " " . $heure . ":" . $minute . ":" . $seconde); ?></td>
       <td class="<?php echo($fond); ?>"><a href="client_visualiser.php?ref=<?php echo($client->ref); ?>"><?php echo($client->nom . " " . $client->prenom); ?></a></td>
       <!--<td class="<?php echo($fond); ?>"><a href="#"><?php echo($client->entreprise); ?></a></td>//-->
	   <!--<td class="<//?php echo($fond); ?>"><//?php echo(round($total, 2)); ?></td>
	   remplacée par toi Nico par la ligne de dessous pour avoir le total avec deux chiffres après la virgule//-->
	   <td class="<?php echo($fond); ?>"><?php echo(number_format($total, 2)); ?></td>
       <td class="<?php echo($fond); ?>"><?php echo($statutdesc->titre); ?><br /><?php echo $moddesc->titre; ?></td>
       <td class="<?php echo($fond); ?>"><?php echo("<a href='http://www.coliposte.net/gp/services/main.jsp?m=10003005&colispart=".$row->colis."' style='color:#666666' target='_blank'>".$row->colis."</a>"); ?></td>
	   <td class="<?php echo($fond); ?>"><a href="commande_details.php?ref=<?php echo($row->ref); ?>">&Eacute;diter </a> <a href="commande_details.php?ref=<?php echo($row->ref); ?>"><img src="gfx/suivant.gif" width="12" height="9" border="0" /></a></td>
       <td class="<?php echo($fond); ?>_vide"><div align="center"><a href="#" onclick="<?php echo($cmd_action); ?>('<?php echo($row->id); ?>')"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></div></td>
	   
	   
     </tr>

<?php
	}
?>
<?php
	$lien_voir = "";
	
	if(isset($voir_annule) && $voir_annule != "")
		$lien_voir .= "&voir_annule=1";
	if(isset($voir_envoye) && $voir_envoye != "")
		$lien_voir .= "&voir_envoye=1";
?>
  </table>
   <p align="center"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($pageprec); ?><?php echo $lien_voir; ?>">Page pr&eacute;c&eacute;dente</a> |
     <?php for($i=0; $i<$nbpage; $i++){ ?>
    	 <?php if($page != $i+1){ ?>
  	  		 <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($i+1); ?>&classement=<?php echo($classement); ?><?php echo $lien_voir; ?>"><?php echo($i+1); ?></a> |
    	 <?php } else {?>
    		 <?php echo($i+1); ?>
    		 <span>|</span>
   		  <?php } ?>
     <?php } ?>
                   
     <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($pagesuiv); ?><?php echo $lien_voir; ?>">Page suivante</a></p>
</div> 
<?php include_once("pied.php");?>
</body>
</html>

Offline


Salut!

Bon, j'ai réussi à afficher le titre du paiement, j'ai fait comme ça:

                $mod = new Modules();
		$mod->charger_id($row->paiement);
		$moddesc = new Modulesdesc();
		$moddesc->charger($mod->nom);
                
                echo $moddesc->titre;

T'en penses quoi Roadster, tu y vois quelque chose à modifier, à optimiser ?

Last edited by solakin (11-08-2015 14:08:57)

Offline


Si ça marche, youpi.


OpenStudio Toulouse

Offline


Ouais, t'as raison, youpi !
C'est fou comme parfois un tout petit truc peut prendre la tête, merci pour ta disponibilité et à plus !

Je place ici le contenu du fichier commande.php avec la modif qui fonctionne et qui permet donc d'afficher le titre du paiement utilisé par le client pour la version 1.4.2.1 de Thelia si jamais ça peut aider quelqu'un:

<?php
/*************************************************************************************/
/*                                                                                   */
/*      Thelia	                                                            		 */
/*                                                                                   */
/*      Copyright (c) Octolys Development		                                     */
/*		email : thelia@octolys.fr		        	                             	 */
/*      web : http://www.octolys.fr						   							 */
/*                                                                                   */
/*      This program is free software; you can redistribute it and/or modify         */
/*      it under the terms of the GNU General Public License as published by         */
/*      the Free Software Foundation; either version 2 of the License, or            */
/*      (at your option) any later version.                                          */
/*                                                                                   */
/*      This program is distributed in the hope that it will be useful,              */
/*      but WITHOUT ANY WARRANTY; without even the implied warranty of               */
/*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                */
/*      GNU General Public License for more details.                                 */
/*                                                                                   */
/*      You should have received a copy of the GNU General Public License            */
/*      along with this program; if not, write to the Free Software                  */
/*      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    */
/*                                                                                   */
/*************************************************************************************/
?>
<?php
	include_once("pre.php");
	include_once("auth.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php include_once("title.php"); ?>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<div id="Wrapper">
<div id="Subwrapper">
<?php

	include_once("../classes/Commande.class.php");
	include_once("../classes/Client.class.php");
	include_once("../classes/Venteprod.class.php");
	include_once("../classes/Ventedeclidisp.class.php");
	include_once("../classes/Venteadr.class.php");
	include_once("../classes/Stock.class.php");
	include_once("../classes/Statutdesc.class.php");
	include_once("../classes/Modules.class.php");
	include_once("../classes/Modulesdesc.class.php");
	include_once("../fonctions/divers.php");

	if(!isset($action)) $action="";
	if(!isset($client)) $client="";
	if(!isset($page)) $page=0;
	if(!isset($classement)) $classement="";

?>

<?php
	if($action == "annuler"){
	
		$tempcmd = new Commande();
		$tempcmd->charger($id);
		
		$tempcmd->statut = "5";
		$tempcmd->maj();


   		$venteprod = new Venteprod();
   		$query = "select * from $venteprod->table where commande='" . $id . "'";
   		$resul = mysql_query($query, $venteprod->link);

		while($row = mysql_fetch_object($resul)){
			// incrémentation du stock général
    		$produit = new Produit();   
			$produit->charger($row->ref);
			$produit->stock = $produit->stock + $row->quantite;
    		$produit->maj();

			$vdec = new Ventedeclidisp();
			
			$query2 = "select * from $vdec->table where venteprod='" . $row->id . "'";
			$resul2 = mysql_query($query2, $vdec->link);
			
			
			while($row2 = mysql_fetch_object($resul2)){
				$stock = new Stock();
				if($stock->charger($row2->declidisp, $produit->id)){
					$stock->valeur = $stock->valeur + $row->quantite;
					$stock->maj();					
				}
				
				
			}
			
		}

		modules_fonction("statut", $tempcmd);
		
	}
	
	if($action == "supprimer"){
    
		$tempcmd = new Commande();
		$tempcmd->charger($id);
                    
		$adresse = new Venteadr();
		$adresse->charger($tempcmd->adrlivr);
		$adresse->delete();
		$adresse->charger($tempcmd->adrfact);
		$adresse->delete();
    
		$tempcmd->supprimer();
        
			if(file_exists("../client/commande/commande-" . $tempcmd->ref . ".pdf")) unlink("../client/commande/commande-" . $tempcmd->ref . ".pdf");    
	}
	
?>

<?php
	if(isset($voir_annule)) {
  		$search="and statut=5";
		$cmd_action="supprimer";
	}
  	else {
		if(isset($voir_envoye))
  			$search="and statut=4";	
		else
			$search="and statut not in (5,4)"; 
		$cmd_action="annuler";
	}
			
  	if($client != "") $search .= " and client=\"$client\"";
  	$commande = new Commande();
  	if($page=="") $page=1;
  		 
   	$query = "select * from $commande->table where 1 $search";
  	$resul = mysql_query($query, $commande->link);
  	$num = mysql_num_rows($resul);
  	
  	$nbpage = ceil($num/30);
  	
  	$debut = ($page-1) * 30;
  	
  	if($page>1) $pageprec=$page-1;
  	else $pageprec=$page;

  	if($page<$nbpage) $pagesuiv=$page+1;
  	else $pagesuiv=$page;
  	 
  	if($classement == "client") $ordclassement = "order by client";  	
  	else if($classement == "statut") $ordclassement = "order by statut";
  	else $ordclassement = "order by date desc";

?>

<script type="text/JavaScript">

function annuler(id){
	if(confirm("Voulez-vous vraiment ANNULER cette commande ?")) location="commande.php?action=annuler&id=" + id;

}

function supprimer(id){
	if(confirm("Voulez-vous vraiment SUPPRIMER cette commande ?")) location="commande.php?action=supprimer&id=" + id;

}
</script>

<body>

<?php
	$menu="commande";
	include_once("entete.php");
?>

<div id="Contenu_int"> 
    <p align="left"><a href="accueil.php" class="lien04">Accueil </a><img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04">Gestion des commandes</a>              
    </p>

   <table width="710" border="0" cellpadding="5" cellspacing="0">
     <tr>
       <td width="450" height="30" class="titre_cellule_tres_sombre"><a href="commande.php" style="color:#fff;">LISTE DES COMMANDES</a></td>
       <td width="450" height="30" class="titre_cellule_tres_sombre"><a href="commande.php?voir_annule=1" style="color:#fff;">Commandes annul&Eacute;es</a></td>
       <td width="450" height="30" class="titre_cellule_tres_sombre"><a href="commande.php?voir_envoye=1" style="color:#fff;">Commandes envoyées</a></td>
     </tr>
   </table>
   <table width="978" border="0" cellpadding="5" cellspacing="0">
     <tr>
       <td width="130" height="30" class="titre_cellule">N&deg; DE COMMANDE </td>
       <td width="120" class="titre_cellule"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($page); ?>&classement=date" style="color:#fff;">DATE &amp; HEURE</a> </td>
       <td width="152" class="titre_cellule"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($page); ?>&classement=client" style="color:#fff;">NOM &amp; PR&Eacute;NOM</a></td>
       <!--<td width="140" class="titre_cellule">SOCI&Eacute;T&Eacute;</td>//-->
       <td width="80" class="titre_cellule">MONTANT</td>
       <td width="85" class="titre_cellule"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($page); ?>&classement=statut" style="color:#fff;">STATUT</a></td>
       <td width="80" class="titre_cellule">EXP&Eacute;DITION</td>
	   <td width="80" class="titre_cellule">D&Eacute;TAILS</td>
       <td width="80" class="titre_cellule">SUPPRIMER / ANNULER</td>
	   
     </tr>

  <?php
  	$i=0;
  	
    $query = "select * from $commande->table where 1 $search $ordclassement limit $debut,20";

  	$resul = mysql_query($query, $commande->link);

  	$venteprod = new Venteprod();
  	
  	while($row = mysql_fetch_object($resul)){
  	
  		$client = new Client();
  		$client->charger_id($row->client);
  		
  		$statutdesc = new Statutdesc();
  		$statutdesc->charger($row->statut);
  		
  		$query2 = "SELECT sum(prixu*quantite) as total FROM $venteprod->table where commande='$row->id'"; 
  		$resul2 = mysql_query($query2, $venteprod->link);
  		$total = round(mysql_result($resul2, 0, "total"), 2);

		$port = $row->port;
		$total -= $row->remise;
		$total += $port;
		
  		$jour = substr($row->date, 8, 2);
  		$mois = substr($row->date, 5, 2);
  		$annee = substr($row->date, 2, 2);
  		
  		$heure = substr($row->date, 11, 2);
  		$minute = substr($row->date, 14, 2);
  		$seconde = substr($row->date, 17, 2);
  		 
		$mod = new Modules();
		$mod->charger_id($row->paiement);
		$moddesc = new Modulesdesc();
		$moddesc->charger($mod->nom);

  		if(!($i%2)) $fond="cellule_sombre";
  		else $fond="cellule_claire";

  		$i++;
  ?>
  
     <tr>
       <td height="30" class="<?php echo($fond); ?>"><?php echo($row->ref); ?></td>
       <td class="<?php echo($fond); ?>"><?php echo($jour . "/" . $mois . "/" . $annee . " " . $heure . ":" . $minute . ":" . $seconde); ?></td>
       <td class="<?php echo($fond); ?>"><a href="client_visualiser.php?ref=<?php echo($client->ref); ?>"><?php echo($client->nom . " " . $client->prenom); ?></a></td>
       <td class="<?php echo($fond); ?>"><a href="#"><?php echo($client->entreprise); ?></a></td>
       <td class="<//?php echo($fond); ?>"><//?php echo(round($total, 2)); ?><br /><?php echo ($moddesc->titre); ?></td>
       <td class="<?php echo($fond); ?>"><?php echo($statutdesc->titre); ?></td>
       <td class="<?php echo($fond); ?>"><?php echo("<a href='http://www.coliposte.net/gp/services/main.jsp?m=10003005&colispart=".$row->colis."' style='color:#666666' target='_blank'>".$row->colis."</a>"); ?></td>
	   <td class="<?php echo($fond); ?>"><a href="commande_details.php?ref=<?php echo($row->ref); ?>">&Eacute;diter </a> <a href="commande_details.php?ref=<?php echo($row->ref); ?>"><img src="gfx/suivant.gif" width="12" height="9" border="0" /></a></td>
       <td class="<?php echo($fond); ?>_vide"><div align="center"><a href="#" onclick="<?php echo($cmd_action); ?>('<?php echo($row->id); ?>')"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></div></td>
	   
	   
     </tr>

<?php
	}
?>
<?php
	$lien_voir = "";
	
	if(isset($voir_annule) && $voir_annule != "")
		$lien_voir .= "&voir_annule=1";
	if(isset($voir_envoye) && $voir_envoye != "")
		$lien_voir .= "&voir_envoye=1";
?>
  </table>
   <p align="center"><a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($pageprec); ?><?php echo $lien_voir; ?>">Page pr&eacute;c&eacute;dente</a> |
     <?php for($i=0; $i<$nbpage; $i++){ ?>
    	 <?php if($page != $i+1){ ?>
  	  		 <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($i+1); ?>&classement=<?php echo($classement); ?><?php echo $lien_voir; ?>"><?php echo($i+1); ?></a> |
    	 <?php } else {?>
    		 <?php echo($i+1); ?>
    		 <span>|</span>
   		  <?php } ?>
     <?php } ?>
                   
     <a href="<?php echo($_SERVER['PHP_SELF']); ?>?page=<?php echo($pagesuiv); ?><?php echo $lien_voir; ?>">Page suivante</a></p>
</div> 
<?php include_once("pied.php");?>
</body>
</html>

Last edited by solakin (11-08-2015 16:03:14)