Fix: optimize code
This commit is contained in:
parent
ea94610492
commit
832b78911c
@ -1,22 +1,22 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
* (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/>.
|
||||
*/
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
* (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/comm/action/class/actioncomm.class.php
|
||||
@ -626,52 +626,52 @@ class ActionComm extends CommonObject
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
|
||||
if ($percent==0) return $langs->trans('StatusActionToDo').' (0%)';
|
||||
if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)';
|
||||
if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)';
|
||||
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
|
||||
else if ($percent==0) return $langs->trans('StatusActionToDo').' (0%)';
|
||||
else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)';
|
||||
else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)';
|
||||
}
|
||||
if ($mode == 1)
|
||||
else if ($mode == 1)
|
||||
{
|
||||
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
|
||||
if ($percent==0) return $langs->trans('StatusActionToDo');
|
||||
if ($percent > 0 && $percent < 100) return $percent.'%';
|
||||
if ($percent >= 100) return $langs->trans('StatusActionDone');
|
||||
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
|
||||
else if ($percent==0) return $langs->trans('StatusActionToDo');
|
||||
else if ($percent > 0 && $percent < 100) return $percent.'%';
|
||||
else if ($percent >= 100) return $langs->trans('StatusActionDone');
|
||||
}
|
||||
if ($mode == 2)
|
||||
else if ($mode == 2)
|
||||
{
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable');
|
||||
if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo');
|
||||
if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '. $percent.'%';
|
||||
if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone');
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable');
|
||||
else if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo');
|
||||
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '. $percent.'%';
|
||||
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone');
|
||||
}
|
||||
if ($mode == 3)
|
||||
else if ($mode == 3)
|
||||
{
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans("Status").': '.$langs->trans('StatusNotApplicable'),'statut9');
|
||||
if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1');
|
||||
if ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3');
|
||||
if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6');
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans("Status").': '.$langs->trans('StatusNotApplicable'),'statut9');
|
||||
else if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1');
|
||||
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3');
|
||||
else if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
else if ($mode == 4)
|
||||
{
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable');
|
||||
if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo').' (0%)';
|
||||
if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)';;
|
||||
if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone').' (100%)';
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable');
|
||||
else if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo').' (0%)';
|
||||
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)';
|
||||
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone').' (100%)';
|
||||
}
|
||||
if ($mode == 5)
|
||||
else if ($mode == 5)
|
||||
{
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9');
|
||||
if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1');
|
||||
if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
|
||||
if ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6');
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9');
|
||||
else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1');
|
||||
else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
|
||||
else if ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6');
|
||||
}
|
||||
if ($mode == 6)
|
||||
else if ($mode == 6)
|
||||
{
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9');
|
||||
if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1');
|
||||
if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
|
||||
if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6');
|
||||
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9');
|
||||
else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1');
|
||||
else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
|
||||
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user