[Rt-commit] r5826 - in rt/branches/CHALDEA-EXPERIMENTAL: . bin etc html/Elements html/Elements/CollectionAsTable html/Ticket/Elements lib lib/RT lib/RT/Action lib/RT/Condition sbin

ruz at bestpractical.com ruz at bestpractical.com
Wed Aug 30 14:26:47 EDT 2006


Author: ruz
Date: Wed Aug 30 14:13:47 2006
New Revision: 5826

Added:
   rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/06-mime_decoding.t
Modified:
   rt/branches/CHALDEA-EXPERIMENTAL/   (props changed)
   rt/branches/CHALDEA-EXPERIMENTAL/bin/rt-crontool.in
   rt/branches/CHALDEA-EXPERIMENTAL/etc/RT_Config.pm.in
   rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/CollectionAsTable/ParseFormat
   rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/ShowCustomFields
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowBasics
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowDates
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowHistory
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowSummary
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT.pm.in
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Condition/Generic.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Group_Overlay.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
   rt/branches/CHALDEA-EXPERIMENTAL/releng.cnf
   rt/branches/CHALDEA-EXPERIMENTAL/sbin/rt-setup-database.in

Log:
merge QUEBEC -> CHALDEA

 r3667 at cubic-pc (orig r5825):  ruz | 2006-08-30 19:47:20 +0400
 merge 3.4->QUEBEC
 
  r3523 at cubic-pc (orig r5496):  ruz | 2006-07-01 00:09:08 +0400
  Changes:
  * new config option $OldestTransactionsFirst that allow
    administrator to reverse order of transactions on
    history page
  
  r3524 at cubic-pc (orig r5520):  ruz | 2006-07-04 09:36:46 +0400
  * forgot to add option to config
  r3525 at cubic-pc (orig r5521):  ruz | 2006-07-04 09:38:03 +0400
  * report error when couldn't create CF
  r3526 at cubic-pc (orig r5522):  ruz | 2006-07-04 09:39:21 +0400
  * we never should call exit from libs
  r3527 at cubic-pc (orig r5534):  ruz | 2006-07-06 19:19:46 +0400
  rt-crontool
  * add --transaction argument with two possible values: 'first' and 'last'
  * add --transaction-type argument to allow users select type of transactions
  ** these transactions would be passed to scrips for processing, so users
     can use conditions, actions and templates that check or use properties of
     transaction
  
  * also some existant actions, conditions and templates require scrip or
    scrip action objects to process normally, as we have no these objects
    available we now pass void (not loaded) objects. This change would allow
    users to use notify actions with crontool.
  r3528 at cubic-pc (orig r5570):  kevinr | 2006-07-14 00:21:31 +0400
   r14836 at sad-girl-in-snow:  kevinr | 2006-07-13 16:17:43 -0400
   * The RT::Condition::Generic docs were wrong... fixed.
  
  r3529 at cubic-pc (orig r5616):  jesse | 2006-07-20 04:40:57 +0400
   r14217 at pinglin:  jesse | 2006-07-19 17:39:08 -0700
   * crit was being called on the wrong object. Thanks to Todd Chapman 
  
  r3530 at cubic-pc (orig r5624):  jesse | 2006-07-20 21:48:07 +0400
   r14229 at pinglin:  jesse | 2006-07-20 10:47:51 -0700
   * The new history ordering feature was backported backwards.
  
  r3569 at cubic-pc (orig r5669):  ruz | 2006-07-28 20:06:56 +0400
  * bump 3.4.6rc1
  r3653 at cubic-pc (orig r5777):  ruz | 2006-08-17 02:55:37 +0400
  * add LeftColumn and RightColumn callbacks to the summary element
  r3654 at cubic-pc (orig r5778):  ruz | 2006-08-17 02:56:58 +0400
  * display one value without html lists
  r3655 at cubic-pc (orig r5779):  ruz | 2006-08-17 02:58:46 +0400
  * allow user to add zero CF values
  r3661 at cubic-pc (orig r5818):  ruz | 2006-08-27 20:34:52 +0400
  * add additional classes to records in tables with ticket's properties
  ** so it's possible to change visiual appearance of different fields
     like dates, queue, priority status and other
  r3662 at cubic-pc (orig r5819):  ruz | 2006-08-29 20:59:30 +0400
  * Code:
    $cf->Load(...)
    $field = $cf->id;
    unless( $field =~ /^\d+$/ )...
    may produce unint warning if field wasn't loaded,
    use "unless( $cf->id )" instead as we do everywhere
  
  r3663 at cubic-pc (orig r5820):  ruz | 2006-08-29 21:03:36 +0400
  * default title to empty string as we compare it with 'NEWLINE' string
    in several places, drops uninit warnings
  r3664 at cubic-pc (orig r5821):  ruz | 2006-08-29 21:07:03 +0400
  * get rid of unint warnings
  * make a log message shorter to be more readable
  r3665 at cubic-pc (orig r5822):  ruz | 2006-08-29 23:10:01 +0400
  * fix decoding of the MIME fields, this should fix:
  ** problems with non-ascii names of attachments
  ** problems with partly encoded fields with '=' chars
     in not encoded parts, for example:
  
  X-MyHeader: key="plain"; key="=?encoded?="
  X-MyHeader: key="=?encoded?="; key="plain"
  
 


