[Rt-commit] [svn] r1567 - in rtir/branches/1.1-TESTING: etc html/Callbacks/RTIR/autohandler html/RTIR html/RTIR/Incident html/RTIR/Reporting/Elements html/RTIR/Search html/RTIR/Search/Elements lib/RT lib/RT/Action

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Mon Sep 27 18:32:09 EDT 2004


Author: leira
Date: Mon Sep 27 18:32:08 2004
New Revision: 1567

Added:
   rtir/branches/1.1-TESTING/html/Callbacks/RTIR/autohandler/
   rtir/branches/1.1-TESTING/html/Callbacks/RTIR/autohandler/Default
Modified:
   rtir/branches/1.1-TESTING/etc/RTIR_Config.pm
   rtir/branches/1.1-TESTING/html/RTIR/Create.html
   rtir/branches/1.1-TESTING/html/RTIR/Display.html
   rtir/branches/1.1-TESTING/html/RTIR/Incident/Reply.html
   rtir/branches/1.1-TESTING/html/RTIR/Reporting/Elements/SLASummary
   rtir/branches/1.1-TESTING/html/RTIR/Reporting/Elements/SLASummaryText
   rtir/branches/1.1-TESTING/html/RTIR/Search/Elements/ShowResults
   rtir/branches/1.1-TESTING/html/RTIR/Search/Results.html
   rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueBySLA.pm
   rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueCorrespond.pm
   rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetStartsByBizHours.pm
   rtir/branches/1.1-TESTING/lib/RT/IR.pm
Log:
Make the name of the Business::SLA module a variable.

Use RT::IR in an autohandler callback (like RTFM does).


Modified: rtir/branches/1.1-TESTING/etc/RTIR_Config.pm
==============================================================================
--- rtir/branches/1.1-TESTING/etc/RTIR_Config.pm	(original)
+++ rtir/branches/1.1-TESTING/etc/RTIR_Config.pm	Mon Sep 27 18:32:08 2004
@@ -12,6 +12,9 @@
 # Set the hash of whois servers
 Set($whois, {1 => "localhost", 2 => "whois-demo.bestpractical.com"});
 
+# Set the name of the Business::SLA class
+# Use this if you have a custom SLA module
+# Set($SLAModule, "Business::MySLA");
 
 # Set the number of minutes for the SLA
 

Added: rtir/branches/1.1-TESTING/html/Callbacks/RTIR/autohandler/Default
==============================================================================
--- (empty file)
+++ rtir/branches/1.1-TESTING/html/Callbacks/RTIR/autohandler/Default	Mon Sep 27 18:32:08 2004
@@ -0,0 +1,4 @@
+<%init>
+use RT::IR;
+return(1);
+</%init>

Modified: rtir/branches/1.1-TESTING/html/RTIR/Create.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Create.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Create.html	Mon Sep 27 18:32:08 2004
@@ -434,7 +434,6 @@
 
 my $sla;
 if ($Queue eq 'Incident Reports') {
-    use RT::IR;
     $sla = RT::IR::DefaultSLA();
 }
 

Modified: rtir/branches/1.1-TESTING/html/RTIR/Display.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Display.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Display.html	Mon Sep 27 18:32:08 2004
@@ -238,7 +238,6 @@
       $date->AddDays($RT::OverdueAfter);
 
       # get business hours
-      use RT::IR;
       my $bizhours = RT::IR::BusinessHours();
 
       my $due = $bizhours->first_after($date->Unix);

Modified: rtir/branches/1.1-TESTING/html/RTIR/Incident/Reply.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Incident/Reply.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Incident/Reply.html	Mon Sep 27 18:32:08 2004
@@ -197,7 +197,6 @@
       $date->AddDays($RT::OverdueAfter);
 
       # get business hours
-      use RT::IR;
       my $bizhours = RT::IR::BusinessHours();
 
       my $due = $bizhours->first_after($date->Unix);

