- if ($_POST['btn_submit']){
- // User pressed the Save button under monthly quotas table.
- $postedYear = $request->getParameter('year');
- $selectedYear = intval($postedYear);
- for ($i = 0; $i < count($months); $i++){
- $res = $quota->update($postedYear, $i+1, $request->getParameter($months[$i]));
- }
+
+ // Handle monthly quotas for a selected year.
+ $selectedYear = (int) $request->getParameter('year');
+ for ($i = 0; $i < count($months); $i++){
+ $quota_in_minutes = ttTimeHelper::postedDurationToMinutes($request->getParameter($months[$i]), 44640/*24*60*31*/);
+ if (!$quota->update($selectedYear, $i+1, $quota_in_minutes))
+ $err->add($i18n->get('error.db'));