extranet/www/pages/ajax/greffescmd_courrier.php

36 lines
850 B
PHP
Raw Normal View History

<?php
$output = '';
//Enregistrement du changement d'état
if($_REQUEST['changeEtat'])
{
require_once 'dbbootstrap.php';
setDbConn('sdv1');
list($id, $statut) = explode('-', $_REQUEST['changeEtat']);
$q = Doctrine_Query::create()
->update('Commandes')
->set('statutCommande', $statut)
->where('idCommande = ?', $id)
->andWhere('typeCommande = ?', 'C');
$rows = $q->execute();
if(count($rows)>0)
{
//Liste des statuts
$q = Doctrine_Query::create()
->from('CommandesStatut')
->where('typeCommande = ?', 'C')
->andWhere('ordre = ?', $statut);
$statut = $q->fetchOne();
$output = '<font color="red">'.$statut->libStatut.'</font>';
if($statut->ordre==3)
{
$output.=
'<br/><a href="./pages_saisie/gencourrier.php?id='.
$id.'" target="_blank">'.
'Générer le courrier</a>';
}
}
}
echo $output;