diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 9eeacee312ca248a5d7f7f24ea025e82b37548cf..4d24aac9a835cafaa92584f0915c63f1ffa35452 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -64,8 +64,8 @@ class Deplacement extends CommonObject { $this->db = $db; - $this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); - $this->statuts = 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 => 'Refunded'); return 1; } @@ -132,9 +132,9 @@ class Deplacement extends CommonObject { $this->db->rollback(); return -2; - } + } // End call triggers - + $result=$this->update($user); 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==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 ($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==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } 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==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 ($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==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } } diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index 9df4bb90652574385458c9ad8f54b14eb2c5dc03..b6bb980c462326727fa6256fc183059b3e957899 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -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) { $result=$object->delete($id); @@ -491,11 +509,23 @@ else if ($id) /* * Barre d'actions - */ + */ 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) { @@ -507,14 +537,18 @@ else if ($id) } } - if ($user->rights->deplacement->creer) - { - print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>'; - } - else + if ($object->statut == 1) // if validated { - print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>'; + if ($user->rights->deplacement->creer) + { + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>'; + } + else + { + print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>'; + } } + if ($user->rights->deplacement->supprimer) { print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>'; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 476b0b12790fd932bf46f0bf195a9217fe521f3c..6e7020025057c11bb35c832825b8517e655c745a 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -219,7 +219,7 @@ $filter=''; print $form->select_company($socid,'socid',$filter,1,1); print '</td></tr>'; // 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 '</td></tr>'; // Year diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 06d46c7ac654e0b9b1fa123800a33eab355123b6..1759ca8e174878f60cb35a63f742470fda262d6f 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -19,3 +19,4 @@ TF_TRIP=Trip ListTripsAndExpenses=List of trips and expenses ExpensesArea=Trips and expenses area SearchATripAndExpense=Search a trip and expense +ClassifyRefunded=Classify 'Refunded' \ No newline at end of file