From 63a5a27e1fbfd3a0e9bb70bd0b2403abfabbb399 Mon Sep 17 00:00:00 2001 From: vfilippov Date: Thu, 14 Oct 2010 11:05:19 +0000 Subject: [PATCH] Bug 70566 git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@990 6955db30-a419-402b-8a0d-67ecbb4d7f56 --- .../hook/global/user-error-errors.html.tmpl | 22 ++++++++++--------- importxls.cgi | 18 ++++++++++++--- .../en/custom/bug/import/importxls.html.tmpl | 2 +- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/extensions/custis/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/custis/template/en/default/hook/global/user-error-errors.html.tmpl index ec33b9b64..d195291b8 100644 --- a/extensions/custis/template/en/default/hook/global/user-error-errors.html.tmpl +++ b/extensions/custis/template/en/default/hook/global/user-error-errors.html.tmpl @@ -1,13 +1,15 @@ [% IF error == "cc_group_restriction" %] - [% title = "CC Group Restriction" %] - User [% user %] is restricted to watch this bug. + [% title = "CC Group Restriction" %] + User [% user %] is restricted to watch this bug. [% ELSIF error == "rms_fields_empty" %] - [% title = "Some required fields are empty" %] - [% FOR nok = not_ok_bugs %] - [% fs = [] %] - [% fs.push("Sprint") IF nok.s %] - [% fs.push("Status Whiteboard") IF nok.w %] - [% fs.push("Agreement") IF nok.a %] - [% terms.Bug %] [%+ nok.bug.id %] - [% nok.bug.short_desc | html %]: You must fill in [% fs.join(", ") %] attribute[% IF fs.size > 1 %]s[% END %] before [% IF nok.bug.bug_status == "ASSIGNED" %]taking[% ELSE %]closing[% END %] this bug!
- [% END %] + [% title = "Some required fields are empty" %] + [% FOR nok = not_ok_bugs %] + [% fs = [] %] + [% fs.push("Sprint") IF nok.s %] + [% fs.push("Status Whiteboard") IF nok.w %] + [% fs.push("Agreement") IF nok.a %] + [% terms.Bug %] [%+ nok.bug.id %] - [% nok.bug.short_desc | html %]: You must fill in [% fs.join(", ") %] attribute[% IF fs.size > 1 %]s[% END %] before [% IF nok.bug.bug_status == "ASSIGNED" %]taking[% ELSE %]closing[% END %] this bug!
+ [% END %] +[% ELSIF error == "import_fields_mandatory" %] + The following fields: [% fields.join(", ") | html %] are required to enter new bugs. [% END %] diff --git a/importxls.cgi b/importxls.cgi index b280a8f3a..eb037c307 100755 --- a/importxls.cgi +++ b/importxls.cgi @@ -88,7 +88,6 @@ for (keys %$args) $vars->{bug_tpl} = $bug_tpl; $vars->{name_tr} = $name_tr; -$vars->{mandatory_fields} = $MANDATORY_FIELDS; # нужно всосать из шаблонов field_descs... # и несколько поменять... ;-/ поганый хак, конечно, а чё делать-то. @@ -230,7 +229,7 @@ else else { # если ещё нет - ставим новый - $id = post_bug($bug, $bugmail); + $id = post_bug($bug, $bugmail, $vars); } if ($id) { @@ -385,8 +384,21 @@ sub get_row # добавить баг sub post_bug { - my ($fields_in, $bugmail) = @_; + my ($fields_in, $bugmail, $vars) = @_; my $cgi = Bugzilla->cgi; + # FIXME проверку обязательных полей можно куда-нибудь унести + my @unexist; + for (@$MANDATORY_FIELDS) + { + if (!exists $fields_in->{$_}) + { + push @unexist, $vars->{import_field_descs}->{$_}; + } + } + if (@unexist) + { + ThrowUserError('import_fields_mandatory', { fields => \@unexist }); + } # имитируем почтовое использование с показом ошибок в браузер my $um = Bugzilla->usage_mode; Bugzilla->usage_mode(USAGE_MODE_EMAIL); diff --git a/template/en/custom/bug/import/importxls.html.tmpl b/template/en/custom/bug/import/importxls.html.tmpl index cc7244cc1..b0271e6f2 100644 --- a/template/en/custom/bug/import/importxls.html.tmpl +++ b/template/en/custom/bug/import/importxls.html.tmpl @@ -107,7 +107,7 @@ function checkColumns() break; } if (!chk) - alert('No bugs selected for import!'); + alert('Для импорта не выбрано ни одного бага из списка!'); return chk; }