diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index ae6c9942762..07e1a6b306b 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -70,12 +70,15 @@ class modMyModule extends DolibarrModules // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. $this->picto='generic'; - // Data directories to create when module is enabled + // Data directories to create when module is enabled. $this->dirs = array(); //$this->dirs[0] = DOL_DATA_ROOT.'/mymodule; //$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp; - // Config pages. Put here list of php page names stored in admmin directory used to setup module + // Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'. + $this->style_sheet = ''; + + // Config pages. Put here list of php page names stored in admmin directory used to setup module. $this->config_page_url = array("mymodulesetuppage.php"); // Dependencies diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index efc88f5610d..f0f437d73bc 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -65,6 +65,8 @@ class Conf var $propal; var $categorie; var $oscommerce2; + var $css; + var $css_modules=array(); /** @@ -100,6 +102,8 @@ class Conf { if (! defined("$key")) define ("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE during install) $this->global->$key=$value; + // If this is constant for a css file activated by a module + if (eregi('MAIN_MODULE_([A-Z_]+)_CSS',$key)) $this->css_modules[]=$value; } $i++; } diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index 989584b27ad..1d32bc3c00d 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -93,15 +93,16 @@ class Contact extends CommonObject $this->name=trim($this->name); if (! $this->socid) $this->socid = 0; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user_creat)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user_creat, priv)"; $sql.= " VALUES (now(),"; if ($this->socid > 0) $sql.= " ".$this->socid.","; else $sql.= "null,"; $sql.= "'".addslashes($this->name)."',"; - $sql.= $user->id; + $sql.= $user->id.","; + $sql.= $this->priv; $sql.= ")"; - dolibarr_syslog("Contact.class::create sql=".$sql); + dolibarr_syslog("Contact::create sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -127,7 +128,7 @@ class Contact extends CommonObject else { $this->error=$this->db->error(); - dolibarr_syslog("Contact.class::create ".$this->error); + dolibarr_syslog("Contact::create ".$this->error); return -1; } } @@ -177,10 +178,11 @@ class Contact extends CommonObject $sql .= ", phone_perso = '".addslashes($this->phone_perso)."'"; $sql .= ", phone_mobile = '".addslashes($this->phone_mobile)."'"; $sql .= ", jabberid = '".addslashes($this->jabberid)."'"; + $sql .= ", priv = '".$this->priv."'"; if ($user) $sql .= ", fk_user_modif=".$user->id; $sql .= " WHERE rowid=".$id; - dolibarr_syslog("Contact.class::update sql=".$sql,LOG_DEBUG); - + + dolibarr_syslog("Contact::update sql=".$sql,LOG_DEBUG); $result = $this->db->query($sql); if (! $result) { @@ -371,7 +373,8 @@ class Contact extends CommonObject $sql.= " c.address, c.cp, c.ville,"; $sql.= " c.fk_pays, p.libelle as pays, p.code as pays_code,"; $sql.= " c.birthday,"; - $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.note,"; + $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid,"; + $sql.= " c.priv, c.note,"; $sql.= " u.rowid as user_id, u.login as user_login"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON c.fk_pays = p.rowid"; @@ -413,6 +416,7 @@ class Contact extends CommonObject $this->email = $obj->email; $this->jabberid = $obj->jabberid; + $this->priv = $obj->priv; $this->mail = $obj->email; $this->birthday = $obj->birthday; @@ -505,7 +509,7 @@ class Contact extends CommonObject $sql.=" AND fk_socpeople = ". $this->id; $sql.=" GROUP BY tc.element"; - dolibarr_syslog("Contact.class::load_ref_elements sql=".$sql); + dolibarr_syslog("Contact::load_ref_elements sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -526,7 +530,7 @@ class Contact extends CommonObject else { $this->error=$this->db->error()." - ".$sql; - dolibarr_syslog("Contact.class::load_ref_elements Error ".$this->error); + dolibarr_syslog("Contact::load_ref_elements Error ".$this->error); return -1; } } @@ -822,6 +826,19 @@ class Contact extends CommonObject } + /** + * \brief Return translated label of Public or Private + * \param type Type (0 = public, 1 = private) + * \return string Label translated + */ + function LibPubPriv($statut) + { + global $langs; + if ($statut=='1') return $langs->trans('ContactPrivate'); + else return $langs->trans('ContactPublic'); + } + + /** * \brief Initialise le contact avec valeurs fictives aléatoire */ diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index fa5319b970c..057f15b366e 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -98,6 +98,7 @@ if ($user->rights->societe->contact->creer) $contact->phone_mobile = $_POST["phone_mobile"]; $contact->fax = $_POST["fax"]; $contact->jabberid = $_POST["jabberid"]; + $contact->priv = $_POST["priv"]; $contact->note = $_POST["note"]; @@ -167,6 +168,7 @@ if ($user->rights->societe->contact->creer) $contact->phone_mobile = $_POST["phone_mobile"]; $contact->fax = $_POST["fax"]; $contact->jabberid = $_POST["jabberid"]; + $contact->priv = $_POST["priv"]; $contact->note = $_POST["note"]; @@ -307,10 +309,19 @@ if ($user->rights->societe->contact->creer) print ''.$langs->trans("PhoneMobile").''; print ''.$langs->trans("Fax").''; + // EMail print ''.$langs->trans("Email").''; + // Jabberid print 'Jabberid'; + // Visibility + print ''.$langs->trans("ContactVisibility").''; + $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); + $form->select_array('priv',$selectarray,$contact->priv,0); + print ''; + + // Note print ''.$langs->trans("Note").''; print ''; @@ -392,8 +403,15 @@ if ($user->rights->societe->contact->creer) } print ''; + // Jabberid print 'Jabberid'; + // Visibility + print ''.$langs->trans("ContactVisibility").''; + $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); + $form->select_array('priv',$selectarray,$contact->priv,0); + print ''; + print ''.$langs->trans("Note").''; print '