25 |
require ("../../master.inc.php"); |
require ("../../master.inc.php"); |
26 |
require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; |
require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; |
27 |
|
|
28 |
|
|
29 |
|
$verbose = 0; |
30 |
|
|
31 |
|
for ($i = 1 ; $i < sizeof($argv) ; $i++) |
32 |
|
{ |
33 |
|
if ($argv[$i] == "-v") |
34 |
|
{ |
35 |
|
$verbose = 1; |
36 |
|
} |
37 |
|
if ($argv[$i] == "-vv") |
38 |
|
{ |
39 |
|
$verbose = 2; |
40 |
|
} |
41 |
|
if ($argv[$i] == "-vvv") |
42 |
|
{ |
43 |
|
$verbose = 3; |
44 |
|
} |
45 |
|
} |
46 |
|
|
47 |
|
|
48 |
$user = new User($db); |
$user = new User($db); |
49 |
$user->id = 1; // C'est sale je sais ! |
$user->id = 1; // C'est sale je sais ! |
50 |
|
|
130 |
|
|
131 |
function CreatePreselection($host, $user_login, $user_passwd, $ligne, $id_person) |
function CreatePreselection($host, $user_login, $user_passwd, $ligne, $id_person) |
132 |
{ |
{ |
133 |
|
global $verbose; |
134 |
dolibarr_syslog("Appel de CreatePreselection($host, $user_login, ****, $ligne, $id_person)"); |
dolibarr_syslog("Appel de CreatePreselection($host, $user_login, ****, $ligne, $id_person)"); |
135 |
|
|
136 |
$url = "/AzurApp_websvc_b3gdb/account.asmx/CreatePreselection?"; |
$url = "/AzurApp_websvc_b3gdb/account.asmx/CreatePreselection?"; |
142 |
$url .= "&okCollecte=true"; |
$url .= "&okCollecte=true"; |
143 |
$url .= "&okPreselection=true"; |
$url .= "&okPreselection=true"; |
144 |
|
|
145 |
|
if ($verbose > 2) |
146 |
|
dolibarr_syslog("$url"); |
147 |
|
|
148 |
$fp = fsockopen($host, 80, $errno, $errstr, 30); |
$fp = fsockopen($host, 80, $errno, $errstr, 30); |
149 |
if (!$fp) |
if (!$fp) |
167 |
{ |
{ |
168 |
$line = fgets($fp, 1024); |
$line = fgets($fp, 1024); |
169 |
|
|
170 |
|
if ($verbose > 2) |
171 |
|
dolibarr_syslog($line); |
172 |
|
|
173 |
if ($parse == 1) |
if ($parse == 1) |
174 |
{ |
{ |
175 |
preg_match('/^<string xmlns=".*">(.*)<\/string>$/', $line, $results); |
preg_match('/^<string xmlns=".*">(.*)<\/string>$/', $line, $results); |
190 |
fclose($fp); |
fclose($fp); |
191 |
} |
} |
192 |
|
|
193 |
|
if ($verbose > 1) |
194 |
|
dolibarr_syslog("result = ".$result); |
195 |
|
|
196 |
if (substr($result,0,2) == "OK") |
if (substr($result,0,2) == "OK") |
197 |
{ |
{ |
198 |
dolibarr_syslog("Presel réussie ligne ".$ligne." id client ".$id_person." $result\n"); |
dolibarr_syslog("Presel réussie ligne ".$ligne." id client ".$id_person." $result\n"); |