Withdrawals: Visual enhancements

This commit is contained in:
Juanjo Menent 2011-01-04 16:23:18 +00:00
parent 1de93c5876
commit 790bc7b7f3
4 changed files with 75 additions and 10 deletions

View File

@ -48,13 +48,17 @@ class LignePrelevement
*/ */
function LignePrelevement($DB, $user) function LignePrelevement($DB, $user)
{ {
global $conf,$langs;
$this->db = $DB ; $this->db = $DB ;
$this->user = $user; $this->user = $user;
// List of language codes for status // List of language codes for status
/*$this->statuts[0] = "Waiting";
$this->statuts[2] = "Credited"; $langs->load("withdrawals");
$this->statuts[3] = "Refused";*/ $this->statuts[0]=$langs->trans("StatusWaiting");
$this->statuts[2]=$langs->trans("StatusCredited");
$this->statuts[3]=$langs->trans("StatusRefused");
} }
/** /**
@ -106,6 +110,52 @@ class LignePrelevement
return $result; return $result;
} }
/**
* Return status label of object
* @param mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label
*/
function getLibStatut($mode=0)
{
return $this->LibStatut($this->statut,$mode);
}
/**
* Return status label for a status
* @param statut id statut
* @param mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label
*/
function LibStatut($statut,$mode=0)
{
global $langs;
if ($mode == 0)
{
return $langs->trans($this->statuts[$statut]);
}
if ($mode == 1)
{
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut7').' '.$langs->trans($this->statuts[$statut]);
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0');
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4');
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut7');
}
if ($mode == 3)
{
if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0');
if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4');
if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut7');
}
}
} }
?> ?>

View File

@ -93,9 +93,9 @@ if ($_GET["id"])
{ {
$lipre = new LignePrelevement($db, $user); $lipre = new LignePrelevement($db, $user);
$lipre->statuts[0] = $langs->trans("StatusWaiting"); //$lipre->statuts[0] = $langs->trans("StatusWaiting");
$lipre->statuts[2] = $langs->trans("StatusCredited"); //$lipre->statuts[2] = $langs->trans("StatusCredited");
$lipre->statuts[3] = $langs->trans("StatusRefused"); //$lipre->statuts[3] = $langs->trans("StatusRefused");
if ($lipre->fetch($_GET["id"]) == 0) if ($lipre->fetch($_GET["id"]) == 0)
{ {

View File

@ -128,8 +128,13 @@ if ($result)
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
print "<tr $bc[$var]><td>"; print "<tr $bc[$var]><td>";
if ($obj->statut==0) print img_picto($langs->trans("StatusWaiting"),'statut0');
if ($obj->statut==2) print img_picto($langs->trans("StatusCredited"),'statut4');
if ($obj->statut==3) print img_picto($langs->trans("StatusRefused"),'statut7');
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a>&nbsp;'; print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">'; print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print substr('000000'.$obj->rowid, -6); print substr('000000'.$obj->rowid, -6);
print '</a></td>'; print '</a></td>';
@ -142,7 +147,7 @@ if ($result)
if ($obj->statut == 3) if ($obj->statut == 3)
{ {
print '<b>Rejet<EFBFBD></b>'; print '<b>'.$langs->trans("StatusRefused").'</b>';
} }
else else
{ {

View File

@ -131,12 +131,22 @@ if ($result)
print "<tr $bc[$var]><td>"; print "<tr $bc[$var]><td>";
print '<img border="0" src="./img/statut'.$obj->statut_ligne.'.png"></a>&nbsp;'; if ($obj->statut_ligne==0) print img_picto($langs->trans("StatusWaiting"),'statut0');
if ($obj->statut_ligne==2) print img_picto($langs->trans("StatusCredited"),'statut4');
if ($obj->statut_ligne==3) print img_picto($langs->trans("StatusRefused"),'statut7');
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid_ligne.'">'; print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6); print substr('000000'.$obj->rowid_ligne, -6);
print '</a></td>'; print '</a></td>';
print '<td><img border="0" src="./img/statut'.$obj->statut.'.png"></a>&nbsp;'; print '<td>';
if ($obj->statut==0) print img_picto($langs->trans("StatusWaiting"),'statut0');
if ($obj->statut==1) print img_picto($langs->trans("StatusTrans"),'statut1');
if ($obj->statut==2) print img_picto($langs->trans("StatusCredited"),'statut4');
print "&nbsp;";
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n"; print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'; print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">';