diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 26b4163a1c2..09fc90fe7c5 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -92,7 +92,7 @@ function societe_prepare_head($object)
if ($user->societe_id == 0)
{
// Notes
- $head[$h][0] = DOL_URL_ROOT.'/societe/socnote.php?socid='.$object->id;
+ $head[$h][0] = DOL_URL_ROOT.'/societe/note.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note';
$h++;
@@ -507,7 +507,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
}
print "\n";
-
+
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany"));
print_fiche_titre($title,$buttoncreate,'');
@@ -609,7 +609,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
{
global $user;
global $bc;
-
+
require_once(DOL_DOCUMENT_ROOT."/societe/class/address.class.php");
$addressstatic = new Address($db);
@@ -652,9 +652,9 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
print '';
print '
'.$address->name.' | ';
-
+
print ''.$address->town.' | ';
-
+
$img=picto_from_langcode($address->country_code);
print ''.($img?$img.' ':'').$address->country.' | ';
diff --git a/htdocs/societe/socnote.php b/htdocs/societe/note.php
similarity index 93%
rename from htdocs/societe/socnote.php
rename to htdocs/societe/note.php
index 1e0d8e621f1..e43c36c0484 100644
--- a/htdocs/societe/socnote.php
+++ b/htdocs/societe/note.php
@@ -19,7 +19,7 @@
*/
/**
- * \file htdocs/societe/socnote.php
+ * \file htdocs/societe/note.php
* \brief Tab for notes on third party
* \ingroup societe
*/
@@ -27,7 +27,7 @@
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
-$action = isset($_GET["action"])?$_GET["action"]:$_POST["action"];
+$action = GETPOST('action');
$langs->load("companies");
@@ -37,6 +37,7 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'societe', $socid, '&societe');
$object = new Societe($db);
+if ($socid > 0) $object->fetch($socid);
/*
* Actions
@@ -44,9 +45,11 @@ $object = new Societe($db);
if ($action == 'add' && ! GETPOST('cancel'))
{
- // TODO move to DAO class
- $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='".$db->escape($_POST["note"])."' WHERE rowid=".$socid;
- $result = $db->query($sql);
+ $result=$object->update_note($_POST["note"]);
+ if ($result < 0)
+ {
+ $errors[]=$object->errors;
+ }
}
@@ -63,8 +66,6 @@ llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Notes"),$help_url)
if ($socid > 0)
{
- $object->fetch($socid);
-
/*
* Affichage onglets
*/
@@ -72,6 +73,7 @@ if ($socid > 0)
$head = societe_prepare_head($object);
+
dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company');
@@ -138,9 +140,11 @@ if ($socid > 0)
}
print '';
+
+ dol_fiche_end();
}
-print '';
+dol_htmloutput_errors('',$errors);
/*