Synchro
This commit is contained in:
parent
d8d215754c
commit
859a8c33c1
@ -1,5 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -22,7 +22,6 @@
|
||||
|
||||
class LigneTel {
|
||||
var $db;
|
||||
|
||||
var $id;
|
||||
var $ligne;
|
||||
|
||||
@ -49,7 +48,6 @@ class LigneTel {
|
||||
*/
|
||||
function update($user)
|
||||
{
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne";
|
||||
$sql .= " SET ";
|
||||
$sql .= " ligne = '$this->numero', ";
|
||||
@ -217,8 +215,10 @@ class LigneTel {
|
||||
{
|
||||
return $this->fetch(0, $id);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch($ligne, $id = 0)
|
||||
{
|
||||
|
||||
@ -240,11 +240,13 @@ class LigneTel {
|
||||
$sql .= " WHERE tl.ligne = ".$ligne;
|
||||
}
|
||||
|
||||
if ($this->db->query($sql))
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object(0);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->socid = $obj->fk_soc;
|
||||
@ -284,7 +286,7 @@ class LigneTel {
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
$this->db->free();
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -652,12 +654,13 @@ class LigneTel {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture";
|
||||
$sql .= " WHERE fk_facture = ".$facnumber;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($this->db->query($sql))
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$row = $this->db->fetch_row(0);
|
||||
$row = $this->db->fetch_row($resql);
|
||||
|
||||
$this->id = $row[0];
|
||||
|
||||
@ -667,17 +670,12 @@ class LigneTel {
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -22,10 +22,11 @@
|
||||
* Génère un PDF de la première page de résumé et un tableur des communications
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_standard.modeles.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/xlsdetail_nodet.modules.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/facture.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_standard.modeles.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/xlsdetail_nodet.modules.php";
|
||||
|
||||
|
||||
class pdfdetail_nodet {
|
||||
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_standard.modeles.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/facture.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_standard.modeles.php";
|
||||
|
||||
class pdfdetail_standard {
|
||||
|
||||
@ -378,7 +378,7 @@ class pdfdetail_standard {
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$Y = $this->pdf->GetY();
|
||||
|
||||
@ -466,9 +466,9 @@ class pdfdetail_standard {
|
||||
*
|
||||
*/
|
||||
|
||||
$this->pdf->Close();
|
||||
|
||||
$this->pdf->Close();
|
||||
$this->pdf->Output($file);
|
||||
|
||||
$this->filename = $file;
|
||||
|
||||
dolibarr_syslog("Write $file");
|
||||
@ -478,12 +478,11 @@ class pdfdetail_standard {
|
||||
unlink($file_graph);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer.";
|
||||
$this->error="Erreur: répertoire '$dir' n'existe pas, créa impossible.";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,13 +33,12 @@ class xlsdetail_nodet {
|
||||
Function GenerateFile($ligne, $fac, $factel)
|
||||
{
|
||||
$this->ligne = $ligne;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$dir = FAC_OUTPUTDIR . "/" . $fac->ref . "/" ;
|
||||
$fname = $dir . $fac->ref . "-".$ligne->numero."-".$ligne->code_analytique."-detail.xls";
|
||||
|
||||
dolibarr_syslog("Open file : $fname");
|
||||
//dolibarr_syslog("Open file : $fname");
|
||||
|
||||
$workbook = &new writeexcel_workbook($fname);
|
||||
|
||||
@ -57,21 +56,20 @@ class xlsdetail_nodet {
|
||||
$fdest =& $workbook->addformat();
|
||||
$fdest->set_align('vcenter');
|
||||
|
||||
$page->set_column(0,0,12); // A
|
||||
$page->set_column(1,1,20); // B
|
||||
$page->set_column(2,2,15); // C
|
||||
|
||||
$page->set_column(0,0,12); // A
|
||||
$page->set_column(1,1,20); // B
|
||||
$page->set_column(2,2,15); // C
|
||||
$page->set_column(3,3,30); // D
|
||||
$page->set_column(6,6,7); // G
|
||||
$page->set_column(9,9,7); // J
|
||||
$page->set_column(6,6,7); // G
|
||||
$page->set_column(9,9,7); // J
|
||||
$page->set_column(12,12,7); // M
|
||||
|
||||
$page->write(0, 0, "Ligne", $format_titre_agence1);
|
||||
$page->write(0, 1, "Date", $format_titre);
|
||||
$page->write(0, 2, "Numero", $format_titre);
|
||||
$page->write(0, 3, "Destination", $format_titre);
|
||||
$page->write(0, 4, "Durée", $format_titre);
|
||||
$page->write(0, 5, "Cout HT", $format_titre);
|
||||
$page->write(0, 0, "Ligne", $format_titre_agence1);
|
||||
$page->write(0, 1, "Date", $format_titre);
|
||||
$page->write(0, 2, "Numero", $format_titre);
|
||||
$page->write(0, 3, "Destination", $format_titre);
|
||||
$page->write(0, 4, "Durée", $format_titre);
|
||||
$page->write(0, 5, "Cout HT", $format_titre);
|
||||
|
||||
$sql = "SELECT ligne, date, numero, dest, dureetext, duree, cout_vente";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
|
||||
@ -85,7 +83,7 @@ class xlsdetail_nodet {
|
||||
$i = 0;
|
||||
$numsql = $this->db->num_rows($resql);
|
||||
|
||||
dolibarr_syslog($this->ligne->numero . " : ".$numsql);
|
||||
//dolibarr_syslog($this->ligne->numero . " : ".$numsql);
|
||||
|
||||
while ($i < $numsql)
|
||||
{
|
||||
@ -99,7 +97,6 @@ class xlsdetail_nodet {
|
||||
$page->write_string($xx, 3, $obj->dest, $fdest);
|
||||
$page->write($xx, 4, $obj->duree, $fnb);
|
||||
$page->write($xx, 5, $obj->cout_vente, $fp);
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -111,10 +108,9 @@ class xlsdetail_nodet {
|
||||
}
|
||||
|
||||
$workbook->close();
|
||||
dolibarr_syslog("Close $fname");
|
||||
//dolibarr_syslog("Close $fname");
|
||||
|
||||
return $error;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
|
||||
class TelephonieContrat {
|
||||
var $db;
|
||||
|
||||
var $id;
|
||||
var $ligne;
|
||||
|
||||
@ -70,8 +69,7 @@ class TelephonieContrat {
|
||||
$this->db->query($sql);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error_message = "Echec de la création du contrat";
|
||||
@ -114,7 +112,6 @@ class TelephonieContrat {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne";
|
||||
@ -133,7 +130,6 @@ class TelephonieContrat {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -145,15 +141,13 @@ class TelephonieContrat {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
function fetch($id)
|
||||
{
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_client_comm, c.fk_soc, c.fk_soc_facture, c.note";
|
||||
$sql .= ", c.fk_commercial_sign, c.fk_commercial_suiv";
|
||||
$sql .= ", c.isfacturable, c.mode_paiement";
|
||||
@ -161,12 +155,13 @@ class TelephonieContrat {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($this->db->query($sql))
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object(0);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->socid = $obj->fk_soc;
|
||||
@ -197,7 +192,6 @@ class TelephonieContrat {
|
||||
$this->ref_url = '<a href="'.DOL_URL_ROOT.'/telephonie/contrat/fiche.php?id='.$this->id.'">'.$this->ref.'</a>';
|
||||
|
||||
|
||||
|
||||
$result = 1;
|
||||
}
|
||||
else
|
||||
@ -206,7 +200,7 @@ class TelephonieContrat {
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
$this->db->free();
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -218,7 +212,6 @@ class TelephonieContrat {
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
@ -296,7 +289,6 @@ class TelephonieContrat {
|
||||
*/
|
||||
function remove_service($user, $sid)
|
||||
{
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_contrat_service";
|
||||
$sql .= " (fk_contrat, fk_service, fk_user_creat, date_creat) ";
|
||||
$sql .= " VALUES ($this->id, $sid, $user->id, now() )";
|
||||
@ -306,12 +298,10 @@ class TelephonieContrat {
|
||||
return 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
function get_contact_facture()
|
||||
{
|
||||
$this->contact_facture_id = array();
|
||||
@ -348,5 +338,4 @@ class TelephonieContrat {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user