';
@@ -383,6 +392,7 @@ if (function_exists("ldap_connect"))
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
$conf->global->LDAP_FIELD_PHONE,
$conf->global->LDAP_FIELD_FAX,
+ $conf->global->LDAP_FIELD_SKYPE,
$conf->global->LDAP_FIELD_MOBILE,
$conf->global->LDAP_FIELD_MAIL,
$conf->global->LDAP_FIELD_TITLE,
diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php
index 8574e6eb5ad..b54e3f955d2 100644
--- a/htdocs/comm/fiche.php
+++ b/htdocs/comm/fiche.php
@@ -6,6 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2008 Raphael Bertrand (Resultic)
* Copyright (C) 2010-2012 Juanjo Menent
+ * Copyright (C) 2013 Alexandre Spangaro
*
* 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
@@ -267,6 +268,12 @@ if ($id > 0)
// Fax
print '
';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index de2e9e39692..9e67318d693 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9,6 +9,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic)
* Copyright (C) 2010-2011 Juanjo Menent
* Copyright (C) 2013 Cédric Salvador
+ * Copyright (C) 2013 Alexandre Spangaro
*
* 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
@@ -1185,6 +1186,48 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=
return $newemail;
}
+/**
+ * Show Skype link
+ *
+ * @param string $skype Skype to show (only skype, without 'Name of recipient' before)
+ * @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 int $max Max number of characters to show
+ * @return string HTML Link
+ */
+function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64)
+{
+ global $conf,$user,$langs;
+
+ $newskype=$skype;
+
+ if (empty($skype)) return ' ';
+
+ if (! empty($addlink))
+ {
+ $newskype='';
+ $newskype.=' ';
+ $newskype.=dol_trunc($skype,$max);
+ $newskype.='';
+
+ if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
+ {
+ $type='AC_SKYPE'; $link='';
+ if (! empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link=''.img_object($langs->trans("AddAction"),"calendar").'';
+ $newskype='
'.$newskype.'
'.$link.'
';
+ }
+ }
+ else
+ {
+ $langs->load("errors");
+ $newskype.=img_warning($langs->trans("ErrorBadSkype",$skype));
+ }
+ return $newskype;
+}
+
/**
* Format phone numbers according to country
*
diff --git a/htdocs/core/modules/modSkype.class.php b/htdocs/core/modules/modSkype.class.php
new file mode 100644
index 00000000000..ef2a5f47446
--- /dev/null
+++ b/htdocs/core/modules/modSkype.class.php
@@ -0,0 +1,136 @@
+
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \defgroup Skype Module Skype
+ * \brief Add a skype button.
+ * \file htdocs/core/modules/modSkype.class.php
+ * \ingroup Skype
+ * \brief Description and activation file for module Skype
+ */
+include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
+
+/**
+ * Class to describe a Cron module
+ */
+class modSkype extends DolibarrModules
+{
+
+ /**
+ * Constructor. Define names, constants, directories, boxes, permissions
+ *
+ * @param DoliDB $db Database handler
+ */
+ function __construct($db)
+ {
+ global $langs,$conf;
+
+ $this->db = $db;
+ $this->numero = 3100;
+
+ // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
+ // It is used to group modules in module setup page
+ $this->family = "crm";
+ // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
+ $this->name = preg_replace('/^mod/i','',get_class($this));
+ $this->description = "Enable Skype button into contact";
+ $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
+ // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
+ $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
+ // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
+ $this->special = 2;
+ // Name of image file used for this module.
+ $this->picto='skype';
+
+ // Data directories to create when module is enabled
+ $this->dirs = array();
+
+ // Config pages
+ //-------------
+ $this->config_page_url = array();
+
+ // Dependancies
+ //-------------
+ $this->hidden = ! empty($conf->global->SKYPE_MODULE_DISABLED); // A condition to disable module
+ $this->depends = array(modSociete); // List of modules id that must be enabled if this module is enabled
+ $this->requiredby = array(); // List of modules id to disable if this one is disabled
+ $this->conflictwith = array(); // List of modules id this module is in conflict with
+ $this->langfiles = array();
+
+ // Constantes
+ //-----------
+
+
+ // New pages on tabs
+ // -----------------
+ $this->tabs = array();
+
+ // Boxes
+ //------
+ $this->boxes = array();
+
+ // Permissions
+ //------------
+ $this->rights = array(); // Permission array used by this module
+ $this->rights_class = 'skype';
+ $r=0;
+
+ $this->rights[$r][0] = 3101;
+ $this->rights[$r][1] = 'View skype link';
+ $this->rights[$r][3] = 1;
+ $this->rights[$r][4] = 'view';
+ $r++;
+
+ // Main menu entries
+ //------------------
+ $this->menu = array();
+ }
+
+
+ /**
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ function init($options='')
+ {
+ // Prevent pb of modules not correctly disabled
+ //$this->remove($options);
+
+ return $this->_init($sql,$options);
+ }
+
+ /**
+ * Function called when module is disabled.
+ * Remove from database constants, boxes and permissions from Dolibarr database.
+ * Data directories are not deleted
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ function remove($options='')
+ {
+ $sql = array();
+
+ return $this->_remove($sql,$options);
+ }
+
+}
+?>
diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
index e417a408d50..a053d517b69 100755
--- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
+++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
@@ -329,3 +329,9 @@ create table llx_actioncomm_resources
) ENGINE=innodb;
ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX idx_actioncomm_resources_idx1 (fk_actioncomm, element_type, fk_element);
ALTER TABLE llx_actioncomm_resources ADD INDEX idx_actioncomm_resources_fk_element (fk_element);
+
+-- Task 157
+ALTER TABLE llx_user ADD skype VARCHAR(255) AFTER job;
+ALTER TABLE llx_socpeople ADD skype VARCHAR(255) AFTER jabberid;
+ALTER TABLE llx_societe ADD skype VARCHAR(255) AFTER email;
+ALTER TABLE llx_adherent ADD skype VARCHAR(255) AFTER email;
\ No newline at end of file
diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql
index af15f5da198..6d5a4723462 100644
--- a/htdocs/install/mysql/tables/llx_adherent.sql
+++ b/htdocs/install/mysql/tables/llx_adherent.sql
@@ -45,6 +45,7 @@ create table llx_adherent
state_id integer,
country integer,
email varchar(255),
+ skype varchar(255),
phone varchar(30),
phone_perso varchar(30),
phone_mobile varchar(30),
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index e0588f04794..f4e1614cd7d 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -49,6 +49,7 @@ create table llx_societe
fax varchar(20), -- fax number
url varchar(255), --
email varchar(128), --
+ skype varchar(255), --
fk_effectif integer DEFAULT 0, --
fk_typent integer DEFAULT 0, --
fk_forme_juridique integer DEFAULT 0, -- juridical status
diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql
index 00e6f50f61b..04635061e59 100644
--- a/htdocs/install/mysql/tables/llx_socpeople.sql
+++ b/htdocs/install/mysql/tables/llx_socpeople.sql
@@ -42,6 +42,7 @@ create table llx_socpeople
fax varchar(30),
email varchar(255),
jabberid varchar(255),
+ skype varchar(255),
no_email smallint NOT NULL DEFAULT 0,
priv smallint NOT NULL DEFAULT 0,
fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql
index 9fd1db59c91..2bd8523b278 100644
--- a/htdocs/install/mysql/tables/llx_user.sql
+++ b/htdocs/install/mysql/tables/llx_user.sql
@@ -41,6 +41,7 @@ create table llx_user
fk_state integer DEFAULT 0, --
fk_country integer DEFAULT 0, --
job varchar(128),
+ skype varchar(255),
office_phone varchar(20),
office_fax varchar(20),
user_mobile varchar(20),
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 2f9e4ed285d..94e6cb840c5 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -66,6 +66,8 @@ Country=Country
CountryCode=Country code
CountryId=Country id
Phone=Phone
+Skype=Skype
+Call=Call
PhonePro=Prof. phone
PhonePerso=Pers. phone
PhoneMobile=Mobile
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 162550a162b..617a673d100 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -8,6 +8,7 @@
* Copyright (C) 2008 Patrick Raguin
* Copyright (C) 2010-2011 Juanjo Menent
* Copyright (C) 2013 Florian Henry
+ * Copyright (C) 2013 Alexandre Spangaro
*
* 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
@@ -68,6 +69,7 @@ class Societe extends CommonObject
var $phone;
var $fax;
var $email;
+ var $skype;
var $url;
//! barcode
@@ -410,6 +412,7 @@ class Societe extends CommonObject
$this->fax = preg_replace("/\s/","",$this->fax);
$this->fax = preg_replace("/\./","",$this->fax);
$this->email = trim($this->email);
+ $this->skype = trim($this->skype);
$this->url = $this->url?clean_url($this->url,0):'';
$this->idprof1 = trim($this->idprof1);
$this->idprof2 = trim($this->idprof2);
@@ -508,6 +511,7 @@ class Societe extends CommonObject
$sql .= ",phone = ".(! empty($this->phone)?"'".$this->db->escape($this->phone)."'":"null");
$sql .= ",fax = ".(! empty($this->fax)?"'".$this->db->escape($this->fax)."'":"null");
$sql .= ",email = ".(! empty($this->email)?"'".$this->db->escape($this->email)."'":"null");
+ $sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null");
$sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null");
$sql .= ",siren = '". $this->db->escape($this->idprof1) ."'";
@@ -590,6 +594,7 @@ class Societe extends CommonObject
//$lmember->lastname=$this->lastname?$this->lastname:$lmember->lastname; // We keep firstname and lastname of member unchanged
$lmember->address=$this->address;
$lmember->email=$this->email;
+ $lmember->skype=$this->skype;
$lmember->phone=$this->phone;
$result=$lmember->update($user,0,1,1,1); // Use nosync to 1 to avoid cyclic updates
@@ -699,7 +704,7 @@ class Societe extends CommonObject
$sql .= ', s.status';
$sql .= ', s.price_level';
$sql .= ', s.tms as date_update';
- $sql .= ', s.phone, s.fax, s.email, s.url, s.zip, s.town, s.note_private, s.note_public, s.client, s.fournisseur';
+ $sql .= ', s.phone, s.fax, s.email, s.skype, s.url, s.zip, s.town, s.note_private, s.note_public, s.client, s.fournisseur';
$sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6';
$sql .= ', s.capital, s.tva_intra';
$sql .= ', s.fk_typent as typent_id';
@@ -777,6 +782,7 @@ class Societe extends CommonObject
$this->statut_commercial = $libelle; // libelle statut commercial
$this->email = $obj->email;
+ $this->skype = $obj->skype;
$this->url = $obj->url;
$this->phone = $obj->phone;
$this->fax = $obj->fax;
@@ -2409,6 +2415,7 @@ class Societe extends CommonObject
$this->country_id=$member->country_id;
$this->phone=$member->phone; // Prof phone
$this->email=$member->email;
+ $this->skype=$member->skype;
$this->client = 1; // A member is a customer by default
$this->code_client = -1;
@@ -2548,6 +2555,7 @@ class Societe extends CommonObject
$this->country_id=1;
$this->country_code='FR';
$this->email='specimen@specimen.com';
+ $this->skype='tom.hanson';
$this->url='http://www.specimen.com';
$this->phone='0909090901';
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index fb273b79ab3..e8c8378eee0 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -4,8 +4,10 @@
* Copyright (C) 2004-2013 Laurent Destailleur
* Copyright (C) 2005 Eric Seigne
* Copyright (C) 2005-2012 Regis Houssin
- * Copyright (C) 2008 Patrick Raguin
+ * Copyright (C) 2008 Patrick Raguin
* Copyright (C) 2010-2013 Juanjo Menent
+ * Copyright (C) 2011-2013 Alexandre Spangaro
+ *
*
* 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
@@ -130,6 +132,7 @@ if (empty($reshook))
$object->town = GETPOST('town');
$object->country_id = GETPOST('country_id');
$object->state_id = GETPOST('state_id');
+ $object->skype = GETPOST('skype');
$object->phone = GETPOST('phone');
$object->fax = GETPOST('fax');
$object->email = GETPOST('email');
@@ -254,7 +257,7 @@ if (empty($reshook))
dol_syslog("This thirdparty is a personal people",LOG_DEBUG);
$contact=new Contact($db);
- $contact->civilite_id = $object->civilite_id;
+ $contact->civilite_id = $object->civilite_id;
$contact->name = $object->name_bis;
$contact->firstname = $object->firstname;
$contact->address = $object->address;
@@ -265,8 +268,9 @@ if (empty($reshook))
$contact->socid = $object->id; // fk_soc
$contact->status = 1;
$contact->email = $object->email;
- $contact->phone_pro = $object->phone;
- $contact->fax = $object->fax;
+ $contact->skype = $object->skype;
+ $contact->phone_pro = $object->phone;
+ $contact->fax = $object->fax;
$contact->priv = 0;
$result=$contact->create($user);
@@ -598,6 +602,7 @@ else
$object->zip = GETPOST('zipcode');
$object->town = GETPOST('town');
$object->state_id = GETPOST('state_id');
+ $object->skype = GETPOST('skype');
$object->phone = GETPOST('phone');
$object->fax = GETPOST('fax');
$object->email = GETPOST('email');
@@ -845,6 +850,12 @@ else
print '