View Issue Details

IDProjectCategoryView StatusLast Update
0008998phplist applicationRepetitionpublic18-02-08 14:08
Reportermeteo 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.10.4 
Target Version2.10.7Fixed in Version2.10.5 
Summary0008998: Unable to find new embargo date too many exclusions?
DescriptionI am trying to use the repetition excluding weekends and bank holidays as stated in the documentation.
I was using a previous version (2.6.5-RC1) with this feature and was working fine.
Now we migrated to the new version but this feature hasn't worked ever since.
Additional InformationI am attaching the config file we are using.
I tried with and without the comma at the end of the second array but without success.
TagsNo tags attached.

Relationships

related to 0003721 closed phplist 2.10.x 

Activities

22-01-07 17:11

 

config.php (29,624 bytes)

michiel

22-01-07 17:38

manager   ~0022770

ah, interesting one. I don't use that functionality, so I didn't check it for ages. Might be useful to try to debug it and post your findings.

meteo

22-01-07 18:33

reporter   ~0022774

Michiel,

I am very bad in PHP coding, in particular touching a brand new connect.php.
I have seen that you have rewritten that part, maybe there is some small typo...

michiel

22-01-07 22:50

manager   ~0022781

I haven't touched that code for a long time, so I can't imagine it broke. Have you upgraded Mysql as well? It may have to do with mysql changing their date formatting codes.

meteo

23-01-07 11:36

reporter   ~0022789

we are using MySQL5.0.26. Bu I have seen that the now() function used in the connect.php code returns the same format in MySQL 3.23.49 we were using before.
This shouldn't matter anyway as the dates passed with the configured array to the excludedDateForRepetition function contains also the format:
$repeat_exclude = array(
  array("format" => "%a", "values" => array("Sun","Sat")),
  array("format" => "%d-%m-%Y", "values" => array("26-12-2007","25-12-2007","06-04-2007","09-04-2007","0
1-05-2007","25-01-2007")),);

meteo

23-01-07 12:09

reporter   ~0022790

a format query in both databases returns the same result:
SELECT date_format( now(), "%a")
Tue

meteo

23-01-07 13:15

reporter   ~0022791

I have found where the problem is:
MySQL5 stores ALL dates as %Y-%m-%d %H:%i:%s, so adding time to the old format.
What happens is that each loop that check the exclusion takes the new embargo from DB with
while (excludedDateForRepetition($msgdata["newembargo"]))

so the logical expression
foreach ($GLOBALS["repeat_exclude"] as $exclusion) {
    $formatted_value = Sql_Fetch_Row_Query(sprintf('select date_format("%s","%s")',$date,$exclusion["format"]));
    foreach ($exclusion["values"] as $disallowed) {
      if ($formatted_value[0] == $disallowed) {
        return 1;

is always TRUE during the same day, as the $formatted_value is always changing the time part and the foreach is triggered by newembargo changes.
I think somewhere newembargo should be reformatted as well.....

meteo

23-01-07 13:50

reporter   ~0022793

ISSUE SOLVED!

please discard my last notes, the wrong piece of code is the following (don't know why you changed the variable name....):
while (excludedDateForRepetition($msgdata["newembargo"])) {
      $repeat += $msgdata["repeatinterval"];

should be instead:
while (excludedDateForRepetition($msgdata["newembargo"])) {
      $repeatinterval += $msgdata["repeatinterval"];

I think this can be easily fixed in your code, I will do myself on our installation

michiel

23-01-07 14:32

manager   ~0022795

fantastic, thanks for finding it.

user1308

02-08-07 20:49

  ~0030021

Resolved appliying fix by meteo