Fix: Removed a conception error reported by eclipse validators.

This commit is contained in:
Laurent Destailleur 2011-07-08 13:07:44 +00:00
parent fa2eb71b14
commit 6ffc8e9786
6 changed files with 57 additions and 47 deletions

View File

@ -21,7 +21,7 @@
* \file htdocs/contact/canvas/default/actions_contactcard_default.class.php * \file htdocs/contact/canvas/default/actions_contactcard_default.class.php
* \ingroup thirdparty * \ingroup thirdparty
* \brief Fichier de la classe Thirdparty contact card controller (default canvas) * \brief Fichier de la classe Thirdparty contact card controller (default canvas)
* \version $Id$ * \version $Id: actions_contactcard_default.class.php,v 1.9 2011/07/08 13:07:45 eldy Exp $
*/ */
include_once(DOL_DOCUMENT_ROOT.'/contact/canvas/actions_contactcard_common.class.php'); include_once(DOL_DOCUMENT_ROOT.'/contact/canvas/actions_contactcard_common.class.php');
@ -70,17 +70,6 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
return parent::getTitle($action); return parent::getTitle($action);
} }
/**
* Return the head of card (tabs)
*/
function showHead($action)
{
$head = contact_prepare_head($this->object);
$title = $this->getTitle($action);
return dol_fiche_head($head, 'card', $title, 0, 'contact');
}
/** /**
* Assigne les valeurs POST dans l'objet * Assigne les valeurs POST dans l'objet
*/ */
@ -107,7 +96,11 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
if ($action == 'view') if ($action == 'view')
{ {
// Card header // Card header
$this->tpl['showhead']=$this->showHead($action); $head = contact_prepare_head($this->object);
$title = $this->getTitle($action);
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'contact');
$this->tpl['showend']=dol_get_fiche_end();
// Confirm delete contact // Confirm delete contact
if ($user->rights->societe->contact->supprimer) if ($user->rights->societe->contact->supprimer)
@ -121,9 +114,9 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->fetch($this->object->fk_soc); $objsoc->fetch($this->object->fk_soc);
$this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->control->object,1); $this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1);
$this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->control->object,1); $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1);
} }
} }

View File

