diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 05d35049061..99241a8342f 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -69,7 +69,7 @@ print ''; $var=true; -print ''; +print '
'; print ''; print ''; print ''; @@ -83,19 +83,38 @@ print $langs->trans("ClickToDialUrlDesc").'
'; print $langs->trans("Example").':
http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; print ''; -print ''; -print '
'.$langs->trans("Name").''.$langs->trans("Value").'

'; +print ''; -/*if (! empty($conf->global->CLICKTODIAL_URL)) - { - print $langs->trans("Test"); - // Add a phone number to test - } - */ +print '

'; + +print ''; + + +if (! empty($conf->global->CLICKTODIAL_URL)) +{ + $user->fetch_clicktodial(); + + print $langs->trans("LinkToTestClickToDial").' : '; + + $setupcomplete=1; + if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0; + if (preg_match('/__PASSWORD__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete=0; + if (preg_match('/__PHONEFROM__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0; + + if ($setupcomplete) + { + print dol_print_phone($mysoc->phone, '', 0, 0, 'AC_TEL'); + } + else + { + $langs->load("errors"); + print '
'.$langs->trans("WarningClickToDialUserSetupNotComplete").'
'; + } +} dol_htmloutput_mesg($mesg); $db->close(); llxFooter(); -?> +?> \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d0ad263d71a..c1e4f2b61d1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1155,17 +1155,18 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= * @param string $country Country code to use for formatting * @param int $cid Id of contact if known * @param int $socid Id of third party if known - * @param int $addlink 0=no link to create action - * @param string $separ separation between numbers for a better visibility example : xx.xx.xx.xx.xx + * @param int $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set) + * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx * @return string Formated phone number */ -function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=" ") +function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" ") { - global $conf,$user,$langs; + global $conf,$user,$langs,$mysoc; // Clean phone parameter $phone = preg_replace("/[\s.-]/","",trim($phone)); if (empty($phone)) { return ''; } + if (empty($country)) $country=$mysoc->country_code; $newphone=$phone; if (strtoupper($country) == "FR") diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c46ab4545c8..fef12f037fa 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -361,6 +361,7 @@ LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
1 : local tax apply on products and services without vat (vat is not applied on local tax)
2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
3 : local tax apply on products without vat (vat is not applied on local tax)
4 : local tax apply on products before vat (vat is calculated on amount + localtax)
5 : local tax apply on services without vat (vat is not applied on local tax)
6 : local tax apply on services before vat (vat is calculated on amount + localtax) SMS=SMS +LinkToTestClickToDial=Link to test the ClickToDial # Modules Module0Name=Users & groups diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index d66449ecf5d..184c6bcc325 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -132,4 +132,5 @@ WarningNoDocumentModelActivated=No model, for document generation, has been acti WarningLockFileDoesNotExists=Warning, once setup is finished, you must disable install/migrate tools by adding a file install.lock into directory %s. Missing this file is a security hole. WarningUntilDirRemoved=All security warnings (visible by admin users only) will remain active as long as the vulnerability is present (or that constant MAIN_REMOVE_INSTALL_WARNING is added in Setup->Other setup). WarningCloseAlways=Warning, closing is done even if amount differs between source and target elements. Enable this feature with caution. -WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. \ No newline at end of file +WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. +WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card). \ No newline at end of file diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index ecc78fc4273..6ffd8fba44a 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -360,6 +360,7 @@ WarningUsingFPDF=Attention: Votre fichier conf.php contient la directive LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:
1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)
2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)
3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)
4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)
5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)
6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale) SuhosinSessionEncrypt=Stockage des sessions encryptés par Suhosin SMS=SMS +LinkToTestClickToDial=Lien pour tester le ClickToDial # Modules= undefined Module0Name= Utilisateurs & groupes diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 8110d224355..576d9d4bcb6 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -133,4 +133,5 @@ WarningNoDocumentModelActivated=Aucun modèle, pour la génération de document, WarningLockFileDoesNotExists=Attention, une fois l'installation terminée, les outils d'installation/migration doivent être désactivés en ajoutant un fichier install.lock dans le répertoire %s. L'absence de ce fichier représente une faille de sécurité. WarningUntilDirRemoved=Les alertes de sécurité sont visibles par les administrateurs uniquement et resteront actives tant que la vulnérabilité sera avérée (ou que la constante MAIN_REMOVE_INSTALL_WARNING aura été définie dans Configuration->Divers) WarningCloseAlways=Attention, la fermeture se fait même lorsque le montant diffère. N'activez cette fonctionnalité qu'en connaissance de cause. -WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de sérieux ralentissement des pages affichant cette boite. \ No newline at end of file +WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de sérieux ralentissement des pages affichant cette boite. +WarningClickToDialUserSetupNotComplete=La configuration ClickToDial pour votre compte utilisateur n'est pas complète (voir l'onglet ClickToDial sur votre fiche utilisateur) \ No newline at end of file diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c04f96b09db..de4876bd275 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -81,6 +81,10 @@ class User extends CommonObject var $phenix_pass; var $phenix_pass_crypted; + var $clicktodial_login; + var $clicktodial_password; + var $clicktodial_poste; + var $datelastlogin; var $datepreviouslogin; var $statut; diff --git a/scripts/clicktodial/linphone.sh b/scripts/clicktodial/linphone.sh new file mode 100755 index 00000000000..b2dc13e77e8 --- /dev/null +++ b/scripts/clicktodial/linphone.sh @@ -0,0 +1,11 @@ +#!/bin/bash +#--------------------------------------------------------- +# Script to launch LinPhone softphone. +# This script can be used to setup a ClickToDial system +# when using LinPhone soft phone. +# More information on http://wiki.dolibarr.org/index.php/Module_ClickToDial_En +#--------------------------------------------------------- + +echo Launch Linphone $1 $2 +param=`echo $1 | sed -s 's/^sip:[\/]*//' ` +/usr/bin/linphone-3 -c $param