From e684c1c4504d920b4db4f3b8c668bd2b102ff534 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 12:11:29 +0100 Subject: [PATCH] Look and feel v11 --- .../class/expensereport.class.php | 31 ++------ htdocs/holiday/class/holiday.class.php | 78 ++++++------------- htdocs/hrm/index.php | 76 +----------------- 3 files changed, 34 insertions(+), 151 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 485373c5840..52072b63578 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -101,9 +101,6 @@ class ExpenseReport extends CommonObject // Paiement public $user_paid_infos; - /* - END ACTIONS - */ /** * Draft status @@ -198,7 +195,7 @@ class ExpenseReport extends CommonObject // List of language codes for status $this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); $this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut5'); + $this->statuts_logo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); } /** @@ -683,29 +680,15 @@ class ExpenseReport extends CommonObject */ public function LibStatut($status, $mode = 0) { - // phpcs:enable - global $langs; + // phpcs:enable + global $langs; - if ($mode == 0) - return $langs->transnoentities($this->statuts[$status]); + $labelstatus = $langs->trans($this->statuts[$status]); + $labelstatusshort = $langs->trans($this->statuts_short[$status]); - elseif ($mode == 1) - return $langs->transnoentities($this->statuts_short[$status]); + $statusType = $this->statuts_logo[$status]; - elseif ($mode == 2) - return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]); - - elseif ($mode == 3) - return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); - - elseif ($mode == 4) - return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]); - - elseif ($mode == 5) - return ''.$langs->transnoentities($this->statuts_short[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); - - elseif ($mode == 6) - return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); + return dolGetStatus($labelstatus, $labelstatusshort, '', $statusType, $mode); } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 0eb02e006e5..8fe5f0570fe 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1217,68 +1217,40 @@ class Holiday extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Returns the label of a statut + * Returns the label of a status * - * @param int $statut id statut + * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param integer $startdate Date holiday should start * @return string Label */ - public function LibStatut($statut, $mode = 0, $startdate = '') + public function LibStatut($status, $mode = 0, $startdate = '') { - // phpcs:enable - global $langs; - - if ($mode == 0) + // phpcs:enable + if (empty($this->labelstatus) || empty($this->labelstatusshort)) { - if ($statut == 1) return $langs->trans('DraftCP'); - elseif ($statut == 2) return $langs->trans('ToReviewCP'); - elseif ($statut == 3) return $langs->trans('ApprovedCP'); - elseif ($statut == 4) return $langs->trans('CancelCP'); - elseif ($statut == 5) return $langs->trans('RefuseCP'); - } - elseif ($mode == 2) - { - $pictoapproved='statut6'; - if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; - if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0').' '.$langs->trans('DraftCP'); // Draft - elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1').' '.$langs->trans('ToReviewCP'); // Waiting approval - elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved).' '.$langs->trans('ApprovedCP'); - elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5').' '.$langs->trans('CancelCP'); - elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5').' '.$langs->trans('RefuseCP'); - } - elseif ($mode == 3) - { - $pictoapproved='statut6'; - if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; - if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0'); - elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1'); - elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved); - elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5'); - elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5'); - } - elseif ($mode == 5) - { - $pictoapproved='statut6'; - if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; - if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft - elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval - elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved); - elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5'); - elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5'); - } - elseif ($mode == 6) - { - $pictoapproved='statut6'; - if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; - if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft - elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval - elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved); - elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5'); - elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5'); + global $langs; + //$langs->load("mymodule"); + $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('DraftCP'); + $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP'); + $this->labelstatus[self::STATUS_APPROVED] = $langs->trans('ApprovedCP'); + $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('CancelCP'); + $this->labelstatus[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); + $this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('DraftCP'); + $this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP'); + $this->labelstatusshort[self::STATUS_APPROVED] = $langs->trans('ApprovedCP'); + $this->labelstatusshort[self::STATUS_CANCELED] = $langs->trans('CancelCP'); + $this->labelstatusshort[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); } - else return $statut; + $statusType = 'status6'; + if (! empty($startdate) && $startdate > dol_now()) $statusType = 'status4'; + if ($status == self::STATUS_DRAFT) $statusType = 'status0'; + if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; + if ($status == self::STATUS_CANCELED) $statusType = 'status5'; + if ($status == self::STATUS_REFUSED) $statusType = 'status5'; + + return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); } diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 9d9d2fcd632..9fa758f8338 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -248,84 +248,13 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) } print ''; print ''; + print '
'; } else dol_print_error($db); } -// Last expense report (old module) -if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) -{ - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; - $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE u.rowid = d.fk_user"; - $sql.= " AND d.entity = ".$conf->entity; - if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')'; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid; - $sql.= $db->order("d.tms", "DESC"); - $sql.= $db->plimit($max, 0); - - $result = $db->query($sql); - if ($result) - { - $var=false; - $num = $db->num_rows($result); - - $i = 0; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($num) - { - $total_ttc = $totalam = $total = 0; - - $deplacementstatic=new Deplacement($db); - $userstatic=new User($db); - while ($i < $num && $i < $max) - { - $obj = $db->fetch_object($result); - - $deplacementstatic->ref=$obj->rowid; - $deplacementstatic->id=$obj->rowid; - - $userstatic->id=$obj->uid; - $userstatic->lastname=$obj->lastname; - $userstatic->firstname=$obj->firstname; - $userstatic->login=$obj->login; - $userstatic->email=$obj->email; - $userstatic->statut=$obj->statut; - $userstatic->photo=$obj->photo; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $i++; - } - } - else - { - print ''; - } - print '
'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").' 
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.$obj->km.''.dol_print_date($db->jdate($obj->dm), 'day').''.$deplacementstatic->LibStatut($obj->fk_statut, 3).'
'.$langs->trans("None").'
'; - print '
'; - } - else dol_print_error($db); -} - -// Last expense report (new module) +// Latest expense report if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; @@ -342,7 +271,6 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire $result = $db->query($sql); if ($result) { - $var=false; $num = $db->num_rows($result); $i = 0;