Qual: Normalized tabs

This commit is contained in:
Laurent Destailleur 2013-05-29 15:41:59 +02:00
parent 60498f2692
commit e6c93424ce
4 changed files with 179 additions and 46 deletions

View File

@ -504,22 +504,6 @@ else
print $form->selectarray('priv',$selectarray,(isset($_POST["priv"])?$_POST["priv"]:$object->priv),0);
print '</td></tr>';
// Note Public
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
print '<td colspan="3" valign="top">';
$doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
//print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'.(isset($_POST["note"])?$_POST["note"]:$object->note).'</textarea>';
print '</td></tr>';
// Note Private
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="3" valign="top">';
$doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
//print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'.(isset($_POST["note"])?$_POST["note"]:$object->note).'</textarea>';
print '</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -721,24 +705,6 @@ else
print $form->selectarray('priv',$selectarray,$object->priv,0);
print '</td></tr>';
// Note Public
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
// print '<textarea name="note" cols="70" rows="'.ROWS_3.'">';
// print isset($_POST["note"])?$_POST["note"]:$object->note;
// print '</textarea></td></tr>';
print '</td></tr>';
// Note Private
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
// print '<textarea name="note" cols="70" rows="'.ROWS_3.'">';
// print isset($_POST["note"])?$_POST["note"]:$object->note;
// print '</textarea></td></tr>';
print '</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -938,16 +904,6 @@ else
print $object->LibPubPriv($object->priv);
print '</td></tr>';
// Note Public
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
print nl2br($object->note_public);
print '</td></tr>';
// Note Private
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
print nl2br($object->note_private);
print '</td></tr>';
// Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook

169
htdocs/contact/note.php Normal file
View File

@ -0,0 +1,169 @@
<?php
/* Copyright (C) 2001-2003,2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/contact/note.php
* \brief Tab for notes on contact
* \ingroup societe
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$action = GETPOST('action');
$langs->load("companies");
// Security check
$id = GETPOST('id','int');
if ($user->societe_id) $id=$user->societe_id;
$result = restrictedArea($user, 'societe', $id, '&societe');
$object = new Contact($db);
if ($id > 0) $object->fetch($id);
/*
* Actions
*/
/******************************************************************************/
/* Actions */
/******************************************************************************/
if ($action == 'setnote_public' && $user->rights->societe->creer)
{
$object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
if ($result < 0) setEventMessage($object->error,'errors');
}
else if ($action == 'setnote_private' && $user->rights->societe->creer)
{
$object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
if ($result < 0) setEventMessage($object->error,'errors');
}
/*
* View
*/
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
$form = new Form($db);
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url);
if ($id > 0)
{
/*
* Affichage onglets
*/
if (! empty($conf->notification->enabled)) $langs->load("mails");
$head = contact_prepare_head($object);
dol_fiche_head($head, 'note', $title,0,'contact');
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'id', $linkback);
print '</td></tr>';
// Name
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
if ($object->socid > 0)
{
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
print $langs->trans("ContactNotLinkedToCompany");
print '</td></tr>';
}
}
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
print $object->getCivilityLabel();
print '</td></tr>';
// Date To Birth
print '<tr>';
if (! empty($object->birthday))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.dol_print_date($object->birthday,"day");
print ' &nbsp; ';
//var_dump($birthdatearray);
$ageyear=convertSecondToTime($now-$object->birthday,'year')-1970;
$agemonth=convertSecondToTime($now-$object->birthday,'month')-1;
if ($ageyear >= 2) print '('.$ageyear.' '.$langs->trans("DurationYears").')';
else if ($agemonth >= 2) print '('.$agemonth.' '.$langs->trans("DurationMonths").')';
else print '('.$agemonth.' '.$langs->trans("DurationMonth").')';
print ' &nbsp; - &nbsp; ';
if ($object->birthday_alert) print $langs->trans("BirthdayAlertOn");
else print $langs->trans("BirthdayAlertOff");
print '</td>';
}
else
{
print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.$langs->trans("Unknown")."</td>";
}
print "</tr>";
print "</table>";
print '<br>';
$colwidth='20';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end();
}
llxFooter();
$db->close();
?>

View File

@ -66,6 +66,13 @@ function contact_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'contact');
// Notes
$head[$h][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id;
$head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note';
$h++;
// Info
$head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';

View File

@ -14,7 +14,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
$module = $object->element;
@ -26,14 +25,16 @@ $permission=(isset($permission)?$permission:(isset($user->rights->$module->creer
$moreparam=(isset($moreparam)?$moreparam:'');
// Special cases
if ($module == 'propal') { $permission=$user->rights->propale->creer;}
if ($module == 'propal') { $permission=$user->rights->propale->creer;}
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;}
elseif ($module == 'project') { $permission=$user->rights->projet->creer;}
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;}
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;}
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;}
elseif ($module == 'societe') { $permission=$user->rights->societe->creer;}
elseif ($module == 'contact') { $permission=$user->rights->societe->creer;}
elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;}
//else dol_print_error('','Bad value '.$module.' for param module');
if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100';
else $typeofdata='textarea:12:100';