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)){} } }