Move "Fix Worktime" page to core

hinted-selects
Vitaliy Filippov 2014-08-18 17:10:04 +04:00
parent 8fd0b23144
commit 89a565f437
5 changed files with 25 additions and 17 deletions

View File

@ -1,9 +1,11 @@
#!/usr/bin/perl
# CustIS Bug 68921 - "Супер-TodayWorktime", или массовая фиксация трудозатрат
# по нескольким багам, за нескольких сотрудников, за различные периоды.
# Для фиксации времени задним числом / другим юзером требует группу worktimeadmin.
# "Super-Fix-Worktime" page - allows to enter worktime for many bugs at once,
# even for past dates and/or for other users, if you have 'superworktime' privilege.
# Originally CustIS Bug 68921.
# License: Dual-license GPL 3.0+ or MPL 1.1+
# Author: Vitaliy Filippov <vitalif@mail.ru>
package BugWorkTime;
package Bugzilla::FixWorktimePage;
use strict;
use POSIX;

View File

@ -47,6 +47,7 @@ use Bugzilla::Keyword;
use Bugzilla::Field;
use Bugzilla::Status;
use Bugzilla::Token;
use Bugzilla::FixWorktimePage;
use Time::HiRes qw(gettimeofday);
use Date::Parse;
@ -77,10 +78,9 @@ Bugzilla->login();
my $superworktime;
if (($ARGS->{format}||'') eq 'superworktime')
{
require BugWorkTime;
$superworktime = 1;
Bugzilla->login(LOGIN_REQUIRED);
BugWorkTime::HandleSuperWorktime($vars, $ARGS);
Bugzilla::FixWorktimePage::HandleSuperWorktime($vars, $ARGS);
}
# If a parameter starts with cmd-, this means the And or Or button has been

View File

@ -1,8 +0,0 @@
[% IF error == "move_worktime_empty" %]
Вы пытаетесь перенести время или распределить его в пропорции, взятой из
<a href="show_bug.cgi?id=[% bug_id | html %]">[% terms.Bug %] [% bug_id | html %]</a>,
но в нём нет списанного
[% IF who %]пользователем [% who.identity | html %][% END %]
[% IF from || to %]за период [% IF from %]с [% from | html%][% IF to %] по [% END %][% END %][% to | html %][% END %]
времени.
[% END %]

View File

@ -15,8 +15,7 @@ use Bugzilla::Search;
use Bugzilla::Search::Saved;
use Bugzilla::Constants;
use Bugzilla::CheckerUtils;
use BugWorkTime; # extensions/custis/lib/
use Bugzilla::FixWorktimePage;
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $userid = $user->id;
@ -90,7 +89,7 @@ if (@idlist || @lines)
foreach my $id (@{$wtime->{IDS}})
{
$dbh->bz_start_transaction();
if (!BugWorkTime::FixWorktime($id, $wtime->{$id}->{time}, join("\n", @{$wtime->{$id}->{comments} || []})))
if (!Bugzilla::FixWorktimePage::FixWorktime($id, $wtime->{$id}->{time}, join("\n", @{$wtime->{$id}->{comments} || []})))
{
$rollback = 1;
}

View File

@ -1380,6 +1380,21 @@
[% END %]
[% END %]
[% BLOCK error_move_worktime_empty %]
[% title = "No Worktime In Selected Bug" %]
You are trying to move or split Hours Worked by in ratio taken from
<a href="show_bug.cgi?id=[% bug_id | html %]">[% terms.Bug %] [% bug_id | html %]</a>,
bug there is no working time entered
[% IF who %]by user [% who.identity | html %][% END %]
[% IF from && to %]
between [% from | html %] and [% to | html %]
[% ELSIF from %]
after [% from | html %]
[% ELSIF to %]
before [% to | html %]
[% END %].
[% END %]
[% BLOCK error_need_quip %]
[% title = "Quip Required" %]
[% docslinks = {'quips.html' => 'About quips'} %]