Look and feel v11

This commit is contained in:
Laurent Destailleur 2019-11-01 12:11:29 +01:00
parent 01ac313a87
commit e684c1c450
3 changed files with 34 additions and 151 deletions

View File

@ -101,9 +101,6 @@ class ExpenseReport extends CommonObject
// Paiement // Paiement
public $user_paid_infos; public $user_paid_infos;
/*
END ACTIONS
*/
/** /**
* Draft status * Draft status
@ -198,7 +195,7 @@ class ExpenseReport extends CommonObject
// List of language codes for status // List of language codes for status
$this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); $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 = 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) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
if ($mode == 0) $labelstatus = $langs->trans($this->statuts[$status]);
return $langs->transnoentities($this->statuts[$status]); $labelstatusshort = $langs->trans($this->statuts_short[$status]);
elseif ($mode == 1) $statusType = $this->statuts_logo[$status];
return $langs->transnoentities($this->statuts_short[$status]);
elseif ($mode == 2) return dolGetStatus($labelstatus, $labelstatusshort, '', $statusType, $mode);
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 '<span class="hideonsmartphone">'.$langs->transnoentities($this->statuts_short[$status]).' </span>'.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]);
} }

View File

@ -1217,68 +1217,40 @@ class Holiday extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // 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 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 * @param integer $startdate Date holiday should start
* @return string Label * @return string Label
*/ */
public function LibStatut($statut, $mode = 0, $startdate = '') public function LibStatut($status, $mode = 0, $startdate = '')
{ {
// phpcs:enable // phpcs:enable
global $langs; if (empty($this->labelstatus) || empty($this->labelstatusshort))
if ($mode == 0)
{ {
if ($statut == 1) return $langs->trans('DraftCP'); global $langs;
elseif ($statut == 2) return $langs->trans('ToReviewCP'); //$langs->load("mymodule");
elseif ($statut == 3) return $langs->trans('ApprovedCP'); $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('DraftCP');
elseif ($statut == 4) return $langs->trans('CancelCP'); $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP');
elseif ($statut == 5) return $langs->trans('RefuseCP'); $this->labelstatus[self::STATUS_APPROVED] = $langs->trans('ApprovedCP');
} $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('CancelCP');
elseif ($mode == 2) $this->labelstatus[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
{ $this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('DraftCP');
$pictoapproved='statut6'; $this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP');
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; $this->labelstatusshort[self::STATUS_APPROVED] = $langs->trans('ApprovedCP');
if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0').' '.$langs->trans('DraftCP'); // Draft $this->labelstatusshort[self::STATUS_CANCELED] = $langs->trans('CancelCP');
elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1').' '.$langs->trans('ToReviewCP'); // Waiting approval $this->labelstatusshort[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
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');
} }
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);
} }

View File

@ -248,84 +248,13 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<br>';
} }
else dol_print_error($db); else dol_print_error($db);
} }
// Last expense report (old module) // Latest expense report
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 '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).'</th>';
print '<th class="right">'.$langs->trans("FeesKilometersOrAmout").'</th>';
print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
print '<th width="16">&nbsp;</th>';
print '</tr>';
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 '<tr class="oddeven">';
print '<td class="nowraponall">'.$deplacementstatic->getNomUrl(1).'</td>';
print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).'</td>';
print '<td class="right">'.$obj->km.'</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>';
print '<td>'.$deplacementstatic->LibStatut($obj->fk_statut, 3).'</td>';
print '</tr>';
$i++;
}
}
else
{
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
print '</div>';
}
else dol_print_error($db);
}
// Last expense report (new module)
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) 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"; $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); $result = $db->query($sql);
if ($result) if ($result)
{ {
$var=false;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;