This issue is about changing all of PM's date fields from using a custom field (broken in Drupal 7) to use the Drupal Field API.
The date project is one of the most installed in Drupal, so will be on a lot of sites already. It is maintained and mainly in Drupal 8 core. We will need a mandatory dependency for any module that defines a date field.
This change will also solve a lot of issues that have been present in previous versions (due to having to define our own date structures).
Done in the latest patch:
- Removes all of the previous custom date field code.
- Adds a field named "Date range"
- Adds an instance of this field to PM Project / PM Task / PM Ticket / PM Timetracking, and migrates data from the old custom fields
- Create separate fields to cope with Expense Date, and the three dates shown on invoices.
Comment | File | Size | Author |
---|---|---|---|
#17 | pm-date-fields-14.patch | 100.07 KB | juliangb |
Comments
Comment #1
juliangb CreditAttribution: juliangb commentedA note to make sure we cover #1688224: Set time for date begin and date end? and #569432: Add fields for start / end time selection in this change.
Comment #2
juliangb CreditAttribution: juliangb commentedModules that need this:
- Expense (date)
- Invoice (request date, due date, payment date)
- Project (date begin, date end)
- Task (date begin, date end)
- Ticket (date begin, date end)
- Timetracking (date, time begin, time end)
That's more than I realised!
Once we've migrated these, there will also be some date functions to remove from pm.module.
Comment #3
juliangb CreditAttribution: juliangb commentedI'm actively working on this issue.
Comment #4
juliangb CreditAttribution: juliangb commentedUploading this initial patch mainly for personal testing.
So far - it removes all mention of the old custom date fields, adds a date range field and instance on the project node.
Comment #5
juliangb CreditAttribution: juliangb commentedUpdated patch - now with update function for pm project instance. If this is working, that code can be copied to task and ticket.
Comment #6
dbt102 CreditAttribution: dbt102 commentedTesting -02 patch. Patch loaded though a lot of error messages popped up, seeming related to code not yet implemented for non-project modules. Hunks 1, 2 3 & 4 succeeded.
For project content types was able to add a new date field with all options selected (due date, etc.). Tested the pop-up calendar feature. Works great. really cool...
Comment #7
juliangb CreditAttribution: juliangb commentedThanks for testing - glad that it looks helpful! I'm quite excited by how many opportunities this will open up (for example, much more flexible Gantt charts).
Please do post any error messages you get, and I'll see whether they are expected or not.
When I get a chance, I'll be rolling this patch out to the other non-project modules.
Comment #8
dbt102 CreditAttribution: dbt102 commentedubuntu:david$ git apply -v pm-date-fields-02.patch
Here is copy of terminal printout when applying patch to a different dev install.
Checking patch pm.css...
warning: pm.css has type 100755, expected 100644
Checking patch pm.install...
warning: pm.install has type 100755, expected 100644
Checking patch pm.module...
warning: pm.module has type 100755, expected 100644
Checking patch pmexpense/pmexpense.install...
warning: pmexpense/pmexpense.install has type 100755, expected 100644
Checking patch pmexpense/pmexpense.module...
warning: pmexpense/pmexpense.module has type 100755, expected 100644
Checking patch pmexpense/pmexpense.views.inc...
warning: pmexpense/pmexpense.views.inc has type 100755, expected 100644
Checking patch pminvoice/pminvoice.install...
warning: pminvoice/pminvoice.install has type 100755, expected 100644
Checking patch pminvoice/pminvoice.module...
warning: pminvoice/pminvoice.module has type 100755, expected 100644
Checking patch pminvoice/pminvoice.theme.inc...
warning: pminvoice/pminvoice.theme.inc has type 100755, expected 100644
Checking patch pminvoice/pminvoice.views.inc...
warning: pminvoice/pminvoice.views.inc has type 100755, expected 100644
Checking patch pmproject/pmproject.install...
warning: pmproject/pmproject.install has type 100755, expected 100644
Checking patch pmproject/pmproject.module...
warning: pmproject/pmproject.module has type 100755, expected 100644
Checking patch pmproject/pmproject.views.inc...
warning: pmproject/pmproject.views.inc has type 100755, expected 100644
Checking patch pmtask/pmtask.module...
warning: pmtask/pmtask.module has type 100755, expected 100644
Checking patch pmtask/pmtask.views.inc...
warning: pmtask/pmtask.views.inc has type 100755, expected 100644
Checking patch pmticket/pmticket.module...
warning: pmticket/pmticket.module has type 100755, expected 100644
Checking patch pmticket/pmticket.views.inc...
warning: pmticket/pmticket.views.inc has type 100755, expected 100644
Checking patch pmtimetracking/pmtimetracking.module...
warning: pmtimetracking/pmtimetracking.module has type 100755, expected 100644
Checking patch pmtimetracking/pmtimetracking.views.inc...
warning: pmtimetracking/pmtimetracking.views.inc has type 100755, expected 100644
Applied patch pm.css cleanly.
Applied patch pm.install cleanly.
Applied patch pm.module cleanly.
Applied patch pmexpense/pmexpense.install cleanly.
Applied patch pmexpense/pmexpense.module cleanly.
Applied patch pmexpense/pmexpense.views.inc cleanly.
Applied patch pminvoice/pminvoice.install cleanly.
Applied patch pminvoice/pminvoice.module cleanly.
Applied patch pminvoice/pminvoice.theme.inc cleanly.
Applied patch pminvoice/pminvoice.views.inc cleanly.
Applied patch pmproject/pmproject.install cleanly.
Applied patch pmproject/pmproject.module cleanly.
Applied patch pmproject/pmproject.views.inc cleanly.
Applied patch pmtask/pmtask.module cleanly.
Applied patch pmtask/pmtask.views.inc cleanly.
Applied patch pmticket/pmticket.module cleanly.
Applied patch pmticket/pmticket.views.inc cleanly.
Applied patch pmtimetracking/pmtimetracking.module cleanly.
Applied patch pmtimetracking/pmtimetracking.views.inc cleanly.
ubuntu:david$
Comment #9
juliangb CreditAttribution: juliangb commentedOk, ignore those warnings.
It looks like the files in your system have slightly looser security permissions than the ones in mine.
It isn't connected to this patch.
Comment #10
juliangb CreditAttribution: juliangb commentedUploading latest patch, so that it can be tested by the bot and to record progress.
Comment #11
juliangb CreditAttribution: juliangb commentedMinor edits on this patch.
Comment #12
juliangb CreditAttribution: juliangb commentedAnother patch. Should be "feature complete" now, so will just have to work out where the bugs are.
Comment #13
juliangb CreditAttribution: juliangb commentedNB: Running the patch through coder indicates no issues (all false positives).
One, I will need to add an ignore flag for, and this is using date() rather than Drupal's format_date(). This is to ensure that the conversion of fields in the update functions doesn't do anything funny with timezones.
Comment #14
juliangb CreditAttribution: juliangb commentedUpdated patch, bug fixes only.
Comment #15
juliangb CreditAttribution: juliangb commentedAnother updated patch, with bug fixes.
Comment #16
juliangb CreditAttribution: juliangb commentedStatus of the patch:
- It works, and I've tested it on both a fresh installation and upgrade. That said, I haven't put it through heavy testing of migrating data. Hopefully someone who often uses timezones can feedback on that.
- Default values: Invoice due date should be relative (30 days after request used to be the default). Payment date should not have a default, and should not be a required field.
- Date range field, probably doesn't need the term "range" in the label.
I will probably commit this once I am happy with it, without giving it much time in the queue. It is a large patch and so will make it hard to write other patches in the meantime.
Comment #17
juliangb CreditAttribution: juliangb commentedFinal patch.
Comment #18
juliangb CreditAttribution: juliangb commentedCommitted that final patch.
Comment #19
juliangb CreditAttribution: juliangb commented