cosmetique

This commit is contained in:
Sebastien BEAUGRAND 2010-03-25 14:11:49 +00:00
parent 8185794b16
commit e6e0c084c2
3 changed files with 91 additions and 72 deletions

View File

@ -141,9 +141,14 @@ if (isset($matchmethods) == true && $matchmethods === true) {
} }
} }
// --------------------------------------------------------------------------- //
// Commandes
// --------------------------------------------------------------------------- //
if (isset($checkCommandes) == true && $checkCommandes === true) { if (isset($checkCommandes) == true && $checkCommandes === true) {
$q = Doctrine_Query::create()->select('*')->from('Commandes'); $tabCommandes = Doctrine_Query::create()
$tabCommandes = $q->execute(); ->select('*')
->from('Commandes')
->execute();
foreach ($tabCommandes as $commande) { foreach ($tabCommandes as $commande) {
if ($commande->servicespeed == 'Immediate' || if ($commande->servicespeed == 'Immediate' ||
$commande->reference == '') { $commande->reference == '') {
@ -175,21 +180,21 @@ if (isset($checkCommandes) == true && $checkCommandes === true) {
$checkOrderResult->CheckOrders->OrderStatus[0]->OrderState; $checkOrderResult->CheckOrders->OrderStatus[0]->OrderState;
print 'orderstate ==> '.$orderstate."\n"; print 'orderstate ==> '.$orderstate."\n";
if ($orderstate != $commande->orderstate) { if ($orderstate != $commande->orderstate) {
$q = Doctrine_Query::create() Doctrine_Query::create()
->update('Commandes') ->update('Commandes')
->set('orderstate', '?', $orderstate) ->set('orderstate', '?', $orderstate)
->where('reference = ?', array($commande->reference)); ->where('reference = ?', array($commande->reference))
$q->execute(); ->execute();
} }
if (isset($checkOrderResult->CheckOrders->OrderStatus[0]->DateDue)) { if (isset($checkOrderResult->CheckOrders->OrderStatus[0]->DateDue)) {
$datedue = $datedue =
$checkOrderResult->CheckOrders->OrderStatus[0]->DateDue; $checkOrderResult->CheckOrders->OrderStatus[0]->DateDue;
if ($datedue != $commande->datedue) { if ($datedue != $commande->datedue) {
$q = Doctrine_Query::create() Doctrine_Query::create()
->update('Commandes') ->update('Commandes')
->set('datedue', '?', $datedue) ->set('datedue', '?', $datedue)
->where('reference = ?', array($commande->reference)); ->where('reference = ?', array($commande->reference))
$q->execute(); ->execute();
} }
} }
if ($orderstate != 'Completed' && if ($orderstate != 'Completed' &&
@ -206,9 +211,9 @@ if (isset($checkCommandes) == true && $checkCommandes === true) {
case 'Delivered': case 'Delivered':
// On verifie qu'on ne l'a pas deja // On verifie qu'on ne l'a pas deja
$q = Doctrine_Query::create() $q = Doctrine_Query::create()
->from('Report') ->from('Report')
->where('order_id = ?', $commande->id) ->where('order_id = ?', $commande->id)
->fetchOne(); ->fetchOne();
if ($q != false) { if ($q != false) {
print "rapport déjà enregistré\n"; print "rapport déjà enregistré\n";
continue; continue;
@ -243,7 +248,7 @@ if (isset($checkCommandes) == true && $checkCommandes === true) {
$detail = Doctrine_Query::create() $detail = Doctrine_Query::create()
->from('CommandesDetail') ->from('CommandesDetail')
->where('commandes_id = ?', $commande->id) ->where('commandes_id = ?', $commande->id)
->fetchOne(); ->fetchOne();
$report->name = $detail->eName; $report->name = $detail->eName;
$report->identifier = $detail->eIdentifiers; $report->identifier = $detail->eIdentifiers;
switch($mime_type) { switch($mime_type) {
@ -269,12 +274,13 @@ if (isset($checkCommandes) == true && $checkCommandes === true) {
$report->updated_at = $report->created_at; $report->updated_at = $report->created_at;
$report->order_id = $commande->id; $report->order_id = $commande->id;
$report->save(); $report->save();
$q = Doctrine_Query::create() Doctrine_Query::create()
->update('Commandes') ->update('Commandes')
->set('datecompleted', '?', ->set('datecompleted', '?',
$checkOrderResult->Service_Log->ResponseTimestamp->Date) $checkOrderResult->Service_Log
->where('reference = ?', array($commande->reference)); ->ResponseTimestamp->Date)
$q->execute(); ->where('reference = ?', array($commande->reference))
->execute();
print $mime_type." enregistré\n"; print $mime_type." enregistré\n";
} }
break; break;
@ -283,4 +289,4 @@ if (isset($checkCommandes) == true && $checkCommandes === true) {
} }
} }
} }
?> ?>

View File

@ -23,7 +23,7 @@ function dRow($lib, $data, $title = '')
?> ?>
<div id="center"> <div id="center">
<h1 class="titre">IDENTIT&Eacute; DE L'ENTREPRISE</h1> <h1 class="titre">IDENTIT&Eacute; DE L&apos;ENTREPRISE</h1>
<table> <table>

View File

@ -1,4 +1,7 @@
<?php <?php
// --------------------------------------------------------------------------- //
// international_commandes.php
// --------------------------------------------------------------------------- //
if (!$_SESSION['connected']) { if (!$_SESSION['connected']) {
die(); die();
} }
@ -8,10 +11,18 @@ if (isset($_POST['action']) == true) {
} else { } else {
$action = ''; $action = '';
} }
if (isset($_POST['etat_enq']) == false) {
$etat_enq = 'Delivered';
} else {
$etat_enq = $_POST['etat_enq'];
}
require_once 'dbbootstrap.php'; require_once 'dbbootstrap.php';
setDbConn('graydon'); setDbConn('graydon');
// --------------------------------------------------------------------------- //
// Affichage du document
// --------------------------------------------------------------------------- //
if ($action == 'xml' || if ($action == 'xml' ||
$action == 'pdf' || $action == 'pdf' ||
$action == 'doc') { $action == 'doc') {
@ -20,22 +31,43 @@ if ($action == 'xml' ||
case 'pdf': header('Content-type: application/pdf'); break; case 'pdf': header('Content-type: application/pdf'); break;
case 'doc': header('Content-type: application/msword'); break; case 'doc': header('Content-type: application/msword'); break;
} }
$reports = Doctrine_Query::create() $report = Doctrine_Query::create()
->from('Report') ->from('Report')
->where('order_id = ?', $commande_id) ->where('order_id = ? and format = ?', array($commande_id, $action))
->execute(); ->fetchOne();
foreach ($reports as $report) { print $report->content;
if ($report->format == $action) {
print $report->content;
break;
}
}
exit; exit;
} }
if (isset($_POST['etat_enq']) == false) { ?>
$etat_enq = 'Delivered';
} else { <div id="center" style="width:625px">
$etat_enq = $_POST['etat_enq']; <h1>Commandes Internationales</h1>
<?php
// --------------------------------------------------------------------------- //
// Affichage du document HTML
// --------------------------------------------------------------------------- //
if ($action == 'html') {
$rapport = Doctrine_Query::create()
->from('Report')
->where('order_id = ? and format = "html"', $commande_id)
->fetchOne();
$contenu = preg_replace('/background: #FFFFFF;/', '', $rapport->content);
$contenu = preg_replace('@<script[^>]*?>.*?</script>@si', '', $contenu);
print $contenu;
print '</div>';
exit;
}
// --------------------------------------------------------------------------- //
// Suppression
// --------------------------------------------------------------------------- //
if ($action == 'Supprimer') {
Doctrine_Query::create()
->update('Commandes')
->set('orderstate', '?', 'Unlinked')
->where('id = ?', $commande_id)
->execute();
} }
$etatsEnq = array('Toutes' => 'Toutes', $etatsEnq = array('Toutes' => 'Toutes',
@ -44,43 +76,6 @@ $etatsEnq = array('Toutes' => 'Toutes',
'Completed' => 'Complet&eacute;es', 'Completed' => 'Complet&eacute;es',
'Delivered' => 'D&eacute;livr&eacute;es', 'Delivered' => 'D&eacute;livr&eacute;es',
'NonD' => 'Non d&eacute;livr&eacute;es'); 'NonD' => 'Non d&eacute;livr&eacute;es');
function ajouteOption(&$etatsEnq, $etat_enq, $index) {
print '<option value="'.$index.'"';
if ($etat_enq == $index) {
print ' selected';
}
print '>'.$etatsEnq[$index].'</option>';
}
?>
<div id="center" style="width:625px">
<h1>Commandes Internationales</h1>
<?php
if ($action == 'html') {
$reports = Doctrine_Query::create()
->from('Report')
->where('order_id = ?', $commande_id)
->execute();
foreach ($reports as $report) {
if ($report->format == 'html') {
$contenu = preg_replace('/background: #FFFFFF;/',
'', $report->content);
$contenu = preg_replace('@<script[^>]*?>.*?</script>@si',
'', $contenu);
print $contenu;
break;
}
}
} else {
if ($action == 'Supprimer') {
Doctrine_Query::create()
->update('Commandes')
->set('orderstate', '?', 'Unlinked')
->where('id = ?', $commande_id)
->execute();
}
?> ?>
<form method="post"> <form method="post">
@ -88,7 +83,11 @@ if ($action == 'html') {
<select name="etat_enq" onchange="this.form.submit();"> <select name="etat_enq" onchange="this.form.submit();">
<?php <?php
foreach ($etatsEnq as $index => $valeur) { foreach ($etatsEnq as $index => $valeur) {
ajouteOption($etatsEnq, $etat_enq, $index); print '<option value="'.$index.'"';
if ($etat_enq == $index) {
print ' selected';
}
print '>'.$etatsEnq[$index].'</option>';
} }
?> ?>
</select> </select>
@ -96,19 +95,31 @@ if ($action == 'html') {
<br/> <br/>
<?php <?php
// --------------------------------------------------------------------------- //
// tableDebut
// --------------------------------------------------------------------------- //
function tableDebut() { function tableDebut() {
print '<table>'; print '<table>';
} }
// --------------------------------------------------------------------------- //
// tableLigne
// --------------------------------------------------------------------------- //
function tableLigne($c1, $c2) { function tableLigne($c1, $c2) {
print '<tr><td>'.$c1.'</td><td>'.$c2.'</td></tr>'; print '<tr><td>'.$c1.'</td><td>'.$c2.'</td></tr>';
} }
// --------------------------------------------------------------------------- //
// tableFin
// --------------------------------------------------------------------------- //
function tableFin() { function tableFin() {
print '</table>'; print '</table>';
} }
function boutonPost($action, $nom, $valeur, $etat_enq) { // --------------------------------------------------------------------------- //
// boutonPost
// --------------------------------------------------------------------------- //
function boutonPost($action, $nom, $valeur, $etat_enq) {
if ($action == 'xml' || if ($action == 'xml' ||
$action == 'pdf' || $action == 'pdf' ||
$action == 'doc') { $action == 'doc') {
@ -126,6 +137,9 @@ function tableFin() {
'</form>'; '</form>';
} }
// --------------------------------------------------------------------------- //
// Affichage des commandes
// --------------------------------------------------------------------------- //
$tabCommandes = Doctrine_Query::create() $tabCommandes = Doctrine_Query::create()
->from('Commandes') ->from('Commandes')
->where('user = ?', $_SESSION['tabInfo']['login']) ->where('user = ?', $_SESSION['tabInfo']['login'])
@ -190,7 +204,6 @@ foreach ($tabCommandes as $commande) {
tableFin(); tableFin();
print '</td></table>'; print '</td></table>';
} }
}
?> ?>
</div> </div>