From 1d2ee5f5870f91f8f4512a3a7c570a77430d08c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jul 2011 16:24:57 +0000 Subject: [PATCH] New: Add cancel button on note edit --- htdocs/societe/socnote.php | 86 ++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/htdocs/societe/socnote.php b/htdocs/societe/socnote.php index 6385d48e759..e0a849af112 100644 --- a/htdocs/societe/socnote.php +++ b/htdocs/societe/socnote.php @@ -23,7 +23,7 @@ * \file htdocs/societe/socnote.php * \brief Tab for notes on third party * \ingroup societe - * \version $Id$ + * \version $Id: socnote.php,v 1.22 2011/07/13 16:24:57 eldy Exp $ */ require("../main.inc.php"); @@ -44,13 +44,13 @@ $result = restrictedArea($user, 'societe', $socid); * Actions */ -if ($action == 'add') +if ($action == 'add' && ! GETPOST('cancel')) { - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='".$db->escape($_POST["note"])."' WHERE rowid=".$_POST["socid"]; - $result = $db->query($sql); + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='".$db->escape($_POST["note"])."' WHERE rowid=".$_POST["socid"]; + $result = $db->query($sql); - $_GET["socid"]=$_POST["socid"]; // Pour retour sur fiche - $socid = $_GET["socid"]; + $_GET["socid"]=$_POST["socid"]; // Pour retour sur fiche + $socid = $_GET["socid"]; } @@ -70,25 +70,25 @@ if ($socid > 0) $societe = new Societe($db, $socid); $societe->fetch($socid); - /* - * Affichage onglets - */ + /* + * Affichage onglets + */ if ($conf->notification->enabled) $langs->load("mails"); - $head = societe_prepare_head($societe); + $head = societe_prepare_head($societe); - dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company'); - print "
"; - print ''; + print ""; + print ''; - print ''; + print '
'; - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { @@ -113,32 +113,36 @@ if ($socid > 0) print ''; } - print ''; - print ''; + print '"; + // Editeur wysiwyg + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('note',$societe->note,'',360,'dolibarr_notes','In',true,false,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE,20,70); + $doleditor->Create(); + } + else + { + print dol_textishtml($societe->note)?$societe->note:dol_nl2br($societe->note,1,true); + } + print ""; - if ($action == 'edit') - { - print ''; - } + if ($action == 'edit') + { + print ''; + } - print "
'.$langs->trans('ThirdPartyName').''; - print $form->showrefnav($societe,'socid','',($user->societe_id?0:1),'rowid','nom'); - print '
'.$langs->trans('ThirdPartyName').''; + print $form->showrefnav($societe,'socid','',($user->societe_id?0:1),'rowid','nom'); + print '
'.$langs->trans("Note").''; - if ($action == 'edit' && $user->rights->societe->creer) - { - print ""; - print "id."\">"; + print '
'.$langs->trans("Note").''; + if ($action == 'edit' && $user->rights->societe->creer) + { + print ""; + print "id."\">"; - // Editeur wysiwyg - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('note',$societe->note,'',360,'dolibarr_notes','In',true,false,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE,20,70); - $doleditor->Create(); - } - else - { - print dol_textishtml($societe->note)?$societe->note:dol_nl2br($societe->note,1,true); - } - print "
'; + print ''; + print '   '; + print ''; + print '
"; + print ""; - print '
'; + print ''; } print ''; @@ -163,5 +167,5 @@ if ($action != 'edit') $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/13 16:24:57 $ - $Revision: 1.22 $'); ?>