';
diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php
index 72c7945bf43..927975e9c26 100644
--- a/htdocs/resource/list.php
+++ b/htdocs/resource/list.php
@@ -196,7 +196,13 @@ if($ret == -1) {
dol_print_error($db,$object->error);
exit;
} else {
- print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $nbtotalofrecords,'title_generic.png', 0, '', '', $limit);
+ $newcardbutton='';
+ if ($user->rights->resource->write)
+ {
+ $newcardbutton='
'.$langs->trans('MenuResourceAdd').'';
+ }
+
+ print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $nbtotalofrecords,'title_generic.png', 0, $newcardbutton, '', $limit);
}
$moreforfilter = '';
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 920dee364c7..663a1b80586 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -1643,6 +1643,7 @@ else
print '
';
print '
';
print '
';
+ print '
';
if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print '
';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 5d452cabcb6..b782741914c 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -772,9 +772,10 @@ class Societe extends CommonObject
// Clean parameters
$this->id = $id;
+ $this->entity = ((isset($this->entity) && is_numeric($this->entity))?$this->entity:$conf->entity);
$this->name = $this->name?trim($this->name):trim($this->nom);
$this->nom = $this->name; // For backward compatibility
- $this->name_alias = trim($this->name_alias);
+ $this->name_alias = trim($this->name_alias);
$this->ref_ext = trim($this->ref_ext);
$this->address = $this->address?trim($this->address):trim($this->address);
$this->zip = $this->zip?trim($this->zip):trim($this->zip);
@@ -789,9 +790,9 @@ class Societe extends CommonObject
$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->note_private = trim($this->note_private);
- $this->note_public = trim($this->note_public);
+ $this->url = $this->url?clean_url($this->url,0):'';
+ $this->note_private = trim($this->note_private);
+ $this->note_public = trim($this->note_public);
$this->idprof1 = trim($this->idprof1);
$this->idprof2 = trim($this->idprof2);
$this->idprof3 = trim($this->idprof3);
@@ -896,7 +897,8 @@ class Societe extends CommonObject
dol_syslog(get_class($this)."::update verify ok or not done");
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
- $sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required
+ $sql .= "entity = " . $this->entity;
+ $sql .= ",nom = '" . $this->db->escape($this->name) ."'"; // Required
$sql .= ",name_alias = '" . $this->db->escape($this->name_alias) ."'";
$sql .= ",ref_ext = " .(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext) ."'":"null");
$sql .= ",address = '" . $this->db->escape($this->address) ."'";
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 460a0143c05..448f526df4a 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -569,6 +569,23 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
+$newcardbutton='';
+if ($user->rights->societe->creer)
+{
+ $typefilter='';
+ $label='MenuNewThirdParty';
+
+ if(! empty($type))
+ {
+ $typefilter = '&type='.$type;
+ if($type == 'p') $label='MenuNewProspect';
+ if($type == 'c') $label='MenuNewCustomer';
+ if($type == 'f') $label='NewSupplier';
+ }
+
+ $newcardbutton = '
'.$langs->trans($label).'';
+}
+
print '