/[dolibarr]/dolibarr/htdocs/telephonie/script/presel_active_view.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/script/presel_active_view.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by rodolphe, Thu Dec 8 09:25:21 2005 UTC revision 1.6 by rodolphe, Thu Dec 8 10:48:45 2005 UTC
# Line 23  Line 23 
23   */   */
24  require ("../../master.inc.php");  require ("../../master.inc.php");
25  require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php";  require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php";
26    require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
27    
28  $host          = CMD_PRESEL_WEB_HOST;  $host          = CMD_PRESEL_WEB_HOST;
29  $user_login    = CMD_PRESEL_WEB_USER;  $user_login    = CMD_PRESEL_WEB_USER;
30  $user_passwd   = CMD_PRESEL_WEB_PASS;  $user_passwd   = CMD_PRESEL_WEB_PASS;
31    
32    $user = new User($db);
33    $user->id = 1;
34    
35  $ids = array();  $ids = array();
36    
37  if ($argv[1])  if ($argv[1])
# Line 61  else Line 65  else
65      }      }
66  }  }
67    
68  GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug);  GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug, $user);
69    
70  /*  /*
71   * Fonctions   * Fonctions
72   *   *
73   */   */
74    
75  function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug)  function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug, $user)
76  {    {  
77    $numcli = sizeof($ids);    $numcli = sizeof($ids);
78    $i = 0;    $i = 0;
# Line 141  function GetPreselection_byRef($db, $hos Line 145  function GetPreselection_byRef($db, $hos
145                        print substr($ligne_presel.str_repeat(" ",20),0,20);                        print substr($ligne_presel.str_repeat(" ",20),0,20);
146                        print "\n";                        print "\n";
147                      }                      }
148    
149                      $situation_key = $ligne_service.' / '.$ligne_presel;
150    
151                      if ($situation_key == 'TRAITE_OK / ATTENTE')
152                        {
153                          $ligne = new LigneTel($db);
154                          
155                          if ($ligne->fetch($ligne_numero) == 1)
156                            {
157                              if ($ligne->statut == 3)
158                                {
159                                  $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande_retour";
160                                  $sql .= " (cli,mode,date_traitement,situation,fk_fournisseur,traite)";
161                                  $sql .= " VALUES ('$ligne_numero','PRESELECTION',now(),'$situation_key',4,1);";
162                                  
163                                  $resql = $db->query($sql);
164    
165                                  $statut = 6;
166                                  $date_resiliation = time();
167                                  $datea = $db->idate($date_resiliation);
168    
169                                  if ($ligne->set_statut($user, $statut, $datea,'',4) <> 0)
170                                    {
171                                      $error++;
172                                      print "ERROR\n";
173                                    }
174                                }
175                            }
176                          else
177                            {
178                              print "Erreur de lecture\n";
179                            }
180                        }
181                      
182    
183                  }                  }
184    
185                if (preg_match("/<Error .* \/>/",$line))                if (preg_match("/<Error .* \/>/",$line))

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26