diff --git a/htdocs/telephonie/script/facturation-calcul.php b/htdocs/telephonie/script/facturation-calcul.php index 782972171c2..3e1e5154ad7 100644 --- a/htdocs/telephonie/script/facturation-calcul.php +++ b/htdocs/telephonie/script/facturation-calcul.php @@ -105,28 +105,6 @@ else dolibarr_syslog("Erreur ".$error); } -/********************************************************** -* -* Création d'un batch de facturation -* -***********************************************************/ - -$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_facturation_batch"; -$sql .= " (date_batch) VALUES (now())"; -$resql = $db->query($sql); - -if ( $resql ) -{ - $batch_id = $db->last_insert_id(MAIN_DB_PREFIX."telephonie_facturation_batch"); - - dolibarr_syslog("Batch ID ".$batch_id); -} -else -{ - $error = 20; - dolibarr_syslog("Erreur ".$error); -} - /** * * Lectures des différentes lignes dans la table d'import @@ -167,6 +145,34 @@ if (!$error) } } + + + +/********************************************************** +* +* Création d'un batch de facturation +* +***********************************************************/ + +if (sizeof($lines_keys) > 0) +{ + $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_facturation_batch"; + $sql .= " (date_batch) VALUES (now())"; + $resql = $db->query($sql); + + if ( $resql ) + { + $batch_id = $db->last_insert_id(MAIN_DB_PREFIX."telephonie_facturation_batch"); + + dolibarr_syslog("Batch ID ".$batch_id); + } + else + { + $error = 20; + dolibarr_syslog("Erreur ".$error); + } +} + /* ***************************************************** */ /* */ /* Traitements */