Modified: rt/branches/CHALDEA-EXPERIMENTAL/bin/rt-crontool.in
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/bin/rt-crontool.in	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/bin/rt-crontool.in	Wed Aug 30 14:13:47 2006
@@ -75,19 +75,28 @@
 }
 
 my ( $search, $condition, $action, $search_arg, $condition_arg, $action_arg,
-     $template_id, $help, $verbose );
-GetOptions( "search=s"        => \$search,
-            "search-arg=s"    => \$search_arg,
-            "condition=s"     => \$condition,
-            "condition-arg=s" => \$condition_arg,
-            "action-arg=s"    => \$action_arg,
-            "action=s"        => \$action,
-	    "template-id=s"   => \$template_id,
-            "help"            => \$help,
-            "verbose|v"       => \$verbose );
+     $template_id, $transaction, $transaction_type, $help, $verbose );
+GetOptions( "search=s"           => \$search,
+            "search-arg=s"       => \$search_arg,
+            "condition=s"        => \$condition,
+            "condition-arg=s"    => \$condition_arg,
+            "action-arg=s"       => \$action_arg,
+            "action=s"           => \$action,
+            "template-id=s"      => \$template_id,
+            "transaction=s"      => \$transaction,
+            "transaction-type=s" => \$transaction_type,
+            "help"               => \$help,
+            "verbose|v"          => \$verbose );
 
 help() if $help or not $search or not $action;
 
+$transaction ||= 'first';
+unless ( $transaction =~ /^(first|last)$/i ) {
+    print STDERR loc("--transaction argument could be only 'first' or 'last'");
+    exit 1;
+}
+$transaction = lc($transaction) eq 'first'? 'ASC': 'DESC';
+
 # We _must_ have a search object
 load_module($search);
 load_module($action)    if ($action);
@@ -99,6 +108,8 @@
     $template_obj = RT::Template->new($CurrentUser);
     $template_obj->Load($template_id);
 }
+my $void_scrip = RT::Scrip->new( $CurrentUser );
+my $void_scrip_action = RT::ScripAction->new( $CurrentUser );
 
 #At the appointed time:
 