@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id: contactcard_view.tpl.php,v 1.9 2011/07/08 13:07:45 eldy Exp $
*/ */
$contact = $GLOBALS['objcanvas']->control->object; $contact = $GLOBALS['objcanvas']->control->object;
@ -23,6 +23,7 @@ $contact = $GLOBALS['objcanvas']->control->object;
?> ?>
<!-- BEGIN PHP TEMPLATE CONTACTCARD_VIEW.TPL.PHP DEFAULT --> <!-- BEGIN PHP TEMPLATE CONTACTCARD_VIEW.TPL.PHP DEFAULT -->
<?php echo $this->control->tpl['showhead']; ?>
<?php <?php
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
@ -134,7 +135,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
</table> </table>
</div> <?php echo $this->control->tpl['showend']; ?>
<?php if (! $user->societe_id) { ?> <?php if (! $user->societe_id) { ?>
<div class="tabsAction"> <div class="tabsAction">

View File

@ -15,12 +15,12 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id: ajaxfileupload.tpl.php,v 1.7 2011/07/05 22:40:35 eldy Exp $ * $Id: ajaxfileupload.tpl.php,v 1.8 2011/07/08 13:07:45 eldy Exp $
*/ */
?> ?>
<!-- START TEMPLATE FILE UPLOAD --> <!-- START TEMPLATE FILE UPLOAD -->
<script id="template-upload" type="text/x-jquery-tmpl"> <script type="text/x-jquery-tmpl">
<tr class="template-upload{{if error}} ui-state-error{{/if}}"> <tr class="template-upload{{if error}} ui-state-error{{/if}}">
<td class="name">${name}</td> <td class="name">${name}</td>
<td class="preview"></td> <td class="preview"></td>

View File

@ -29,7 +29,7 @@
* \file htdocs/lib/functions.lib.php * \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr * \brief A set of functions for Dolibarr
* This file contains all frequently used functions. * This file contains all frequently used functions.
* \version $Id: functions.lib.php,v 1.544 2011/07/07 22:19:53 eldy Exp $ * \version $Id: functions.lib.php,v 1.545 2011/07/08 13:07:44 eldy Exp $
*/ */
// For compatibility during upgrade // For compatibility during upgrade
@ -460,12 +460,6 @@ function dol_syslog($message, $level=LOG_INFO)
} }
/* For backward compatibility */
function dolibarr_fiche_head($links, $active='0', $title='', $notab=0)
{
return dol_fiche_head($links, $active, $title, $notab);
}
/** /**
* Show tab header of a card * Show tab header of a card
* @param links Array of tabs * @param links Array of tabs
@ -476,16 +470,29 @@ function dolibarr_fiche_head($links, $active='0', $title='', $notab=0)
*/ */
function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='') function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='')
{ {
print "\n".'<div class="tabs">'."\n"; print dol_get_fiche_head($links, $active, $title, $notab, $picto);
}
/**
* Show tab header of a card
* @param links Array of tabs
* @param active Active tab name
* @param title Title
* @param notab 0=Add tab header, 1=no tab header
* @param picto Add a picto on tab title
*/
function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='')
{
$out="\n".'<div class="tabs">'."\n";
// Affichage titre // Affichage titre
if ($title) if ($title)
{ {
$limittitle=30; $limittitle=30;
print '<a class="tabTitle">'; $out.='<a class="tabTitle">';
if ($picto) print img_object('',$picto).' '; if ($picto) $out.=img_object('',$picto).' ';
print dol_trunc($title,$limittitle); $out.=dol_trunc($title,$limittitle);
print '</a>'; $out.='</a>';
} }
// Define max of key (max may be higher than sizeof because of hole due to module disabling some tabs). // Define max of key (max may be higher than sizeof because of hole due to module disabling some tabs).
@ -503,11 +510,11 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
{ {
if (!empty($links[$i][0])) if (!empty($links[$i][0]))
{ {
print '<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; $out.='<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
} }
else else
{ {
print '<span class="tabspan">'.$links[$i][1].'</span>'."\n"; $out.='<span class="tabspan">'.$links[$i][1].'</span>'."\n";
} }
} }
else if (! empty($links[$i][1])) else if (! empty($links[$i][1]))
@ -516,27 +523,39 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
if ((is_numeric($active) && $i == $active) if ((is_numeric($active) && $i == $active)
|| (! is_numeric($active) && $active == $links[$i][2])) || (! is_numeric($active) && $active == $links[$i][2]))
{ {
print '<a id="active" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; $out.='<a id="active" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
} }
else else
{ {
print '<a id="'.$links[$i][2].'" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; $out.='<a id="'.$links[$i][2].'" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
} }
} }
} }
print "</div>\n"; $out.="</div>\n";
if (! $notab) print "\n".'<div class="tabBar">'."\n"; if (! $notab) $out.="\n".'<div class="tabBar">'."\n";
return $out;
} }
/** /**
* Show tab footer of a card * Show tab footer of a card
* @param notab 0=Add tab footer, 1=no tab footer * @param notab 0=Add tab footer, 1=no tab footer
*/ */
function dol_fiche_end($notab=0) function dol_fiche_end($notab=0)
{ {
if (! $notab) print "\n</div>\n"; print dol_get_fiche_end($notab);
}
/**
* Return tab footer of a card
* @param notab 0=Add tab footer, 1=no tab footer
*/
function dol_get_fiche_end($notab=0)
{
if (! $notab) return "\n</div>\n";
else return '';
} }

View File

@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id: view.tpl.php,v 1.5 2011/07/08 13:11:07 eldy Exp $
*/ */
?> ?>
@ -96,6 +96,5 @@
</tr> </tr>
</table> </table>
</div>
<!-- END PHP TEMPLATE --> <!-- END PHP TEMPLATE -->

View File

@ -21,7 +21,7 @@
* \file htdocs/societe/canvas/actions_card_common.class.php * \file htdocs/societe/canvas/actions_card_common.class.php
* \ingroup thirdparty * \ingroup thirdparty
* \brief Fichier de la classe Thirdparty card controller (common) * \brief Fichier de la classe Thirdparty card controller (common)
* \version $Id: actions_card_common.class.php,v 1.22 2011/06/30 13:25:32 hregis Exp $ * \version $Id: actions_card_common.class.php,v 1.23 2011/07/08 13:07:45 eldy Exp $
*/ */
/** /**
@ -535,13 +535,11 @@ class ActionsCardCommon
} }
else else
{ {
/* TODO dol_fiche_head and dol_fiche_end must return a string and not do a print
$head = societe_prepare_head($this->object); $head = societe_prepare_head($this->object);
$title = $this->getTitle($action); $title = $this->getTitle($action);
$this->tpl['showhead']=dol_fiche_head($head, 'card', $title, 0, 'company'); $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'company');
$this->tpl['showend']=dol_fiche_end(); $this->tpl['showend']=dol_get_fiche_end();
*/
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom'); $this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom');