Fix: Clicktodial plugin works correctly now

This commit is contained in:
Laurent Destailleur 2009-01-09 21:22:58 +00:00
parent 1359866802
commit 142a269667
5 changed files with 52 additions and 51 deletions

View File

@ -9,16 +9,17 @@ For users:
- New: Sort list of languages in combo box.
- New: EMails links are show with function dol_print_email
- New: Add graph report on number of entities in product statistics page.
- Fixed: Failed to go on the future view of bank transaction if there is no
- Fix: Failed to go on the future view of bank transaction if there is no
future bank transaction already wrote.
- Fixed: Bad ref in supplier list.
- Fixed: Bad link in product statistics for supplier referers.
- Fix: Bad ref in supplier list.
- Fix: Bad link in product statistics for supplier referers.
- Fix: Usage of reset of cursor in personalized numbering modules for a particular
month (@ option) was broken.
- Can add contacts to a supplier invoice.
- Fixed: When an invoice is changed back to status draft, warehouse is increased
- Fix: When an invoice is changed back to status draft, warehouse is increased
back.
- Fixed: Category of a bank transaction was not saved.
- Fix: Category of a bank transaction was not saved.
- Fix: Clicktodial plugin works correctly now
For translators:
- Added ca_ES language files

View File

@ -741,7 +741,7 @@ function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$s
function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=" ")
{
global $conf,$user,$langs;
// Clean phone parameter
$phone = ereg_replace("[ .-]","",trim($phone));
if (empty($phone)) { return ''; }
@ -770,11 +770,13 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
$newphone=substr($newphone,0,4).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2);
}
}
if (! empty($addlink))
{
if ($conf->clicktodial->enabled)
{
if (empty($user->clicktodial_loaded)) $user->fetch_clicktodial();
if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured';
else $urlmask=$conf->global->CLICKTODIAL_URL;
$url = sprintf($urlmask, urlencode($phone), urlencode($user->clicktodial_poste), urlencode($user->clicktodial_login), urlencode($user->clicktodial_password));

View File

@ -108,7 +108,7 @@ class User extends CommonObject
// Preference utilisateur
$this->liste_limit = 0;
$this->clicktodial_enabled = 0;
$this->clicktodial_loaded = 0;
$this->all_permissions_are_loaded = 0;
$this->admin=0;
@ -116,14 +116,14 @@ class User extends CommonObject
return 1;
}
/* Polymorph functions not allowed in PHP
function fetch($id)
{
function fetch($id)
{
$this->id=$id;
$this->fetch();
}
*/
$this->fetch();
}
*/
/**
* \brief Charge un objet user avec toutes ces caracteristiques depuis un id ou login
@ -684,7 +684,7 @@ class User extends CommonObject
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE login ='".addslashes($this->login)."'";
dolibarr_syslog("User::Create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
@ -793,7 +793,7 @@ class User extends CommonObject
$this->nom = $contact->nom;
$this->prenom = $contact->prenom;
$this->email = $contact->email;
if (empty($login)) $login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4));
$this->login = $login;
@ -1264,7 +1264,7 @@ class User extends CommonObject
{ // If user has not defined its own language, we used current language
$outputlangs=$langs;
}
// \TODO Use outputlangs to translate messages
if (! $changelater)
{
@ -1317,41 +1317,36 @@ class User extends CommonObject
/**
* \brief Lecture des infos de click to dial
* \brief Read clicktodial information for user
* \return <0 if KO, >0 if OK
*/
function fetch_clicktodial()
{
$sql = "SELECT login, pass, poste ";
$sql.= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u";
$sql.= " WHERE u.fk_user = ".$this->id;
$result = $this->db->query($sql);
if ($result)
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object();
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->clicktodial_login = $obj->login;
$this->clicktodial_password = $obj->pass;
$this->clicktodial_poste = $obj->poste;
$this->clicktodial_login = $obj->login;
$this->clicktodial_password = $obj->pass;
$this->clicktodial_poste = $obj->poste;
}
if (strlen(trim($this->clicktodial_login)) &&
strlen(trim($this->clicktodial_password)) &&
strlen(trim($this->clicktodial_poste)))
{
$this->clicktodial_enabled = 1;
}
}
$this->db->free();
$this->clicktodial_loaded = 1; // Data loaded (found or not)
$this->db->free($resql);
return 1;
}
else
{
print $this->db->error();
$this->error=$this->db->error();
return -1;
}
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -18,10 +18,10 @@
*/
/**
\file htdocs/user/clicktodial.php
\brief Page for Click to dial datas
\version $Id$
*/
* \file htdocs/user/clicktodial.php
* \brief Page for Click to dial datas
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
@ -93,7 +93,6 @@ if ($_GET["id"])
print "</table>\n";
print "<br>\n";
print info_admin($langs->trans("ClickToDialUrlDesc"));
if ($_GET["action"] == 'edit')
{
@ -104,7 +103,9 @@ if ($_GET["id"])
if ($user->admin)
{
print "<tr>".'<td width="25%" valign="top">ClickToDial URL</td>';
print '<td class="valeur">'.$conf->global->CLICKTODIAL_URL.'</td>';
print '<td class="valeur">';
print $form->textwithhelp($conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc"));
print '</td>';
print '</tr>';
}
@ -138,7 +139,9 @@ if ($_GET["id"])
if ($user->admin)
{
print "<tr>".'<td width="25%" valign="top">ClickToDial URL</td>';
print '<td class="valeur">'.$conf->global->CLICKTODIAL_URL.'</td>';
print '<td class="valeur">';
print $form->textwithhelp($conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc"));
print '</td>';
print '</tr>';
}
print "<tr>".'<td width="25%" valign="top">ClickToDial '.$langs->trans("Login").'</td>';

View File

@ -931,19 +931,19 @@ else
// Tel pro
print '<tr><td width="25%" valign="top">'.$langs->trans("PhonePro").'</td>';
print '<td>'.$fuser->office_phone.'</td>';
print '<td>'.dol_print_phone($fuser->office_phone,'',0,0,1).'</td>';
// Tel mobile
print '<tr><td width="25%" valign="top">'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.$fuser->user_mobile.'</td>';
print '<td>'.dol_print_phone($fuser->user_mobile,'',0,0,1).'</td>';
// Fax
print '<tr><td width="25%" valign="top">'.$langs->trans("Fax").'</td>';
print '<td>'.$fuser->office_fax.'</td>';
print '<td>'.dol_print_phone($fuser->office_fax,'',0,0,1).'</td>';
// EMail
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>';
print '<td><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>';
print '<td>'.dol_print_email($fuser->email,0,0,1).'</td>';
print "</tr>\n";
// Statut