@@ -119,11 +130,20 @@
 while ( my $ticket = $tickets->Next() ) {
     print $ticket->Id() . ": " if ($verbose);
 
+    my $transaction = get_transaction($ticket);
+    print loc("Using transaction #[_1]...", $transaction->id)
+        if $verbose && $transaction;
+
     # perform some more advanced check
     if ($condition) {
-        my $condition_obj = $condition->new( TicketObj => $ticket,
-                                             Argument  => $condition_arg,
-                                             CurrentUser => $CurrentUser );
+        my $condition_obj = $condition->new(
+            TransactionObj => $transaction,
+            TicketObj      => $ticket,
+            ScripObj       => $void_scrip,
+            TemplateObj    => $template_obj,
+            Argument       => $condition_arg,
+            CurrentUser    => $CurrentUser,
+        );
 
         # if the condition doesn't apply, get out of here
 
@@ -133,10 +153,13 @@
 
     #prepare our action
     my $action_obj = $action->new(
-        TicketObj   => $ticket,
-        TemplateObj => $template_obj,
-        Argument    => $action_arg,
-        CurrentUser => $CurrentUser
+        TicketObj      => $ticket,
+        TransactionObj => $transaction,
+        TemplateObj    => $template_obj,
+        Argument       => $action_arg,
+        ScripObj       => $void_scrip,
+        ScripActionObj => $void_scrip_action,
+        CurrentUser    => $CurrentUser,
     );
 
     #if our preparation, move onto the next ticket
@@ -148,6 +171,26 @@
     print loc("Action committed.\n") if ($verbose);
 }
 
+=head2 get_transaction
+
+Takes ticket and returns its transaction acording to command
+line arguments C<--transaction> and <--transaction-type>.
+
+=cut
+
+sub get_transaction {
+    my $ticket = shift;
+    my $txns = $ticket->Transactions;
+    $txns->OrderByCols(
+        { FIELD => 'Created', ORDER => $transaction },
+        { FIELD => 'id', ORDER => $transaction },
+    );
+    $txns->Limit( FIELD => 'Type', VALUE => $transaction_type )
+        if $transaction_type;
+    $txns->RowsPerPage(1);
+    return $txns->First;
+}
+
 # {{{ load_module 
 
 =head2 load_module
@@ -207,6 +250,15 @@
       . loc( "[_1] - An argument to pass to [_2]", "--action-argument", "--action" )
       . "\n";
     print "	"
+      . loc( "[_1] - Specify id of the template you want to use", "--template-id" )
+      . "\n";
+    print "	"
+      . loc( "[_1] - Specify if you want to use either 'first' or 'last' tarnsaction", "--transaction" )
+      . "\n";
+    print "	"
+      . loc( "[_1] - Specify the type of a transaction you want to use", "--transaction-type" )
+      . "\n";
+    print "	"
       . loc( "[_1] - Output status updates to STDOUT", "--verbose" ) . "\n";
     print "\n";
     print "\n";

Modified: rt/branches/CHALDEA-EXPERIMENTAL/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/etc/RT_Config.pm.in	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/etc/RT_Config.pm.in	Wed Aug 30 14:13:47 2006
@@ -407,13 +407,18 @@
 
 Set($MaxInlineBody, 13456);
 
+# By default, RT shows newest transactions at the bottom of the ticket
+# history page, if you want see them at the top set this to '0'.
+
+Set($OldestTransactionsFirst, '1');
+
 # $DefaultSummaryRows is default number of rows displayed in for search
 # results on the frontpage.
 
 Set($DefaultSummaryRows, 10);
 
 
-# $MaxInlineBody is an arrayref of allowed components customized homepage.
+# $HomepageComponents is an arrayref of allowed components customized homepage.
 
 Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders  RefreshHomepage)]);
 

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/CollectionAsTable/ParseFormat
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/CollectionAsTable/ParseFormat	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/CollectionAsTable/ParseFormat	Wed Aug 30 14:13:47 2006
@@ -59,7 +59,9 @@
         substr($col,-1,1) = "";
     }
 