Modified: rtir/branches/1.1-TESTING/html/RTIR/Reporting/Elements/SLASummary
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Reporting/Elements/SLASummary	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Reporting/Elements/SLASummary	Mon Sep 27 18:32:08 2004
@@ -82,7 +82,6 @@
     #
     if ($t->StartsObj->Unix > 0 && $t->StartedObj->Unix > 0) {
 	# Get a Business::Hours object for the period in question
-	use RT::IR;
 	my $bizhours = RT::IR::BusinessHours();
 
 	my $started_time;

Modified: rtir/branches/1.1-TESTING/html/RTIR/Reporting/Elements/SLASummaryText
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Reporting/Elements/SLASummaryText	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Reporting/Elements/SLASummaryText	Mon Sep 27 18:32:08 2004
@@ -52,7 +52,6 @@
     #
     if ($t->StartsObj->Unix > 0 && $t->StartedObj->Unix > 0) {
 	# Get a Business::Hours object for the period in question
-	use RT::IR;
 	my $bizhours = RT::IR::BusinessHours();
 
 	my $started_time;

Modified: rtir/branches/1.1-TESTING/html/RTIR/Search/Elements/ShowResults
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Search/Elements/ShowResults	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Search/Elements/ShowResults	Mon Sep 27 18:32:08 2004
@@ -21,6 +21,21 @@
 <a href="<%$RT::WebPath%>/Search/Results.rdf?Queue=<%$Queue%><%$QueryString%>"><&|/l&>RSS</&></a> |
 </div>
 
+<%INIT>
+$session{'i'}++;
+$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'})  unless ($session{'tickets'});
+$session{'tickets'}->FromSQL($Query) if ($Query);
+$session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); 
+
+if ($OrderBy ne $session{'CurrentSearchHash'}->{'OrderBy'}
+    or $Order ne $session{'CurrentSearchHash'}->{'Order'}) {
+    $session{'CurrentSearchHash'}->{'OrderBy'} = $OrderBy;
+    $session{'CurrentSearchHash'}->{'Order'}   = $Order;
+    # Invalidate the ordering cache
+    undef $session{'tickets'}->{'items_array'};
+}
+</%INIT>
+
 <%ARGS>
 $Query => undef
 $Format => undef 

Modified: rtir/branches/1.1-TESTING/html/RTIR/Search/Results.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Search/Results.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Search/Results.html	Mon Sep 27 18:32:08 2004
@@ -67,6 +67,18 @@
 $Format = $RT::RTIRSearchResultFormats->{$Type . 'Default'};
 
 my $title = loc("Results");
+$session{'i'}++;
+$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'})  unless ($session{'tickets'});
+$session{'tickets'}->FromSQL($Query) if ($Query);
+$session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); 
+
+if ($OrderBy ne $session{'CurrentSearchHash'}->{'OrderBy'}
+    or $Order ne $session{'CurrentSearchHash'}->{'Order'}) {
+    $session{'CurrentSearchHash'}->{'OrderBy'} = $OrderBy;
+    $session{'CurrentSearchHash'}->{'Order'}   = $Order;
+    # Invalidate the ordering cache
+    undef $session{'tickets'}->{'items_array'};
+}
 
 if (!$Query) {
     $Query = $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);

Modified: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueBySLA.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueBySLA.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueBySLA.pm	Mon Sep 27 18:32:08 2004
@@ -74,7 +74,6 @@
 
 sub Commit {
     my $self = shift;
-    use RT::IR;
 
     # TODO: return if it isn't an Incident Report
 

Modified: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueCorrespond.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueCorrespond.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetDueCorrespond.pm	Mon Sep 27 18:32:08 2004
@@ -75,7 +75,6 @@
 sub Commit {
     my $self = shift;
 
-    use RT::IR;
     my $bizhours = RT::IR::BusinessHours();
 
     my $date = RT::Date->new($RT::SystemUser);

Modified: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetStartsByBizHours.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetStartsByBizHours.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_SetStartsByBizHours.pm	Mon Sep 27 18:32:08 2004
@@ -82,7 +82,6 @@
     my $date = RT::Date->new($RT::SystemUser);
     $date->SetToNow;
 
-    use RT::IR;
     my $bizhours = RT::IR::BusinessHours();
 
     my $starts = $bizhours->first_after($date->Unix);

Modified: rtir/branches/1.1-TESTING/lib/RT/IR.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/IR.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/IR.pm	Mon Sep 27 18:32:08 2004
@@ -46,9 +46,10 @@
 #
 package RT::IR;
 
-sub BusinessHours {
+use Business::Hours;
+use Business::SLA;
 
-    use Business::Hours;
+sub BusinessHours {
 
     my $bizhours = new Business::Hours;
     if ($RT::BusinessHours) {
@@ -70,8 +71,9 @@
 
 sub SLAInit {
 
-    use Business::SLA;
-    my $SLAObj = new Business::SLA;
+    my $class = $RT::SLAModule || 'Business::SLA';
+
+    my $SLAObj = $class->new();
 
     my $bh = RT::IR::BusinessHours();
     $SLAObj->SetInHoursDefault($RT::_RTIR_SLA_inhours_default);


More information about the Rt-commit mailing list