From bc7d839c646bdef28af6d540f97cf2d909b3f951 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 6 Sep 2014 17:16:24 +0200 Subject: [PATCH] Fix: Missing status "refunded". Fix: translation --- .../deplacement/class/deplacement.class.php | 12 +++-- htdocs/compta/deplacement/fiche.php | 50 ++++++++++++++++--- htdocs/compta/deplacement/stats/index.php | 2 +- htdocs/langs/en_US/trips.lang | 1 + 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 9eeacee312c..4d24aac9a83 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 9df4bb90652..b6bb980c462 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 476b0b12790..6e702002505 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 06d46c7ac65..1759ca8e174 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 -- GitLab