[Rt-commit] rt branch, 4.4/include-article-queue, repushed
Craig Kaiser
craig at bestpractical.com
Wed Feb 7 15:40:57 EST 2018
The branch 4.4/include-article-queue was deleted and repushed:
was e3ad3cbb896a353996815690c80bf7d5dc657cf0
now aa84fca657ae3d3454528d96aebe88768d696320
1: 2a78b2aa1 < -: ------- Make RT owner dropdown limit a config option
-: ------- > 1: f2d31f1db Add test for 'Order by' dropdown content
-: ------- > 2: 0494b9529 Re-add Queue to 'Order by' dropdown in Search Builder
2: 6f3b34170 ! 3: d2eef49ea Add Default Article option for Queues
@@ -41,7 +41,7 @@
+ my $self = shift;
+
+ my $attr = $self->FirstAttribute('QueueDefaultArticle') ;
-+ my $content = $attr ? $attr->Content : undef;
++ my $content = $attr && $attr->Content ? $attr->Content : undef;
+ return $content;
+ }
+
@@ -57,21 +57,33 @@
+ my $value = shift;
+
+ my $article = RT::Article->new( RT->SystemUser );
-+
-+ if ( $value ne "" ){
++ my $no_value = $self->loc("(no value)");
++ my $new_value;
++ my $old_value;
++
++ # If unsetting Default Article $value will come in as empty string, do not load that.
++ if ( $value && $value ne "" ){
+ my ($ret, $msg) = $article->Load( $value );
-+ return (0, $msg) unless ($ret);
++ return ($ret, $msg) unless $ret;
++ $new_value = $article->Name;
+ }
+
-+ my ($status, $msg) = $self->SetAttribute(
++ if ( length($self->QueueDefaultArticle()) ) {
++ my ($ret, $msg) = $article->Load( $self->QueueDefaultArticle() );
++ return ($ret, $msg) unless $ret;
++ $old_value = $article->Name;
++ }
++
++ my ($ret, $msg) = $self->SetAttribute(
+ Name => 'QueueDefaultArticle',
+ Content => $value,
+ );
-+ return ($status, $msg) unless $status;
-+
-+ # If Default Article set to none we expect 'undef' as value
-+ my $ret_val = $value ne "" ? 'updated to ' . $article->Name : 'removed';
-+ return (1, $self->loc("Default Article [_1]", $ret_val));
++ return ($ret, $msg) unless $ret;
++
++ return (1,
++ $self->loc("Default Article changed from [_1] to [_2]",
++ $old_value ? "'" . $old_value . "'" : $no_value,
++ $new_value ? "'" . $new_value . "'" : $no_value));
+}
sub Delete {
@@ -239,15 +251,20 @@
+<option value="">-</option>
+% }
+% while (my $article = $articles->Next) {
-+% if ( $article && $article->Id eq $article->Id) {
++% if ( $article && $article->Id eq $article->Id) {
+<option value="<% $article->Id %>"><% $article->Name|| loc('(no name)')%><%$article->Summary || ''%></option>
-+% }
++% }
+% }
+</select>
+
+<%INIT>
+my $article_id = RT::Article->new($session{'CurrentUser'});
-+$article_id->LoadByCol( id => $QueueObj->QueueDefaultArticle );
++
++# Default Article is "" if no value selected
++if ( defined $QueueObj->QueueDefaultArticle && $QueueObj->QueueDefaultArticle ne "") {
++ my ($ret, $msg) = $article_id->LoadByCol( id => $QueueObj->QueueDefaultArticle );
++ RT::Logger->error($msg) unless $ret;
++}
+</%INIT>
+
+<%ARGS>
@@ -313,10 +330,10 @@
+
+<%INIT>
+my $article_id = RT::Article->new($session{'CurrentUser'});
-+$article_id->LoadByCol( id => $QueueObj->QueueDefaultArticle );
++my ($ret, $msg) = $article_id->LoadByCol( id => $QueueObj->QueueDefaultArticle );
++RT::Logger->error($msg) unless $ret;
+</%INIT>
+<%ARGS>
+$QueueObj
+</%ARGS>
-\ No newline at end of file
-
+
3: aff15a0ed ! 4: 51eb2c366 Make default Article content show on Ticket create
@@ -2,9 +2,7 @@
Make default Article content show on Ticket create
- It is important that, if a default Article is selected for a Queue. Then
- on Create.html, the content of the Article should be shown in the
- message box.
+ If the Queue has a Defulat Article, show it on Ticket create.
diff --git a/share/html/Articles/Elements/IncludeArticle b/share/html/Articles/Elements/IncludeArticle
--- a/share/html/Articles/Elements/IncludeArticle
@@ -14,9 +12,9 @@
Queue => $Queue->Id,
);
+
-+ my %args = %$parent_args;
-+ if ( !$args{'id'} ){
-+ my $queue_id = $args{'Queue'};
++ # Check if Ticket id is present, if it is not we know we are creating a Ticket
++ if ( !$parent_args->{'id'} ){
++ my $queue_id = $parent_args->{'Queue'};
+
+ my $QueueObj = RT::Queue->new($session{'CurrentUser'});
+ $QueueObj->Load( $queue_id );
4: e3ad3cbb8 < -: ------- Add test for default Article content on create.html
-: ------- > 5: aa84fca65 Add test for default Article content on create.html
More information about the rt-commit
mailing list