diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4b481e93902..0a9dae0c131 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -229,7 +229,7 @@ class Contact extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET "; if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',"; - if ($this->socid == -1) $sql .= " fk_soc=null,"; + else if ($this->socid == -1) $sql .= " fk_soc=null,"; $sql .= " civilite='".$this->db->escape($this->civilite_id)."'"; $sql .= ", name='".$this->db->escape($this->lastname)."'"; $sql .= ", firstname='".$this->db->escape($this->firstname)."'"; @@ -415,13 +415,13 @@ class Contact extends CommonObject //check existing $sql_check = "SELECT * FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$id." AND fk_user=".$user->id; $result_check = $this->db->query($sql_check); - if (!$result_check or ($this->db->num_rows($result_check)<1)) + if (! $result_check || ($this->db->num_rows($result_check)<1)) { //insert - $sql = "INSERT into ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) "; - $sql.= "values (1,".$id.",".$user->id.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) "; + $sql.= "VALUES (1,".$id.",".$user->id.")"; $result = $this->db->query($sql); - if (!$result) + if (! $result) { $error++; $this->error=$this->db->lasterror(); @@ -434,8 +434,8 @@ class Contact extends CommonObject } else { - $sql = "DELETE from ".MAIN_DB_PREFIX."user_alert "; - $sql.= "where type=1 AND fk_contact=".$id." AND fk_user=".$user->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert "; + $sql.= "WHERE type=1 AND fk_contact=".$id." AND fk_user=".$user->id; $result = $this->db->query($sql); if (! $result) { diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 0c2b9804600..dfadaf97c3d 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -581,8 +581,7 @@ class Menubase //$objm = $this->db->fetch_object($resql); $menu = $this->db->fetch_array($resql); - // Define $chaine - $chaine=""; + // Define $title $title = $langs->trans($menu['titre']); if ($title == $menu['titre']) // Translation not found { @@ -594,17 +593,13 @@ class Menubase if (preg_match("/\//",$menu['titre'])) // To manage translation when title is string1/string2 { $tab_titre = explode("/",$menu['titre']); - $chaine = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]); + $title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]); } else { - $chaine = $langs->trans($menu['titre']); + $title = $langs->trans($menu['titre']); } } - else - { - $chaine = $title; - } // Define $right $perms = true; @@ -620,30 +615,9 @@ class Menubase { $enabled = verifCond($menu['enabled']); if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_ACCORDION && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1; - //print "verifCond chaine=".$chaine." rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."
\n"; + //print "verifCond title=".$title." rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."
\n"; } -/* - // 0=rowid, 1=fk_menu, 2=url, 3=text, 4=perms, 5=target, 8=mainmenu - $tabMenu[$b][0] = $menu['rowid']; - $tabMenu[$b][1] = $menu['fk_menu']; - $tabMenu[$b][2] = $menu['url']; - if (! preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$b][2])) - { - if (preg_match('/\?/',$tabMenu[$b][2])) $tabMenu[$b][2].='&idmenu='.$menu['rowid']; - else $tabMenu[$b][2].='?idmenu='.$menu['rowid']; - } - $tabMenu[$b][3] = $chaine; - $tabMenu[$b][5] = $menu['target']; - $tabMenu[$b][6] = $menu['leftmenu']; - if (! isset($tabMenu[$b][4])) $tabMenu[$b][4] = $perms; - else $tabMenu[$b][4] = ($tabMenu[$b][4] && $perms); - if (! isset($tabMenu[$b][7])) $tabMenu[$b][7] = $enabled; - else $tabMenu[$b][7] = ($tabMenu[$b][7] && $enabled); - $tabMenu[$b][8] = $menu['mainmenu']; - $tabMenu[$b][9] = $menu['type']; - $tabMenu[$b][10] = $menu['langs']; -*/ // We complete tabMenu $tabMenu[$b]['rowid'] = $menu['rowid']; $tabMenu[$b]['fk_menu'] = $menu['fk_menu']; @@ -653,7 +627,7 @@ class Menubase if (preg_match('/\?/',$tabMenu[$b]['url'])) $tabMenu[$b]['url'].='&idmenu='.$menu['rowid']; else $tabMenu[$b]['url'].='?idmenu='.$menu['rowid']; } - $tabMenu[$b]['titre'] = $chaine; + $tabMenu[$b]['titre'] = $title; $tabMenu[$b]['target'] = $menu['target']; $tabMenu[$b]['leftmenu'] = $menu['leftmenu']; if (! isset($tabMenu[$b]['perms'])) $tabMenu[$b]['perms'] = $perms; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index a1f311b018f..72aa7c8d30a 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -221,16 +221,16 @@ abstract class ActionsCardCommon { if ($this->object->particulier) { - dol_syslog("This thirdparty is a personal people",LOG_DEBUG); + dol_syslog(get_class($this)."::doActions This thirdparty is a personal people",LOG_DEBUG); $contact=new Contact($this->db); $contact->civilite_id = $this->object->civilite_id; $contact->name = $this->object->name_bis; $contact->firstname = $this->object->firstname; $contact->address = $this->object->address; - $contact->cp = $this->object->cp; - $contact->ville = $this->object->ville; - $contact->fk_pays = $this->object->fk_pays; + $contact->zip = $this->object->zip; + $contact->town = $this->object->town; + $contact->country_id = $this->object->country_id; $contact->socid = $this->object->id; // fk_soc $contact->status = 1; $contact->email = $this->object->email; diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index f5bb8938ca6..51dba473862 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -179,10 +179,10 @@ class ContactTest extends PHPUnit_Framework_TestCase $localobject->default_lang='es_ES'; $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, 'Contact::update error'); $result=$localobject->update_note($localobject->note); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, 'Contact::update_note error'); //$result=$localobject->update_note_public($localobject->note_public); //print __METHOD__." id=".$localobject->id." result=".$result."\n"; //$this->assertLessThan($result, 0); @@ -190,7 +190,7 @@ class ContactTest extends PHPUnit_Framework_TestCase $newobject=new Contact($this->savdb); $result=$newobject->fetch($localobject->id); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, 'Contact::fetch error'); $this->assertEquals($localobject->note, $newobject->note); //$this->assertEquals($localobject->note_public, $newobject->note_public);