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: Sort list of languages in combo box.
- New: EMails links are show with function dol_print_email - New: EMails links are show with function dol_print_email
- New: Add graph report on number of entities in product statistics page. - 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. future bank transaction already wrote.
- Fixed: Bad ref in supplier list. - Fix: Bad ref in supplier list.
- Fixed: Bad link in product statistics for supplier referers. - Fix: Bad link in product statistics for supplier referers.
- Fix: Usage of reset of cursor in personalized numbering modules for a particular - Fix: Usage of reset of cursor in personalized numbering modules for a particular
month (@ option) was broken. month (@ option) was broken.
- Can add contacts to a supplier invoice. - 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. 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: For translators:
- Added ca_ES language files - Added ca_ES language files

View File

@ -775,6 +775,8 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
{ {
if ($conf->clicktodial->enabled) if ($conf->clicktodial->enabled)
{ {
if (empty($user->clicktodial_loaded)) $user->fetch_clicktodial();
if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured'; if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured';
else $urlmask=$conf->global->CLICKTODIAL_URL; else $urlmask=$conf->global->CLICKTODIAL_URL;
$url = sprintf($urlmask, urlencode($phone), urlencode($user->clicktodial_poste), urlencode($user->clicktodial_login), urlencode($user->clicktodial_password)); $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 // Preference utilisateur
$this->liste_limit = 0; $this->liste_limit = 0;
$this->clicktodial_enabled = 0; $this->clicktodial_loaded = 0;
$this->all_permissions_are_loaded = 0; $this->all_permissions_are_loaded = 0;
$this->admin=0; $this->admin=0;
@ -118,12 +118,12 @@ class User extends CommonObject
/* Polymorph functions not allowed in PHP /* Polymorph functions not allowed in PHP
function fetch($id) function fetch($id)
{ {
$this->id=$id; $this->id=$id;
$this->fetch(); $this->fetch();
} }
*/ */
/** /**
* \brief Charge un objet user avec toutes ces caracteristiques depuis un id ou login * \brief Charge un objet user avec toutes ces caracteristiques depuis un id ou login
@ -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() function fetch_clicktodial()
{ {
$sql = "SELECT login, pass, poste "; $sql = "SELECT login, pass, poste ";
$sql.= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u";
$sql.= " WHERE u.fk_user = ".$this->id; $sql.= " WHERE u.fk_user = ".$this->id;
$result = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql)
if ($result)
{ {
if ($this->db->num_rows()) if ($this->db->num_rows($resql))
{ {
$obj = $this->db->fetch_object(); $obj = $this->db->fetch_object($resql);
$this->clicktodial_login = $obj->login; $this->clicktodial_login = $obj->login;
$this->clicktodial_password = $obj->pass; $this->clicktodial_password = $obj->pass;
$this->clicktodial_poste = $obj->poste; $this->clicktodial_poste = $obj->poste;
}
if (strlen(trim($this->clicktodial_login)) && $this->clicktodial_loaded = 1; // Data loaded (found or not)
strlen(trim($this->clicktodial_password)) &&
strlen(trim($this->clicktodial_poste)))
{
$this->clicktodial_enabled = 1;
}
} $this->db->free($resql);
return 1;
$this->db->free();
} }
else else
{ {
print $this->db->error(); $this->error=$this->db->error();
return -1;
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -18,10 +18,10 @@
*/ */
/** /**
\file htdocs/user/clicktodial.php * \file htdocs/user/clicktodial.php
\brief Page for Click to dial datas * \brief Page for Click to dial datas
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
@ -93,7 +93,6 @@ if ($_GET["id"])
print "</table>\n"; print "</table>\n";
print "<br>\n"; print "<br>\n";
print info_admin($langs->trans("ClickToDialUrlDesc"));
if ($_GET["action"] == 'edit') if ($_GET["action"] == 'edit')
{ {
@ -104,7 +103,9 @@ if ($_GET["id"])
if ($user->admin) if ($user->admin)
{ {
print "<tr>".'<td width="25%" valign="top">ClickToDial URL</td>'; 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>';
} }
@ -138,7 +139,9 @@ if ($_GET["id"])
if ($user->admin) if ($user->admin)
{ {
print "<tr>".'<td width="25%" valign="top">ClickToDial URL</td>'; 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>';
} }
print "<tr>".'<td width="25%" valign="top">ClickToDial '.$langs->trans("Login").'</td>'; print "<tr>".'<td width="25%" valign="top">ClickToDial '.$langs->trans("Login").'</td>';

View File

@ -931,19 +931,19 @@ else
// Tel pro // Tel pro
print '<tr><td width="25%" valign="top">'.$langs->trans("PhonePro").'</td>'; 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 // Tel mobile
print '<tr><td width="25%" valign="top">'.$langs->trans("PhoneMobile").'</td>'; 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 // Fax
print '<tr><td width="25%" valign="top">'.$langs->trans("Fax").'</td>'; 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 // EMail
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>'; 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"; print "</tr>\n";
// Statut // Statut