Merge pull request #9491 from frederic34/patch-11

reduce complexity of libstatut expedition.class.php
This commit is contained in:
Laurent Destailleur 2018-09-16 08:56:02 +02:00 committed by GitHub
commit 39419367b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,8 @@
* Copyright (C) 2014-2017 Francis Appels <francis.appels@yahoo.com> * Copyright (C) 2014-2017 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop> * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1623,32 +1624,32 @@ class Expedition extends CommonObject
if ($mode==0) if ($mode==0)
{ {
if ($statut==0) return $langs->trans($this->statuts[$statut]); if ($statut==0) return $langs->trans($this->statuts[$statut]);
if ($statut==1) return $langs->trans($this->statuts[$statut]); elseif ($statut==1) return $langs->trans($this->statuts[$statut]);
if ($statut==2) return $langs->trans($this->statuts[$statut]); elseif ($statut==2) return $langs->trans($this->statuts[$statut]);
} }
if ($mode==1) elseif ($mode==1)
{ {
if ($statut==0) return $langs->trans($this->statutshorts[$statut]); if ($statut==0) return $langs->trans($this->statutshorts[$statut]);
if ($statut==1) return $langs->trans($this->statutshorts[$statut]); elseif ($statut==1) return $langs->trans($this->statutshorts[$statut]);
if ($statut==2) return $langs->trans($this->statutshorts[$statut]); elseif ($statut==2) return $langs->trans($this->statutshorts[$statut]);
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0');
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4'); elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4');
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut6'); elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut6');
} }
if ($mode == 4) elseif ($mode == 4)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($statut==0) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut==0) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0');
if ($statut==1) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4'); elseif ($statut==1) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4');
if ($statut==2) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut6'); elseif ($statut==2) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut6');
} }
} }
@ -2264,7 +2265,7 @@ class Expedition extends CommonObject
* @param int $hidedetails Hide details of lines * @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description * @param int $hidedesc Hide description
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @param null|array $moreparams Array to provide more information * @param null|array $moreparams Array to provide more information
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
*/ */
public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0,$moreparams=null) public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0,$moreparams=null)