Ciao a tutti.
Sto mettendo mano ad una piccola applicazione sviluppata da una ditta per il mio cliente. E' in sostanza una piccola agenda che gestisce gli appuntamenti. Ad inserimento di un nuovo appuntamento, si può scegliere se l'evento è con ricorrenza settimanale, mensile o annuale. Mi è stato chiesto di aggiungere il trimestrale. Così spulciando il codice ho trovato la funzione per il mensile che è questa:

Codice PHP:
function getMonthlyEvents ($userId$date$participation)
    {
        
$day date ('d'$date);
        
$startOfDay mktime (000,
            
date ('m'$date),
            
date ('d'$date),
            
date ('y'$date));
        
$endOfDay $startOfDay + (60*60*24) -1;
        if (
$participation)
        {        
            
$query sprintf ($this->queries['getMonthlyEventsWithParticipation'],
                
$userId,
                
date ("Y-m-d H:i:s"$endOfDay),
                
date ("Y-m-d H:i:s"$startOfDay),
                
$day,
                
$userId);
            
$rs $this->db->Execute ($query) or die ($this->db->ErrorMsg().' '.$query);
            
$events =  $this->itemFactory->resultSetToItems($rs);
        }
        else 
        {
            
$events = array ();
        }
        
$query sprintf ($this->queries['getMonthlyEvents'],
            
$userId,
            
date ("Y-m-d H:i:s"$endOfDay),
            
date ("Y-m-d H:i:s"$startOfDay),
            
$day);
        
$rs $this->db->Execute ($query) or die ($this->db->ErrorMsg().' '.$query);
        
$events =  $events $this->itemFactory->resultSetToItems($rs);
        for (
$i=0$i<count ($events); $i++)
        {
            
$event $events[$i];
            
$reminders $this->getReminders($event->itemId);
            
$event->setReminders ($reminders);
            
$events[$i]=$event;
        }
        return 
$events;
    } 
Così, ho pensato intanto di copiarla e di creare una funzione per il trimestrale. Ho già aggiunto in tutti i file i richiami alla funzione, che è questa (ho semplicemente aggiunto 3 al valore mese della variabile $startofday):

Codice PHP:
function get3MonthsEvents ($userId$date$participation)
    {
        
$day date ('d'$date);
        
$startOfDay mktime (000,
            
date ('m'$date)+3,
            
date ('d'$date),
            
date ('y'$date));
        
$endOfDay $startOfDay + (60*60*24) -1;
        if (
$participation)
        {        
            
$query sprintf ($this->queries['get3MonthsEventsWithParticipation'],
                
$userId,
                
date ("Y-m-d H:i:s"$endOfDay),
                
date ("Y-m-d H:i:s"$startOfDay),
                
$day,
                
$userId);
            
$rs $this->db->Execute ($query) or die ($this->db->ErrorMsg().' '.$query);
            
$events =  $this->itemFactory->resultSetToItems($rs);
        }
        else 
        {
            
$events = array ();
        }
        
$query sprintf ($this->queries['get3MonthsEvents'],
            
$userId,
            
date ("Y-m-d H:i:s"$endOfDay),
            
date ("Y-m-d H:i:s"$startOfDay),
            
$day);
        
$rs $this->db->Execute ($query) or die ($this->db->ErrorMsg().' '.$query);
        
$events =  $events $this->itemFactory->resultSetToItems($rs);
        for (
$i=0$i<count ($events); $i++)
        {
            
$event $events[$i];
            
$reminders $this->getReminders($event->itemId);
            
$event->setReminders ($reminders);
            
$events[$i]=$event;
        }
        return 
$events;
    } 
Ma il tutto purtroppo non funziona. Mi sembrava troppo semplice.
Ho spulciato tutte le altre funzioni chiamate in causa ma sono in un vicolo cieco.
Qualche suggerimento? Grazie