Gestion de la copie d'une grille
This commit is contained in:
parent
52a62e010e
commit
d28dd39484
@ -51,10 +51,11 @@ class TelephonieTarifGrille {
|
|||||||
{
|
{
|
||||||
$this->db = $_DB;
|
$this->db = $_DB;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
function CreateGrille($user, $name, $type)
|
\brief Creation d'une nouvelle grille
|
||||||
|
*/
|
||||||
|
function CreateGrille($user, $name, $type, $copy=0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille";
|
||||||
$sql .= "(libelle, type_tarif)";
|
$sql .= "(libelle, type_tarif)";
|
||||||
$sql .= " VALUES ('".addslashes($name)."','".$type."');";
|
$sql .= " VALUES ('".addslashes($name)."','".$type."');";
|
||||||
@ -70,9 +71,44 @@ class TelephonieTarifGrille {
|
|||||||
dolibarr_syslog($this->db->error());
|
dolibarr_syslog($this->db->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($copy > 0 && $type == 'vente')
|
||||||
|
{
|
||||||
|
$this->CopieGrille($user,$copy);
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CopieGrille($user, $ori)
|
||||||
|
{
|
||||||
|
$sql = "SELECT fk_tarif,temporel,fixe FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant";
|
||||||
|
$sql .= " WHERE fk_tarif_desc= '".$ori."'";
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
while ($row = $this->db->fetch_row($resql) )
|
||||||
|
{
|
||||||
|
$tarifs[$i] = $row;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog($this->db->error());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach($tarifs as $tarif)
|
||||||
|
{
|
||||||
|
$this->_DBUpdateTarif($this->id, $tarif[0], $tarif[1], $tarif[2], $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function Perms($user, $perms, $user_grille)
|
function Perms($user, $perms, $user_grille)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user