garancia/L4/commandesTEST.php

53 lines
1.5 KiB
PHP

<?php
$conn = mysql_connect('localhost', 'garancia_prod', 'yoeLB4Znn1E1');
mysql_select_db('garancia_prod');
$dateAnnneMois=date('Ymd');
$dayNOW=date('Y-m-d');
// $dayPRECEDENT=date('Y-m-d', strtotime("-1 day"));
$dayNOW_INF=date('Y-m-d', strtotime("-1 day"))." 12:00:00";
$dayNOW_SUP=date('Y-m-d')." 5:00:00";
$sql = "SELECT o.*,c.name as carrier_name
from ps_orders o
left join ps_carrier c on (o.id_carrier=c.id_carrier)
where id_order=821 ";
$res = mysql_query($sql, $conn);
$results=array();
$i=0;
while($row = mysql_fetch_array($res)){
$sql='SELECT * from ps_order_history oh where id_order=821 order by id_order_history desc limit 0,1';
$result = mysql_query($sql, $conn);
$id_order_state = mysql_fetch_array($result);
if($id_order_state['id_order_state']==13 || $id_order_state['id_order_state']==12 || $id_order_state['id_order_state']==2){
$results[]=$row;
$i++;
}
}
$i=0;
include(dirname(__FILE__) .'/../config/config.inc.php');
// print_r($results);
foreach($results as $row){
$IDORDER=$row['id_order'];
$history = new OrderHistory();
$history->id_order = $IDORDER;
$history->id_employee = 3;
$use_existings_payment = false;
$order = new Order($IDORDER);
// $current_order_state = $order->getCurrentOrderState();
// echo "test";
$current_order_state=$order->current_state;
if($current_order_state!=3){
$history->changeIdOrderState2(3, $IDORDER, $use_existings_payment);
if ($history->addWithemail(true, $templateVars)){}
}
}