Gestion du format de CDR associe
This commit is contained in:
parent
043f297579
commit
6c4a7435ac
@ -32,10 +32,11 @@ if ($_POST["action"] == 'add')
|
|||||||
{
|
{
|
||||||
$fourn = new FournisseurTelephonie($db);
|
$fourn = new FournisseurTelephonie($db);
|
||||||
|
|
||||||
$fourn->nom = $_POST["nom"];
|
$fourn->nom = $_POST["nom"];
|
||||||
$fourn->email_commande = $_POST["email_commande"];
|
$fourn->email_commande = $_POST["email_commande"];
|
||||||
$fourn->methode_commande = $_POST["methode"];
|
$fourn->methode_commande = $_POST["methode"];
|
||||||
$fourn->grille = $_POST["grille"];
|
$fourn->cdrformat = $_POST["cdrformat"];
|
||||||
|
$fourn->grille = $_POST["grille"];
|
||||||
|
|
||||||
if ( $fourn->create($user) == 0)
|
if ( $fourn->create($user) == 0)
|
||||||
{
|
{
|
||||||
@ -53,6 +54,7 @@ if ($_POST["action"] == 'update' && $_GET["id"])
|
|||||||
$fourn->num_client = $_POST["num_client"];
|
$fourn->num_client = $_POST["num_client"];
|
||||||
$fourn->email_commande = $_POST["email_commande"];
|
$fourn->email_commande = $_POST["email_commande"];
|
||||||
$fourn->methode_commande = $_POST["methode"];
|
$fourn->methode_commande = $_POST["methode"];
|
||||||
|
$fourn->cdrformat = $_POST["cdrformat"];
|
||||||
$fourn->commande_bloque = $_POST["commande_bloque"];
|
$fourn->commande_bloque = $_POST["commande_bloque"];
|
||||||
$fourn->grille = $_POST["grille"];
|
$fourn->grille = $_POST["grille"];
|
||||||
|
|
||||||
@ -116,6 +118,7 @@ if ($_GET["action"] == 'create')
|
|||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$arr = $fourn->array_methode();
|
$arr = $fourn->array_methode();
|
||||||
|
$cdr = $fourn->array_cdrformat();
|
||||||
|
|
||||||
print '<tr><td width="20%">Méthode de commande</td>';
|
print '<tr><td width="20%">Méthode de commande</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -123,6 +126,12 @@ if ($_GET["action"] == 'create')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>méthode utilisée pour les commandes de lignes</td></tr>';
|
print '<td>méthode utilisée pour les commandes de lignes</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Format de CDR</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $html->select_array("cdrformat",$cdr,$fourn->cdrformat);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>Format des fichiers CDR</td></tr>';
|
||||||
|
|
||||||
$ta->liste_name[0] = ' Creer une nouvelle grille';
|
$ta->liste_name[0] = ' Creer une nouvelle grille';
|
||||||
asort($ta->liste_name);
|
asort($ta->liste_name);
|
||||||
print '<tr><td width="20%">Grille de tarif</td>';
|
print '<tr><td width="20%">Grille de tarif</td>';
|
||||||
@ -175,6 +184,7 @@ if ($_GET["id"] > 0)
|
|||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$arr = $fourn->array_methode();
|
$arr = $fourn->array_methode();
|
||||||
|
$cdr = $fourn->array_cdrformat();
|
||||||
|
|
||||||
print '<tr><td width="20%">Méthode de commande</td>';
|
print '<tr><td width="20%">Méthode de commande</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -182,6 +192,12 @@ if ($_GET["id"] > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>méthode utilisée pour les commandes de lignes</td></tr>';
|
print '<td>méthode utilisée pour les commandes de lignes</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Format de CDR</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $html->select_array("cdrformat",$cdr,$fourn->cdrformat);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>Format des fichiers CDR</td></tr>';
|
||||||
|
|
||||||
print '<tr><td width="20%">Blocage des commandes</td>';
|
print '<tr><td width="20%">Blocage des commandes</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
@ -235,6 +251,10 @@ if ($_GET["id"] > 0)
|
|||||||
print '<td>'.$fourn->class_commande.'</td>';
|
print '<td>'.$fourn->class_commande.'</td>';
|
||||||
print '<td>méthode utilisée pour les commandes de lignes</td></tr>';
|
print '<td>méthode utilisée pour les commandes de lignes</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Format de CDR</td>';
|
||||||
|
print '<td>'.$fourn->cdrformat.'</td>';
|
||||||
|
print '<td>Format des fichiers CDR</td></tr>';
|
||||||
|
|
||||||
print '<tr><td width="20%">Blocage des commandes</td>';
|
print '<tr><td width="20%">Blocage des commandes</td>';
|
||||||
print '<td>'.$art[$fourn->commande_bloque].'</td>';
|
print '<td>'.$art[$fourn->commande_bloque].'</td>';
|
||||||
print '<td>Les commandes sont bloquées</td></tr>';
|
print '<td>Les commandes sont bloquées</td></tr>';
|
||||||
|
|||||||
@ -35,6 +35,7 @@ class FournisseurTelephonie {
|
|||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->classdir = DOL_DOCUMENT_ROOT.'/telephonie/fournisseur/commande/';
|
$this->classdir = DOL_DOCUMENT_ROOT.'/telephonie/fournisseur/commande/';
|
||||||
|
$this->cdrformatdir = DOL_DOCUMENT_ROOT.'/telephonie/fournisseur/cdrformat/';
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -59,8 +60,8 @@ class FournisseurTelephonie {
|
|||||||
if ($res == 0)
|
if ($res == 0)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_fournisseur";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_fournisseur";
|
||||||
$sql .= " (nom, email_commande, commande_active, class_commande,fk_tarif_grille)";
|
$sql .= " (nom, email_commande, commande_active, class_commande,fk_tarif_grille,cdrformat)";
|
||||||
$sql .= " VALUES ('".$this->nom."','".$this->email_commande."',1,'".$this->methode_commande."',".$this->grille.")";
|
$sql .= " VALUES ('".$this->nom."','".$this->email_commande."',1,'".$this->methode_commande."','".$this->grille."','".$this->cdrformat."');";
|
||||||
|
|
||||||
if (! $this->db->query($sql) )
|
if (! $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
@ -83,6 +84,7 @@ class FournisseurTelephonie {
|
|||||||
$sql .= ", num_client = '".$this->num_client."'";
|
$sql .= ", num_client = '".$this->num_client."'";
|
||||||
$sql .= ", class_commande = '".$this->methode_commande."'";
|
$sql .= ", class_commande = '".$this->methode_commande."'";
|
||||||
$sql .= ", commande_bloque = '".$this->commande_bloque."'";
|
$sql .= ", commande_bloque = '".$this->commande_bloque."'";
|
||||||
|
$sql .= ", cdrformat = '".$this->cdrformat."'";
|
||||||
|
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
@ -102,7 +104,7 @@ class FournisseurTelephonie {
|
|||||||
|
|
||||||
$sql = "SELECT f.rowid, f.nom, f.email_commande, f.commande_active";
|
$sql = "SELECT f.rowid, f.nom, f.email_commande, f.commande_active";
|
||||||
$sql .= ", f.class_commande, f.commande_bloque, f.fk_tarif_grille";
|
$sql .= ", f.class_commande, f.commande_bloque, f.fk_tarif_grille";
|
||||||
$sql .= ", f.num_client";
|
$sql .= ", f.num_client, f.cdrformat";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
|
||||||
$sql .= " WHERE f.rowid = ".$this->id;
|
$sql .= " WHERE f.rowid = ".$this->id;
|
||||||
|
|
||||||
@ -118,6 +120,7 @@ class FournisseurTelephonie {
|
|||||||
$this->commande_enable = $obj->commande_active;
|
$this->commande_enable = $obj->commande_active;
|
||||||
$this->class_commande = $obj->class_commande;
|
$this->class_commande = $obj->class_commande;
|
||||||
$this->commande_bloque = $obj->commande_bloque;
|
$this->commande_bloque = $obj->commande_bloque;
|
||||||
|
$this->cdrformat = $obj->cdrformat;
|
||||||
$this->grille = $obj->fk_tarif_grille;
|
$this->grille = $obj->fk_tarif_grille;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -169,7 +172,7 @@ class FournisseurTelephonie {
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Retourne la liste des classe de format de commande
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -177,16 +180,11 @@ class FournisseurTelephonie {
|
|||||||
function array_methode()
|
function array_methode()
|
||||||
{
|
{
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
$handle=opendir($this->classdir);
|
$handle=opendir($this->classdir);
|
||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
|
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
|
|
||||||
dolibarr_syslog($file);
|
|
||||||
|
|
||||||
if (is_readable($this->classdir.$file) && substr($file, 0, 8) == 'commande' && substr($file, -10) == '.class.php')
|
if (is_readable($this->classdir.$file) && substr($file, 0, 8) == 'commande' && substr($file, -10) == '.class.php')
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -207,6 +205,35 @@ class FournisseurTelephonie {
|
|||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Retourne la liste des classe de format de commande
|
||||||
|
*/
|
||||||
|
function array_cdrformat()
|
||||||
|
{
|
||||||
|
clearstatcache();
|
||||||
|
$handle=opendir($this->cdrformatdir);
|
||||||
|
$arr = array();
|
||||||
|
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
if (is_readable($this->cdrformatdir.$file) && substr($file, 0, 9) == 'cdrformat' && substr($file, -10) == '.class.php')
|
||||||
|
{
|
||||||
|
$name = substr($file, 10, strlen($file) -20);
|
||||||
|
$filebis = $this->classdir . $file;
|
||||||
|
|
||||||
|
// Chargement de la classe de numérotation
|
||||||
|
$classname = "CdrFormat".ucfirst($name);
|
||||||
|
|
||||||
|
require_once($this->cdrformatdir.$file);
|
||||||
|
|
||||||
|
$obj = new $classname($this->db);
|
||||||
|
|
||||||
|
$arr[$name] = $obj->nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Crée une commande pour ce fournisseur
|
* Crée une commande pour ce fournisseur
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user