From 72bb91c8ee238bae42093d2c6457e68319fc0ed9 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 8 Dec 2005 10:48:45 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20r=E9siliation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../telephonie/script/presel_active_view.php | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/htdocs/telephonie/script/presel_active_view.php b/htdocs/telephonie/script/presel_active_view.php index fe68eae4b8e..ac9195ea5c0 100644 --- a/htdocs/telephonie/script/presel_active_view.php +++ b/htdocs/telephonie/script/presel_active_view.php @@ -23,11 +23,15 @@ */ require ("../../master.inc.php"); require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; +require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php"; $host = CMD_PRESEL_WEB_HOST; $user_login = CMD_PRESEL_WEB_USER; $user_passwd = CMD_PRESEL_WEB_PASS; +$user = new User($db); +$user->id = 1; + $ids = array(); if ($argv[1]) @@ -61,14 +65,14 @@ else } } -GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug); +GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug, $user); /* * Fonctions * */ -function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug) +function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug, $user) { $numcli = sizeof($ids); $i = 0; @@ -141,6 +145,41 @@ function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $deb print substr($ligne_presel.str_repeat(" ",20),0,20); print "\n"; } + + $situation_key = $ligne_service.' / '.$ligne_presel; + + if ($situation_key == 'TRAITE_OK / ATTENTE') + { + $ligne = new LigneTel($db); + + if ($ligne->fetch($ligne_numero) == 1) + { + if ($ligne->statut == 3) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande_retour"; + $sql .= " (cli,mode,date_traitement,situation,fk_fournisseur,traite)"; + $sql .= " VALUES ('$ligne_numero','PRESELECTION',now(),'$situation_key',4,1);"; + + $resql = $db->query($sql); + + $statut = 6; + $date_resiliation = time(); + $datea = $db->idate($date_resiliation); + + if ($ligne->set_statut($user, $statut, $datea,'',4) <> 0) + { + $error++; + print "ERROR\n"; + } + } + } + else + { + print "Erreur de lecture\n"; + } + } + + } if (preg_match("//",$line))