From d8af677bae56285d49e7f6a59f0c8328f97f8815 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 6 Apr 2005 09:54:11 +0000 Subject: [PATCH] Ajout gestion des batch de facturation --- .../telephonie/script/facturation-calcul.php | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/telephonie/script/facturation-calcul.php b/htdocs/telephonie/script/facturation-calcul.php index e5a3ec57e83..3dc372dfda7 100644 --- a/htdocs/telephonie/script/facturation-calcul.php +++ b/htdocs/telephonie/script/facturation-calcul.php @@ -105,6 +105,27 @@ 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); +} /** * @@ -215,10 +236,10 @@ if (!$error) } $sql = "INSERT INTO llx_telephonie_facture"; - $sql .= " (fk_ligne, ligne, date, isfacturable)"; + $sql .= " (fk_ligne, ligne, date, isfacturable, fk_batch)"; $sql .= " VALUES (".$ligne->id.","; $sql .= " '$ligne->numero','".$year."-".$month."-01'"; - $sql .= ", '$facturable')"; + $sql .= ", '$facturable',".$batch_id.")"; if ($db->query($sql)) {