-    my $colref;
+    my $colref = {
+        title => '',
+    };
 
     if ( $col =~ s!/STYLE:([^/]+)!!io ) {
         $colref->{'style'} = $1;
@@ -88,7 +90,7 @@
         $colref->{'attribute'} = $col;
     }
     
-    if ( !$colref->{'title'} && grep { /^__(.*?)__$/io }
+    if ( !$colref->{'title'} && grep { /^__(.+?)__$/io }
         @{ $colref->{'output'} } )
     {   
         $colref->{'title'}     = $1;

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/ShowCustomFields
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/ShowCustomFields	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/ShowCustomFields	Wed Aug 30 14:13:47 2006
@@ -44,58 +44,62 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <table>
-% my @entry_fields;
-% while (my $CustomField = $CustomFields->Next()) {
-% my $Values = $Object->CustomFieldValues($CustomField->Id);
+% while ( my $CustomField = $CustomFields->Next ) {
+% my $Values = $Object->CustomFieldValues( $CustomField->Id );
+% my $count = $Values->Count;
   <tr>
-    <td class="label"><%$CustomField->Name%>:</td>
+    <td class="label"><% $CustomField->Name %>:</td>
     <td class="value">
+% unless ( $count ) {
+<i><&|/l&>(no value)</&></i>
+% } elsif ( $count == 1 ) {
+%   $print_value->( $CustomField, $Values->First );
+% } else {
 <ul>
-% while (my $Value = $Values->Next()) {
-<li>
-% if ($CustomField->LinkValueTo) {
-<a href="<%$Value->LinkValueTo|n%>" target="_new">
-% }
-% my $comp = "ShowCustomField".$CustomField->Type;
-% if ($m->comp_exists($comp)) {
-<& $comp, Object => $Value &>
-%   } else {
-<%$Value->Content%>
-%   }
-% if ($CustomField->LinkValueTo) {
-</a>
-% }
-
-%# This section automatically populates a div with the "IncludeContentForValue" for this custom
-%# field if it's been defined
-% if ($CustomField->IncludeContentForValue) {
-<div
-    class="object_cf_value_include" 
-    id="object_cf_value_<%$Value->id%>" 
-    >
-<&|/l, '<a href="'.$Value->IncludeContentForValue.'">' . $Value->IncludeContentForValue."</a>"&>See also: [_1]</&>
-</div>
-
-<script><!--
-            ahah('<%$Value->IncludeContentForValue%>', 'object_cf_value_<%$Value->id%>');
-        --></script>
-% }
-</li>
-% }
-% unless ($Values->Count()) {
-<li><i><&|/l&>(no value)</&></i></li>
+% while ( my $Value = $Values->Next ) {
+<li><% $print_value->( $CustomField, $Value ) |n %></li>
 % }
 </ul>
+% }
     </td>
   </tr>
 % }
 </table>
 <%INIT>
 my $CustomFields = $Object->CustomFields;
- $m->comp('/Elements/Callback', _CallbackName => 'MassageCustomFields',
+$m->comp('/Elements/Callback', _CallbackName => 'MassageCustomFields',
                                 CustomFields => $CustomFields);
 
+my $print_value = sub {
+    my ($cf, $value) = @_;
+    my $linked = $cf->LinkValueTo;
+    if ( $linked ) {
+        $m->out('<a href="'. $value->LinkValueTo .'" target="_new">');
+    }
+    my $comp = "ShowCustomField". $cf->Type;
+    if ( $m->comp_exists( $comp ) ) {
+        $m->comp( $comp, Object => $value );
+    } else {
+        $m->print( $value->Content );
+    }
+    $m->out('</a>') if $linked;
+
+    # This section automatically populates a div with the "IncludeContentForValue" for this custom
+    # field if it's been defined
+    if ( $cf->IncludeContentForValue ) {
+       $vid = $value->id;
+       $m->out(   '<div class="object_cf_value_include" id="object_cf_value_'. $vid .'">' );
+       $m->print( loc("See also:") );
+       $m->out(   '<a href="'. $value->IncludeContentForValue .'">' );
+       $m->print( $value->IncludeContentForValue );
+       $m->out(   qq{</a></div>\n} );
+       $m->out(   qq{<script><!--\nahah('} );
+       $m->print( $value->IncludeContentForValue ) );
+       $m->out(   qq{', 'object_cf_value_$vid'\n--></script>\n} );
+    }
+};
+
 </%INIT>
 <%ARGS>
 $Object => undef
-</%ARGS>
+</%ARGS>
\ No newline at end of file

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowBasics
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowBasics	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowBasics	Wed Aug 30 14:13:47 2006
@@ -45,36 +45,36 @@
 %# END BPS TAGGED BLOCK }}}
 <table>
   <tr>
-    <td class="label"><&|/l&>Id</&>:</td>
-    <td class="value"><%$Ticket->Id %></td>
+    <td class="label id"><&|/l&>Id</&>:</td>
+    <td class="value id"><%$Ticket->Id %></td>
   </tr>
   <tr>
-    <td class="label"><&|/l&>Status</&>:</td>
-    <td class="value"><&|/l&><% $Ticket->Status%></&></td>
+    <td class="label status"><&|/l&>Status</&>:</td>
+    <td class="value status"><&|/l&><% $Ticket->Status%></&></td>
   </tr>
 % if ($Ticket->TimeEstimated) {
   <tr>
-    <td class="label"><&|/l&>Estimated</&>:</td>
-    <td class="value"><& ShowTime, minutes => $Ticket->TimeEstimated &></td>
+    <td class="label time estimated"><&|/l&>Estimated</&>:</td>
+    <td class="value time estimated"><& ShowTime, minutes => $Ticket->TimeEstimated &></td>
   </tr>
 % }
 % if ($Ticket->TimeWorked) {
   <tr>
-    <td class="label"><&|/l&>Worked</&>:</td>
-    <td class="value"><& ShowTime, minutes => $Ticket->TimeWorked &></td>
+    <td class="label time worked"><&|/l&>Worked</&>:</td>
+    <td class="value time worked"><& ShowTime, minutes => $Ticket->TimeWorked &></td>
   </tr>
 % }
   <tr>
-    <td class="label"><&|/l&>Left</&>:</td>
-    <td class="value"><& ShowTime, minutes => $Ticket->TimeLeft &></td>
+    <td class="label time left"><&|/l&>Left</&>:</td>
+    <td class="value time left"><& ShowTime, minutes => $Ticket->TimeLeft &></td>
   </tr>
   <tr>
-    <td class="label"><&|/l&>Priority</&>:</td>
-    <td class="value"><%$Ticket->Priority%>/<%$Ticket->FinalPriority %></td>
+    <td class="label priority"><&|/l&>Priority</&>:</td>
+    <td class="value priority"><%$Ticket->Priority%>/<%$Ticket->FinalPriority %></td>
   </tr>
   <tr>
-    <td class="label"><&|/l&>Queue</&>:</td>
-    <td class="value"><%$Ticket->QueueObj->Name%></td>
+    <td class="label queue"><&|/l&>Queue</&>:</td>
+    <td class="value queue"><%$Ticket->QueueObj->Name%></td>
   </tr>
 <& /Elements/Callback, _CallbackName => 'EndOfList', TicketObj => $Ticket, %ARGS &>
 </table>

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowDates
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowDates	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowDates	Wed Aug 30 14:13:47 2006
@@ -45,36 +45,36 @@
 %# END BPS TAGGED BLOCK }}}
 <TABLE>
   <TR>
-    <TD class="label"><&|/l&>Created</&>:</TD>
-    <TD class="value"><% $Ticket->CreatedObj->AsString %></TD>
+    <TD class="label date created"><&|/l&>Created</&>:</TD>
+    <TD class="value date created"><% $Ticket->CreatedObj->AsString %></TD>
   </TR>
   <TR>
-    <TD class="label"><&|/l&>Starts</&>:</TD>
-    <TD class="value"><% $Ticket->StartsObj->AsString %></TD>
+    <TD class="label date starts"><&|/l&>Starts</&>:</TD>
+    <TD class="value date starts"><% $Ticket->StartsObj->AsString %></TD>
   </TR>
   <TR>
-    <TD class="label"><&|/l&>Started</&>:</TD>
-    <TD class="value"><% $Ticket->StartedObj->AsString %></TD>
+    <TD class="label date started"><&|/l&>Started</&>:</TD>
+    <TD class="value date started"><% $Ticket->StartedObj->AsString %></TD>
   </TR>
   <TR>
-    <TD class="label"><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->id%>&Action=SetTold"><&|/l&>Last Contact</&></a>:</TD>
-    <TD class="value"><% $Ticket->ToldObj->AsString %></TD>
+    <TD class="label date told"><a href="<% $RT::WebPath %>/Ticket/Display.html?id=<% $Ticket->id %>&Action=SetTold"><&|/l&>Last Contact</&></a>:</TD>
+    <TD class="value date told"><% $Ticket->ToldObj->AsString %></TD>
   </TR>
   <TR>
-    <TD class="label"><&|/l&>Due</&>:</TD>
-    <TD class="value"><% $Ticket->DueObj->AsString  %></TD>
+    <TD class="label date due"><&|/l&>Due</&>:</TD>
+    <TD class="value date due"><% $Ticket->DueObj->AsString  %></TD>
   </TR>
   <TR>
-    <TD class="label"><&|/l&>Closed</&>:</TD>
-    <TD class="value"><% $Ticket->ResolvedObj->AsString  %></TD>
+    <TD class="label date resolved"><&|/l&>Closed</&>:</TD>
+    <TD class="value date resolved"><% $Ticket->ResolvedObj->AsString  %></TD>
   </TR>
   <TR>
-    <TD class="label"><&|/l&>Updated</&>:</TD>
-% my $UpdatedString = $Ticket->LastUpdated ? (loc("[_1] by [_2]", $Ticket->LastUpdatedAsString, $Ticket->LastUpdatedByObj->Name)) : loc("Never");
+    <TD class="label date updated"><&|/l&>Updated</&>:</TD>
+% my $UpdatedString = $Ticket->LastUpdated ? loc("[_1] by [_2]", $Ticket->LastUpdatedAsString, $Ticket->LastUpdatedByObj->Name) : loc("Never");
 % if ($UpdatedLink) {
-    <TD class="value"><A HREF="#lasttrans"><% $UpdatedString | h %></a></TD>
+    <TD class="value date updated"><A HREF="#lasttrans"><% $UpdatedString | h %></a></TD>
 % } else {
-    <TD class="value"><% $UpdatedString | h %></TD>
+    <TD class="value date updated"><% $UpdatedString | h %></TD>
 % }
   </TR>
 </TABLE>

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowHistory
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowHistory	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowHistory	Wed Aug 30 14:13:47 2006
@@ -136,8 +136,16 @@
 } else {
     $Transactions = $Ticket->Transactions;
 }
-my $i;
 
+
+my $OldestFirst = $RT::OldestTransactionsFirst? 'ASC': 'DESC';
+$Transactions->OrderByCols( { FIELD => 'Created',
+                              ORDER => $OldestFirst },
+                            { FIELD => 'id',
+                              ORDER => $OldestFirst },
+                          );
+
+my $i;
 $Attachments ||=  $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket, Tickets => $Tickets || undef);
 $AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments', Ticket => $Ticket);
 

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowSummary
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowSummary	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowSummary	Wed Aug 30 14:13:47 2006
@@ -69,11 +69,13 @@
 		color => "#333399" &>
 	  <& /Ticket/Elements/ShowPeople, Ticket => $Ticket &>
 	  <& /Elements/TitleBoxEnd &>
-	<BR/>
+
 	  <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments &>
 
 	  <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
 
+      <& /Elements/Callback, %ARGS, _CallbackName => 'LeftColumn' &>
+
 	</TD>
 	<TD VALIGN=TOP WIDTH="50%" class="boxcontainer">
 	  <&|/Elements/TitleBox, title => loc("Reminders"),
@@ -100,6 +102,7 @@
 	        <& /Elements/ShowLinks, Ticket => $Ticket &>
 	<& /Elements/TitleBoxEnd &>
         <br />
+    <& /Elements/Callback, %ARGS, _CallbackName => 'RightColumn' &>
 
 	</TD>
       </TR>

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT.pm.in
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT.pm.in	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT.pm.in	Wed Aug 30 14:13:47 2006
@@ -293,12 +293,8 @@
     unless ($^S || !defined $^S ) {
         $RT::Handle->Rollback();
         $RT::Logger->crit("$_[0]");
-        exit(-1);
-    }
-    else {
-        #Get out of here if we're in an eval
-        die $_[0];
     }
+    die $_[0];
 };
 
 # }}}

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	Wed Aug 30 14:13:47 2006
@@ -300,13 +300,12 @@
         }
     }
 
-    my $success =
-      ( $msgid
-      . " sent To: "
-      . $MIMEObj->head->get('To') . " Cc: "
-      . $MIMEObj->head->get('Cc') . " Bcc: "
-      . $MIMEObj->head->get('Bcc') );
-    $success =~ s/\n//gi;
+    my $success = "$msgid sent";
+    foreach (qw(To Cc Bcc)) {
+        next unless my $addresses = $MIMEObj->head->get($_);
+        $success .= " $_: ". $addresses;
+    }
+    $success =~ s/\n//g;
 
     $self->RecordOutgoingMailTransaction($MIMEObj) if ($RT::RecordOutgoingEmail);
 

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Condition/Generic.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Condition/Generic.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Condition/Generic.pm	Wed Aug 30 14:13:47 2006
@@ -51,7 +51,7 @@
 =head1 SYNOPSIS
 
     use RT::Condition::Generic;
-    my $foo = new RT::Condition::IsApplicable( 
+    my $foo = RT::Condition::Generic->new( 
 		TransactionObj => $tr, 
 		TicketObj => $ti, 
 		ScripObj => $scr, 

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm	Wed Aug 30 14:13:47 2006
@@ -374,7 +374,8 @@
         return (0, $self->loc('Permission Denied'));
     }
 
-    unless (length $args{'Name'}) {
+    # allow zero value
+    if ( !defined $args{'Name'} || $args{'Name'} eq '' ) {
         return(0, $self->loc("Can't add a custom field value without a name"));
     }
 

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Group_Overlay.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Group_Overlay.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Group_Overlay.pm	Wed Aug 30 14:13:47 2006
@@ -497,7 +497,7 @@
     # If we couldn't create a principal Id, get the fuck out.
     unless ($principal_id) {
         $RT::Handle->Rollback() unless ($args{'InsideTransaction'});
-        $self->crit( "Couldn't create a Principal on new user create. Strange things are afoot at the circle K" );
+        $RT::Logger->crit( "Couldn't create a Principal on new user create. Strange things are afoot at the circle K" );
         return ( 0, $self->loc('Could not create group') );
     }
 

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N.pm	Wed Aug 30 14:13:47 2006
@@ -289,11 +289,13 @@
     my $str = shift;
     my $enc = shift;
 
-   
-    @_ = $str =~ m/([^=]*)=\?([^?]+)\?([QqBb])\?([^?]+)\?=([^=]*)/g;
-
+    @_ = $str =~ m/(.*?)=\?([^?]+)\?([QqBb])\?([^?]+)\?=([^=]*)/gc;
     return ($str) unless (@_);
 
+    # add everything that hasn't matched to the end of the latest
+    # string in array this happen when we have 'key="=?encoded?="; key="plain"'
+    @_[-1] .= substr($str, pos $str);
+
     $str = "";
     while (@_) {
 	my ($prefix, $charset, $encoding, $enc_str, $trailing) =

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	Wed Aug 30 14:13:47 2006
@@ -3710,15 +3710,15 @@
     my $field = shift;
     if ( $field and $field !~ /^\d+$/ ) {
         my $cf = RT::CustomField->new( $self->CurrentUser );
-        $cf->LoadByNameAndQueue( Name => $field, Queue => $self->QueueObj->Id );
+        $cf->LoadByNameAndQueue( Name => $field, Queue => $self->Queue );
         unless ( $cf->id ) {
-            $cf->LoadByNameAndQueue( Name => $field, Queue => '0' );
+            $cf->LoadByNameAndQueue( Name => $field, Queue => 0 );
         }
-        $field = $cf->id;
-        unless ( $field =~ /^\d+$/ ) {
-          # If we didn't find a valid cfid, give up.
-          return RT::CustomFieldValues->new($self->CurrentUser);
+        unless ( $cf->id ) {
+            # If we didn't find a valid cfid, give up.
+            return RT::CustomFieldValues->new($self->CurrentUser);
         }
+        $field = $cf->id;
     }
     return $self->SUPER::CustomFieldValues($field);
 }

Added: rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/06-mime_decoding.t
==============================================================================
--- (empty file)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/06-mime_decoding.t	Wed Aug 30 14:13:47 2006
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More tests => 5;
+
+use_ok("RT");
+
+RT::LoadConfig();
+RT::Init();
+
+use_ok('RT::I18N');
+
+diag q{'=' char in a leading part before an encoded part} if $ENV{TEST_VERBOSE};
+{
+    my $str = 'key="plain"; key="=?UTF-8?B?0LzQvtC5X9GE0LDQudC7LmJpbg==?="';
+    is(
+        RT::I18N::DecodeMIMEWordsToUTF8($str),
+        'key="plain"; key="мой_файл.bin"',
+        "right decoding"
+    );
+}
+
+diag q{not compliant with standards, but MUAs send such field when attachment has non-ascii in name}
+    if $ENV{TEST_VERBOSE};
+{
+    my $str = 'attachment; filename="=?UTF-8?B?0LzQvtC5X9GE0LDQudC7LmJpbg==?="';
+    is(
+        RT::I18N::DecodeMIMEWordsToUTF8($str),
+        'attachment; filename="мой_файл.bin"',
+        "right decoding"
+    );
+}
+
+diag q{'=' char in a trailing part after an encoded part} if $ENV{TEST_VERBOSE};
+{
+    my $str = 'attachment; filename="=?UTF-8?B?0LzQvtC5X9GE0LDQudC7LmJpbg==?="; some_prop="value"';
+    is(
+        RT::I18N::DecodeMIMEWordsToUTF8($str),
+        'attachment; filename="мой_файл.bin"; some_prop="value"',
+        "right decoding"
+    );
+}
+

Modified: rt/branches/CHALDEA-EXPERIMENTAL/releng.cnf
==============================================================================

Modified: rt/branches/CHALDEA-EXPERIMENTAL/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/sbin/rt-setup-database.in	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/sbin/rt-setup-database.in	Wed Aug 30 14:13:47 2006
@@ -560,6 +560,10 @@
                 next;
             }
             my ( $return, $msg ) = $new_entry->Create(%$item);
+            unless( $return ) {
+                print "(Error: $msg)\n";
+                next;
+            }
 
             foreach my $value ( @{$values} ) {
                 my ( $eval, $emsg ) = $new_entry->AddValue(%$value);


More information about the Rt-commit mailing list