[Rt-commit] rt branch, 4.4/include-article-queue, repushed
Craig Kaiser
craig at bestpractical.com
Thu Feb 22 08:35:45 EST 2018
The branch 4.4/include-article-queue was deleted and repushed:
was 9e1bb57414988e88c9b49ce6a9d2d1f1c7c8adac
now b0b87cccbd3fef1f90f96f01b8dc5060a90ba80e
1: ff41098cf ! 1: 57ba572b7 Add default value for Articles in Queues
@@ -13,20 +13,20 @@
+ if ( $args{Name} eq 'Article' && $args{Value} ) {
+ my $article = RT::Article->new($self->CurrentUser);
-+ if ( $args{Value} =~ /^(\d+)$/ ) {
-+ my ($ret, $msg) = $article->Load( $args{Value} );
-+ return ($ret, $msg ) unless $ret;
++ my ($ret, $msg);
++ if ( $args{Value} =~ /^\d+$/ ) {
++ ($ret, $msg) = $article->Load( $args{Value} );
+ }
+ else {
-+ my ($ret, $msg) = $article->LoadByCols( Name => $args{Value} );
-+ return ($ret, $msg ) unless $ret;
++ ($ret, $msg) = $article->LoadByCols( Name => $args{Value} );
+ }
++ return ($ret, $msg ) unless $ret;
+
+ $args{Value} = $article->Id;
+ $new_value = $article->Name;
+ }
+
-+ if ( $args{Name} eq 'Article' && $old_value =~ /^\d+?$/ ) {
++ if ( $args{Name} eq 'Article' && $old_value =~ /^\d+$/ ) {
+ my $article = RT::Article->new($self->CurrentUser);
+ my ($ret, $msg) = $article->Load( $old_value );
+ if ($ret) {
@@ -67,14 +67,41 @@
--- a/share/html/Articles/Elements/IncludeArticle
+++ b/share/html/Articles/Elements/IncludeArticle
@@
+ <%INIT>
my $parent_args = $m->caller_args(-1);
-
+my @articles;
-+
+
my $name_prefix = '';
$name_prefix = $ARGS{'Name'} .'-'
- if $ARGS{'Name'}
+@@
+ && grep rindex($_, "$ARGS{'Name'}-Articles-", 0) == 0,
+ keys %$parent_args;
+
++ my $Ticket = $ARGS{Ticket};
++if ( !$Ticket and $parent_args->{id} and $parent_args->{id} ne 'new' ) {
++ $Ticket = RT::Ticket->new($session{'CurrentUser'});
++ $Ticket->Load($parent_args->{id});
++ unless ( $Ticket->id ) {
++ $RT::Logger->error("Couldn't load ticket ". $parent_args->{id} )
++ }
++}
++
+ foreach my $arg ( keys %$parent_args ) {
+ next if $name_prefix && substr($arg, 0, length($name_prefix)) ne $name_prefix;
+
+- my $Ticket = $ARGS{Ticket};
+- if ( !$Ticket and $parent_args->{id} and $parent_args->{id} ne 'new' ) {
+- $Ticket = RT::Ticket->new($session{'CurrentUser'});
+- $Ticket->Load($parent_args->{id});
+- unless ( $Ticket->id ) {
+- $RT::Logger->error("Couldn't load ticket ". $parent_args->{id} )
+- }
+- }
+-
+ my $Queue = RT::Queue->new($session{CurrentUser});
+ if ($Ticket && $Ticket->Id) {
+ $Queue = $Ticket->QueueObj;
@@
Queue => $Queue->Id,
);
@@ -96,7 +123,6 @@
+ }
+}
-+my $Ticket = $ARGS{Ticket};
+foreach my $article (@articles) {
my $formatted_article = $m->scomp('/Articles/Article/Elements/Preformatted',
Article => $article, Ticket => $Ticket
2: eadafc60e ! 2: 67d79fbf5 Add Autocomplete for Articles
@@ -89,13 +89,13 @@
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
-+<input id='SelectArticleAutocomplete' data-autocomplete="Articles" data-autocomplete-queue=<% $QueueObj->Id %> data-autocomplete-return="Name" name='Article' value="<% $Default %>">
++<input data-autocomplete="Articles" data-autocomplete-queue="<% $QueueObj->Id %>" data-autocomplete-return="Name" name="<% $Name %>" value="<% $Default %>">
+
+<%ARGS>
+$QueueObj => ""
-+$Default => ""
++$Default => undef
++$Name => 'Article'
+</%ARGS>
-\ No newline at end of file
diff --git a/share/html/Helpers/Autocomplete/Articles b/share/html/Helpers/Autocomplete/Articles
new file mode 100644
3: 9e1bb5741 = 3: b0b87cccb Test Default Article content on Ticket create
More information about the rt-commit
mailing list