if ($ret < 0) {
             $error++;
             setEventMessage($product->error, $product->errors, 'errors');
         } else {
             if ($price_expression !== '') {
                 //Check the expression validity by parsing it
                 $priceparser = new PriceParser($db);
                 $price_result = $priceparser->parseProductSupplier($id, $price_expression, $quantity, $tva_tx);
                 if ($price_result < 0) {
                     //Expression is not valid
                     $error++;
                     setEventMessage($priceparser->translatedError(), 'errors');
                 }
             }
             if (!$error && !empty($conf->dynamicprices->enabled)) {
                 $ret = $product->setPriceExpression($price_expression);
                 if ($ret < 0) {
                     $error++;
                     setEventMessage($product->error, 'errors');
                 }
             }
         }
     }
     if (!$error) {
         $db->commit();
         $action = '';
     } else {
         $db->rollback();
     }
 } else {
     $action = 'add_price';