summaryrefslogtreecommitdiff
path: root/user/calligra/plan.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-01-14 01:57:58 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-01-14 01:57:58 +0000
commit1b5ac6b603626d26dbb3484ae4cb7624cb18a620 (patch)
tree9041a4b00af7a77dac1b32806fb24d03fbe30134 /user/calligra/plan.patch
parenteb2ee1e3dc396b3dcf52e391c7227faaeb858d20 (diff)
downloadpackages-1b5ac6b603626d26dbb3484ae4cb7624cb18a620.tar.gz
packages-1b5ac6b603626d26dbb3484ae4cb7624cb18a620.tar.bz2
packages-1b5ac6b603626d26dbb3484ae4cb7624cb18a620.tar.xz
packages-1b5ac6b603626d26dbb3484ae4cb7624cb18a620.zip
user/*: Modernise / fix syntax / deps / code
Diffstat (limited to 'user/calligra/plan.patch')
-rw-r--r--user/calligra/plan.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/user/calligra/plan.patch b/user/calligra/plan.patch
new file mode 100644
index 000000000..c8f8c91fb
--- /dev/null
+++ b/user/calligra/plan.patch
@@ -0,0 +1,48 @@
+From 36ec68024620211edbcdb31a5ef6021545fe9451 Mon Sep 17 00:00:00 2001
+From: Dag Andersen <danders@get2net.dk>
+Date: Fri, 9 Feb 2018 08:40:34 +0100
+Subject: Plan: Fix crash in tj scheduler if a resource does not have a
+ calendar
+
+This can happen when there is no default calendar and no calendar has been set for a resource.
+---
+ plan/src/plugins/schedulers/tj/PlanTJScheduler.cpp | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/plan/src/plugins/schedulers/tj/PlanTJScheduler.cpp b/plan/src/plugins/schedulers/tj/PlanTJScheduler.cpp
+index 4f4e825..548969e 100644
+--- a/plan/src/plugins/schedulers/tj/PlanTJScheduler.cpp
++++ b/plan/src/plugins/schedulers/tj/PlanTJScheduler.cpp
+@@ -259,6 +259,9 @@ bool PlanTJScheduler::kplatoToTJ()
+ addRequests();
+ addStartEndJob();
+
++ if (result != -1) {
++ return false;
++ }
+ return check();
+ }
+
+@@ -596,6 +599,7 @@ TJ::Resource *PlanTJScheduler::addResource( KPlato::Resource *r)
+ res->setEfficiency( (double)(r->units()) / 100. );
+ }
+ Calendar *cal = r->calendar();
++ Q_ASSERT(cal);
+ DateTime start = qMax( r->availableFrom(), m_project->constraintStartTime() );
+ DateTime end = m_project->constraintEndTime();
+ if ( r->availableUntil().isValid() && end > r->availableUntil() ) {
+@@ -887,6 +891,11 @@ void PlanTJScheduler::addRequest( TJ::Task *job, Task *task )
+ return;
+ }
+ foreach ( ResourceRequest *rr, task->requests().resourceRequests( true /*resolveTeam*/ ) ) {
++ if (!rr->resource()->calendar()) {
++ result = 1; // stops scheduling
++ logError(task, 0, i18n("No working hours defined for resource: %1",rr->resource()->name()));
++ continue; // may happen if no calendar is set, and no default calendar
++ }
+ TJ::Resource *tjr = addResource( rr->resource() );
+ TJ::Allocation *a = new TJ::Allocation();
+ a->setSelectionMode( TJ::Allocation::order );
+--
+cgit v1.1
+