diff --git a/dev/codesniffer/README b/dev/codesniffer/README index d2c4ece7d63..b06a2b1e5f6 100755 --- a/dev/codesniffer/README +++ b/dev/codesniffer/README @@ -2,4 +2,8 @@ README (English) -------------------------------- This directory contains ruleset files to use to -develop Dolibarr EPR & CRM with Eclipse. \ No newline at end of file +develop Dolibarr EPR & CRM with Eclipse. + +Note: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: +* tab value to 4 +* path of code sniffer standard to dev/codesniffer \ No newline at end of file diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index 995fa21af76..e5ed939779a 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent - * + * * 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 2 of the License, or @@ -28,7 +28,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); $langs->load("admin"); if (!$user->admin) - accessforbidden(); +accessforbidden(); $action=GETPOST("action"); @@ -36,18 +36,18 @@ if ($action == 'setvalue') { $showmenu = GETPOST("BOOKMARKS_SHOW_IN_MENU"); $res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU",$showmenu,'chaine',0,'',$conf->entity); - + if (! $res > 0) $error++; - + if (! $error) - { - $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $db->rollback(); - $mesg = "".$langs->trans("Error").""; + { + $db->commit(); + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $db->rollback(); + $mesg = "".$langs->trans("Error").""; } } diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 30fa7e774ed..f047be2349f 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -24,11 +24,11 @@ /** * Add area with bookmarks in menu * - * @param DoliDb $aDb Database handler + * @param DoliDb $aDb Database handler * @param Translate $aLangs Object lang * @return string */ -function printBookmarksList ($aDb, $aLangs) +function printBookmarksList($aDb, $aLangs) { global $conf, $user; diff --git a/htdocs/bookmarks/fiche.php b/htdocs/bookmarks/fiche.php index f501e942fd3..9a5243feeaa 100644 --- a/htdocs/bookmarks/fiche.php +++ b/htdocs/bookmarks/fiche.php @@ -45,76 +45,76 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') if ($_POST["cancel"]) { $urlsource=(! empty($_REQUEST["urlsource"]))?$_REQUEST["urlsource"]:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/liste.php'); - header("Location: ".$urlsource); - exit; + header("Location: ".$urlsource); + exit; } - $mesg=''; + $mesg=''; - $bookmark=new Bookmark($db); - if ($action == 'update') $bookmark->fetch($_POST["id"]); - $bookmark->fk_user=$userid; - $bookmark->title=$title; - $bookmark->url=$url; - $bookmark->target=$target; - $bookmark->position=$position; + $bookmark=new Bookmark($db); + if ($action == 'update') $bookmark->fetch($_POST["id"]); + $bookmark->fk_user=$userid; + $bookmark->title=$title; + $bookmark->url=$url; + $bookmark->target=$target; + $bookmark->position=$position; - if (! $title) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle")); - if (! $url) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink")); + if (! $title) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle")); + if (! $url) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink")); - if (! $mesg) - { - $bookmark->favicon='none'; + if (! $mesg) + { + $bookmark->favicon='none'; - if ($action == 'update') $res=$bookmark->update(); - else $res=$bookmark->create(); + if ($action == 'update') $res=$bookmark->update(); + else $res=$bookmark->create(); - if ($res > 0) - { + if ($res > 0) + { $urlsource=! empty($_REQUEST["urlsource"])?urldecode($_REQUEST["urlsource"]):DOL_URL_ROOT.'/bookmarks/liste.php'; - header("Location: ".$urlsource); - exit; - } - else - { - if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - $langs->load("errors"); - $mesg='
'.$langs->trans("WarningBookmarkAlreadyExists").'
'; - } - else - { - $mesg='
'.$bookmark->error.'
'; - } - $action='create'; - } - } - else - { - $mesg='
'.$mesg.'
'; - $action='create'; - } + header("Location: ".$urlsource); + exit; + } + else + { + if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $langs->load("errors"); + $mesg='
'.$langs->trans("WarningBookmarkAlreadyExists").'
'; + } + else + { + $mesg='
'.$bookmark->error.'
'; + } + $action='create'; + } + } + else + { + $mesg='
'.$mesg.'
'; + $action='create'; + } } if ($_GET["action"] == 'delete') { - $bookmark=new Bookmark($db); - $bookmark->id=$_GET["bid"]; - $bookmark->url=$user->id; - $bookmark->target=$user->id; - $bookmark->title='xxx'; - $bookmark->favicon='xxx'; + $bookmark=new Bookmark($db); + $bookmark->id=$_GET["bid"]; + $bookmark->url=$user->id; + $bookmark->target=$user->id; + $bookmark->title='xxx'; + $bookmark->favicon='xxx'; - $res=$bookmark->remove(); - if ($res > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - $mesg='
'.$bookmark->error.'
'; - } + $res=$bookmark->remove(); + if ($res > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + $mesg='
'.$bookmark->error.'
'; + } } @@ -129,154 +129,154 @@ $html=new Form($db); if ($action == 'create') { - /* - * Fact bookmark creation mode - */ + /* + * Fact bookmark creation mode + */ - print '
'."\n"; - print ''; - print ''; + print ''."\n"; + print ''; + print ''; - print_fiche_titre($langs->trans("NewBookmark")); + print_fiche_titre($langs->trans("NewBookmark")); - if ($mesg) print "$mesg
"; + if ($mesg) print "$mesg
"; - print ''; + print '
'; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - // Position - print ''; + // Position + print ''; - print ''; + print ''; - print '
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("UrlOrLink").''.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'
'.$langs->trans("UrlOrLink").''.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'
'.$langs->trans("BehaviourOnClick").''; - $liste=array(0=>$langs->trans("ReplaceWindow"),1=>$langs->trans("OpenANewWindow")); - print $html->selectarray('target',$liste,1); - print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'
'.$langs->trans("BehaviourOnClick").''; + $liste=array(0=>$langs->trans("ReplaceWindow"),1=>$langs->trans("OpenANewWindow")); + print $html->selectarray('target',$liste,1); + print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'
'.$langs->trans("Owner").''; - $html->select_users(isset($_POST['userid'])?$_POST['userid']:$user->id,'userid',1); - print ' 
'.$langs->trans("Owner").''; + $html->select_users(isset($_POST['userid'])?$_POST['userid']:$user->id,'userid',1); + print ' 
'.$langs->trans("Position").''; - print 'position).'">'; - print '
'.$langs->trans("Position").''; + print 'position).'">'; + print '
'; - print '   '; - print ''; - print '
'; + print '   '; + print ''; + print '
'; + print ''; - print '
'; + print ''; } if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"])) { - /* - * Fact bookmark mode or visually edition - */ - $bookmark=new Bookmark($db); - $bookmark->fetch($_GET["id"]); + /* + * Fact bookmark mode or visually edition + */ + $bookmark=new Bookmark($db); + $bookmark->fetch($_GET["id"]); - dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); + dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); - if ($_GET["action"] == 'edit') - { - print '
'; - print ''; - print ''; - print ''; - print ''; - } + if ($_GET["action"] == 'edit') + { + print ''; + print ''; + print ''; + print ''; + print ''; + } - print ''; + print '
'; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + } + print ''; - // Position - print ''; + // Position + print ''; - // Date creation - print ''; + // Date creation + print ''; - if ($_GET["action"] == 'edit') print ''; + if ($_GET["action"] == 'edit') print ''; - print '
'.$langs->trans("Ref").''.$bookmark->ref.'
'.$langs->trans("Ref").''.$bookmark->ref.'
'.$langs->trans("BookmarkTitle").''; - if ($_GET["action"] == 'edit') print 'title).'">'; - else print $bookmark->title; - print '
'.$langs->trans("BookmarkTitle").''; + if ($_GET["action"] == 'edit') print 'title).'">'; + else print $bookmark->title; + print '
'.$langs->trans("UrlOrLink").''; - if ($_GET["action"] == 'edit') print 'url).'">'; - else print 'target?' target="_blank"':'').'>'.$bookmark->url.''; - print '
'.$langs->trans("UrlOrLink").''; + if ($_GET["action"] == 'edit') print 'url).'">'; + else print 'target?' target="_blank"':'').'>'.$bookmark->url.''; + print '
'.$langs->trans("BehaviourOnClick").''; - if ($_GET["action"] == 'edit') - { - $liste=array(1=>$langs->trans("OpenANewWindow"),0=>$langs->trans("ReplaceWindow")); - print $html->selectarray('target',$liste,isset($_POST["target"])?$_POST["target"]:$bookmark->target); - } - else - { - if ($bookmark->target == 0) print $langs->trans("ReplaceWindow"); - if ($bookmark->target == 1) print $langs->trans("OpenANewWindow"); - } - print '
'.$langs->trans("BehaviourOnClick").''; + if ($_GET["action"] == 'edit') + { + $liste=array(1=>$langs->trans("OpenANewWindow"),0=>$langs->trans("ReplaceWindow")); + print $html->selectarray('target',$liste,isset($_POST["target"])?$_POST["target"]:$bookmark->target); + } + else + { + if ($bookmark->target == 0) print $langs->trans("ReplaceWindow"); + if ($bookmark->target == 1) print $langs->trans("OpenANewWindow"); + } + print '
'.$langs->trans("Owner").''; - if ($_GET["action"] == 'edit' && $user->admin) - { - $html->select_users(isset($_POST['userid'])?$_POST['userid']:($bookmark->fk_user?$bookmark->fk_user:''),'userid',1); - } - else - { - if ($bookmark->fk_user) - { - $fuser=new User($db); - $fuser->fetch($bookmark->fk_user); - //$fuser->nom=$fuser->login; $fuser->prenom=''; - print $fuser->getNomUrl(1); + print '
'.$langs->trans("Owner").''; + if ($_GET["action"] == 'edit' && $user->admin) + { + $html->select_users(isset($_POST['userid'])?$_POST['userid']:($bookmark->fk_user?$bookmark->fk_user:''),'userid',1); + } + else + { + if ($bookmark->fk_user) + { + $fuser=new User($db); + $fuser->fetch($bookmark->fk_user); + //$fuser->nom=$fuser->login; $fuser->prenom=''; + print $fuser->getNomUrl(1); } else { print $langs->trans("Public"); } - } - print '
'.$langs->trans("Position").''; - if ($_GET["action"] == 'edit') print 'position).'">'; - else print $bookmark->position; - print '
'.$langs->trans("Position").''; + if ($_GET["action"] == 'edit') print 'position).'">'; + else print $bookmark->position; + print '
'.$langs->trans("DateCreation").''.dol_print_date($bookmark->datec,'dayhour').'
'.$langs->trans("DateCreation").''.dol_print_date($bookmark->datec,'dayhour').'
   
   
'; + print ''; - if ($_GET["action"] == 'edit') print '
'; + if ($_GET["action"] == 'edit') print ''; - print "\n"; + print "\n"; - print "
\n"; + print "
\n"; - // Edit - if ($user->rights->bookmark->creer && $_GET["action"] != 'edit') - { - print " id."&action=edit\">".$langs->trans("Edit")."\n"; - } + // Edit + if ($user->rights->bookmark->creer && $_GET["action"] != 'edit') + { + print " id."&action=edit\">".$langs->trans("Edit")."\n"; + } - // Remove - if ($user->rights->bookmark->supprimer && $_GET["action"] != 'edit') - { - print " id."&action=delete\">".$langs->trans("Delete")."\n"; - } + // Remove + if ($user->rights->bookmark->supprimer && $_GET["action"] != 'edit') + { + print " id."&action=delete\">".$langs->trans("Delete")."\n"; + } - print '
'; + print '
'; }