Qual: Uniformize code and filename

This commit is contained in:
Laurent Destailleur 2012-03-19 22:06:28 +01:00
parent 0f87181c2a
commit 4295699e0c
2 changed files with 17 additions and 13 deletions

View File

@ -92,7 +92,7 @@ function societe_prepare_head($object)
if ($user->societe_id == 0) if ($user->societe_id == 0)
{ {
// Notes // 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][1] = $langs->trans("Note");
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
@ -507,7 +507,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
} }
print "\n"; print "\n";
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany")); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany"));
print_fiche_titre($title,$buttoncreate,''); print_fiche_titre($title,$buttoncreate,'');
@ -609,7 +609,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
{ {
global $user; global $user;
global $bc; global $bc;
require_once(DOL_DOCUMENT_ROOT."/societe/class/address.class.php"); require_once(DOL_DOCUMENT_ROOT."/societe/class/address.class.php");
$addressstatic = new Address($db); $addressstatic = new Address($db);
@ -652,9 +652,9 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
print '</td>'; print '</td>';
print '<td>'.$address->name.'</td>'; print '<td>'.$address->name.'</td>';
print '<td>'.$address->town.'</td>'; print '<td>'.$address->town.'</td>';
$img=picto_from_langcode($address->country_code); $img=picto_from_langcode($address->country_code);
print '<td>'.($img?$img.' ':'').$address->country.'</td>'; print '<td>'.($img?$img.' ':'').$address->country.'</td>';

View File

@ -19,7 +19,7 @@
*/ */
/** /**
* \file htdocs/societe/socnote.php * \file htdocs/societe/note.php
* \brief Tab for notes on third party * \brief Tab for notes on third party
* \ingroup societe * \ingroup societe
*/ */
@ -27,7 +27,7 @@
require("../main.inc.php"); require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.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"); $langs->load("companies");
@ -37,6 +37,7 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'societe', $socid, '&societe'); $result = restrictedArea($user, 'societe', $socid, '&societe');
$object = new Societe($db); $object = new Societe($db);
if ($socid > 0) $object->fetch($socid);
/* /*
* Actions * Actions
@ -44,9 +45,11 @@ $object = new Societe($db);
if ($action == 'add' && ! GETPOST('cancel')) if ($action == 'add' && ! GETPOST('cancel'))
{ {
// TODO move to DAO class $result=$object->update_note($_POST["note"]);
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='".$db->escape($_POST["note"])."' WHERE rowid=".$socid; if ($result < 0)
$result = $db->query($sql); {
$errors[]=$object->errors;
}
} }
@ -63,8 +66,6 @@ llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Notes"),$help_url)
if ($socid > 0) if ($socid > 0)
{ {
$object->fetch($socid);
/* /*
* Affichage onglets * Affichage onglets
*/ */
@ -72,6 +73,7 @@ if ($socid > 0)
$head = societe_prepare_head($object); $head = societe_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company');
@ -138,9 +140,11 @@ if ($socid > 0)
} }
print '</form>'; print '</form>';
dol_fiche_end();
} }
print '</div>'; dol_htmloutput_errors('',$errors);
/* /*