CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Feature #37281

Set archive date automatically

Added by Armin Ruediger Vieweg about 1 year ago. Updated 12 months ago.

Status:Resolved Start date:2012-05-18
Priority:Could have Due date:
Assignee:Georg Ringer % Done:

100%

Category:Backend
Target version:2.0.0
TYPO3 Version:4.5 Has patch:No
PHP Version: Complexity:
Votes: 0

Description

As I have understood the system of archiving news, the archive date must be filled. If it is not setted, the news is active. Then the only possibility of filtering is the relative time setting in the plugin.

I guess mostly it is not necessary to set the archive date individually for each news entry.
So you could use a small save hook, which checks the archive date field and if its emtpy it gets filled automatically, related of the news date.

Somewhere the admin should be able to define a archive rule, i.e:
  • end of the week
  • end of the month
  • end of the year
  • ...

So if end of month is choosen and the date is 18.05.2012, the auto archive date would be 31.05.2012 then. The most popular settings will be "end of the year", probably.

If you allow "end of week" as value, the user should be able to define on which weekday a week starts.

refs37281.av1.patch (5.6 kB) Armin Ruediger Vieweg, 2012-05-29 11:32

Associated revisions

Revision 4c7fe6f4
Added by Georg Ringer 12 months ago

[FEATURE] Predefine archive date with TsConfig

tx_news.predefine.archive in combination with strtotime
makes it possible to set the archive date to e.g. next
friday or always +2 weeks.

Change-Id: Ic13fca376c23e9efedbcccf28066e56dde9dd376
Resolves: #37281

History

Updated by Georg Ringer about 1 year ago

  • Status changed from New to Accepted

can you provide a patch? otherwise I will do it when there is time for it

Updated by Armin Ruediger Vieweg about 1 year ago

It would be a pleasure for me :)

Just tell me, where you want the settings being located. TypoScript or Extension settings?

Updated by Georg Ringer about 1 year ago

extension setting and overrruleable by tsconfig, so it could be different per pid.

however I would prefer just support of strtotime() as this would solve all those requirements as "next sunday", "+1 week" ..

Updated by Armin Ruediger Vieweg 12 months ago

Hey,
what is more important to you: use of strtotime() or compatibility to PHP 5.2?

strtotime('last day of this month', $record['datetime']);

This is just available since 5.3.

Updated by Georg Ringer 12 months ago

5.3 is absolutly fine as this is min-requirement since TYPO3 4.6

Updated by Armin Ruediger Vieweg 12 months ago

Finished. Patch is attached :)

It would be very good, if you could check and approve this patch soon.
We need this feature for a current project, and I don't feel well using a branched version of news extension.

Thanks a lot!

Updated by Georg Ringer 12 months ago

thx, however I will implement it a bit different, hope that is ok ;)

Updated by Armin Ruediger Vieweg 12 months ago

Sure! If this happens soon, I'm happy with that ;-)

Updated by Gerrit Code Review 12 months ago

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11698

Updated by Georg Ringer 12 months ago

would be happy for your comments.
changes

  • IMO Tsconfig is enough
  • no php version checks needed as everyone just needs to check himself
  • hook before saving sets the archive date but still leaves the option to change it to something else
  • hook will only predefine it if record is not yet saved, so no changes to existing records

Updated by Armin Ruediger Vieweg 12 months ago

I'm fine with your chances, except the remove of the calculateAutoArchiveDate() method.
Now it is not possible to set "last day of this year", which will be the most famous setting, I suppose. https://bugs.php.net/bug.php?id=53650

Updated by Armin Ruediger Vieweg 12 months ago

Ah! And the second call of strtotime

strtotime('midnight', $autoArchiveDate)

will set the time to 00:00:00.

I recognized right now, that this is not what people expect. They want 23:59:59 ... but I don't know the best way to realize that.

Updated by Georg Ringer 12 months ago

Hi,

I still doubt that having last day of year is actually used because news written on 30.12 will just be shown 2 days ;) however you can use 12/31 to get the last day of the current year. if you want 23:59 you can use 12/31 - 1 second.

sounds ok?

Updated by Armin Ruediger Vieweg 12 months ago

Ah okay. But your expression isn't correct:

1/1 next year -1 second
Your's would return the 30.12.xx.

Maybe you could add this line to documentation?
With this knowledge I'm totally fine with your modificatons and would be happy to see it soon in the new version :)


I still doubt that having last day of year is actually used because news written on 30.12 will just be shown 2 days ;)

Correct. Isn't it the behavior of sooooo much press-sites of companies? Many of them have splitted their news by year. And at the view of current year on 1st January 2013, I wouldn't expect a news, created at 30th december 2012. Or am I wrong?

Updated by Georg Ringer 12 months ago

  • Category set to Backend
  • Status changed from Accepted to Resolved
  • Target version set to 2.0.0

Updated by Georg Ringer 12 months ago

  • Assignee set to Georg Ringer
  • % Done changed from 0 to 100

Also available in: Atom PDF