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

View File

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

View File

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