Fix: Missing status "refunded".

Fix: translation
This commit is contained in:
Laurent Destailleur 2014-09-06 17:16:24 +02:00
parent 91a894f459
commit bc7d839c64
4 changed files with 52 additions and 13 deletions

View File

@ -64,8 +64,8 @@ class Deplacement extends CommonObject
{ {
$this->db = $db; $this->db = $db;
$this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); $this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded');
$this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); $this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Refunded');
return 1; return 1;
} }
@ -132,9 +132,9 @@ class Deplacement extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
// End call triggers // End call triggers
$result=$this->update($user); $result=$this->update($user);
if ($result > 0) if ($result > 0)
{ {
@ -321,21 +321,25 @@ class Deplacement extends CommonObject
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
} }
if ($mode == 3) if ($mode == 3)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
} }
if ($mode == 4) if ($mode == 4)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
} }
if ($mode == 5) if ($mode == 5)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
} }
} }

View File

@ -76,6 +76,24 @@ if ($action == 'validate' && $user->rights->deplacement->creer)
} }
} }
else if ($action == 'classifyrefunded' && $user->rights->deplacement->creer)
{
$object->fetch($id);
if ($object->statut == 1)
{
$result = $object->setStatut(2);
if ($result > 0)
{
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
}
else
{
setEventMessage($object->error, 'errors');
}
}
}
else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer)
{ {
$result=$object->delete($id); $result=$object->delete($id);
@ -491,11 +509,23 @@ else if ($id)
/* /*
* Barre d'actions * Barre d'actions
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($object->statut == 0) // if blocked... if ($object->statut < 2) // if not refunded
{
if ($user->rights->deplacement->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
}
}
if ($object->statut == 0) // if draft
{ {
if ($user->rights->deplacement->creer) if ($user->rights->deplacement->creer)
{ {
@ -507,14 +537,18 @@ else if ($id)
} }
} }
if ($user->rights->deplacement->creer) if ($object->statut == 1) // if validated
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>'; if ($user->rights->deplacement->creer)
} {
else print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>';
{ }
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>'; else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
}
} }
if ($user->rights->deplacement->supprimer) if ($user->rights->deplacement->supprimer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';

View File

@ -219,7 +219,7 @@ $filter='';
print $form->select_company($socid,'socid',$filter,1,1); print $form->select_company($socid,'socid',$filter,1,1);
print '</td></tr>'; print '</td></tr>';
// User // User
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>'; print '<tr><td>'.$langs->trans("User").'</td><td>';
print $form->select_dolusers($userid,'userid',1); print $form->select_dolusers($userid,'userid',1);
print '</td></tr>'; print '</td></tr>';
// Year // Year

View File

@ -19,3 +19,4 @@ TF_TRIP=Trip
ListTripsAndExpenses=List of trips and expenses ListTripsAndExpenses=List of trips and expenses
ExpensesArea=Trips and expenses area ExpensesArea=Trips and expenses area
SearchATripAndExpense=Search a trip and expense SearchATripAndExpense=Search a trip and expense
ClassifyRefunded=Classify 'Refunded'