Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-5539

Domains: Daily expiration sync targets all domains instead of a subset

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.13.0-b1
    • Component/s: None
    • Labels:
      None

      Description

      domains_plugin.php around line 1431 change

                  $client_groups = $this->ClientGroups->getAll(Configure::get('Blesta.company_id'));
                  foreach ($client_groups as $client_group) {
                      $inv_days_before_renewal = $this->ClientGroups->getSetting($client_group->id, 'inv_days_before_renewal');
                      $pre_renewal_invoice_date = $this->Date->modify(
                              date('c'),
                              '-' . (($renewal_days->value ?? 0) + ($inv_days_before_renewal->value ?? 0) + 1) . ' days',
                              'Y-m-d 00:00:00',
                              Configure::get('Blesta.company_timezone')
                          );
                      $filters = [
                          'services' => [
                              ['column' => 'date_renews', 'operator' => '>=', 'value' => $pre_renewal_invoice_date]
                          ],
                          'clients' => [
                              ['column' => 'client_group_id', 'operator' => '=', 'value' => $client_group->id]
                          ],
                      ];
                      $services = $this->DomainsDomains->getAll([], ['date_added' => 'DESC'], $filters);
                      $this->synchronizeDomainServices($services, $renewal_days);
                  }
      

      To

                  $client_groups = $this->ClientGroups->getAll(Configure::get('Blesta.company_id'));
                  foreach ($client_groups as $client_group) {
                      $inv_days_before_renewal = $this->ClientGroups->getSetting($client_group->id, 'inv_days_before_renewal');
                      $pre_renewal_invoice_date = $this->Date->modify(
                              date('c'),
                              '+' . (($inv_days_before_renewal->value ?? 0) + 5) . ' days',
                              'Y-m-d 00:00:00',
                              Configure::get('Blesta.company_timezone')
                          );
                      $filters = [
                          'services' => [
                              ['column' => 'date_renews', 'operator' => '<=', 'value' => $pre_renewal_invoice_date]
                          ],
                          'clients' => [
                              ['column' => 'client_group_id', 'operator' => '=', 'value' => $client_group->id]
                          ],
                      ];
                      $services = $this->DomainsDomains->getAll([], ['date_added' => 'DESC'], $filters);
                      $this->synchronizeDomainServices($services, $renewal_days);
                  }
      

        Activity

        jonathan Jonathan Reissmueller created issue -
        jonathan Jonathan Reissmueller made changes -
        Field Original Value New Value
        Sprint 5.13.0 Sprint 6 [ 221 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Description domains_plugin.php around line 1431 change

        {code:java}
                    $client_groups = $this->ClientGroups->getAll(Configure::get('Blesta.company_id'));
                    foreach ($client_groups as $client_group) {
                        $inv_days_before_renewal = $this->ClientGroups->getSetting($client_group->id, 'inv_days_before_renewal');
                        $pre_renewal_invoice_date = $this->Date->modify(
                                date('c'),
                                '-' . (($renewal_days->value ?? 0) + ($inv_days_before_renewal->value ?? 0) + 1) . ' days',
                                'Y-m-d 00:00:00',
                                Configure::get('Blesta.company_timezone')
                            );
                        $filters = [
                            'services' => [
                                ['column' => 'date_renews', 'operator' => '>=', 'value' => $pre_renewal_invoice_date]
                            ],
                            'clients' => [
                                ['column' => 'client_group_id', 'operator' => '=', 'value' => $client_group->id]
                            ],
                        ];
                        $services = $this->DomainsDomains->getAll([], ['date_added' => 'DESC'], $filters);
                        $this->synchronizeDomainServices($services, $renewal_days);
                    }
        {code}

        To


        {code:java}
                    $client_groups = $this->ClientGroups->getAll(Configure::get('Blesta.company_id'));
                    foreach ($client_groups as $client_group) {
                        $inv_days_before_renewal = $this->ClientGroups->getSetting($client_group->id, 'inv_days_before_renewal');
                        $pre_renewal_invoice_date = $this->Date->modify(
                                date('c'),
                                '+' . (($inv_days_before_renewal->value ?? 0) + 1) . ' days',
                                'Y-m-d 00:00:00',
                                Configure::get('Blesta.company_timezone')
                            );
                        $filters = [
                            'services' => [
                                ['column' => 'date_renews', 'operator' => '<=', 'value' => $pre_renewal_invoice_date]
                            ],
                            'clients' => [
                                ['column' => 'client_group_id', 'operator' => '=', 'value' => $client_group->id]
                            ],
                        ];
                        $services = $this->DomainsDomains->getAll([], ['date_added' => 'DESC'], $filters);
                        $this->synchronizeDomainServices($services, $renewal_days);
                    }
        {code}
        domains_plugin.php around line 1431 change

        {code:java}
                    $client_groups = $this->ClientGroups->getAll(Configure::get('Blesta.company_id'));
                    foreach ($client_groups as $client_group) {
                        $inv_days_before_renewal = $this->ClientGroups->getSetting($client_group->id, 'inv_days_before_renewal');
                        $pre_renewal_invoice_date = $this->Date->modify(
                                date('c'),
                                '-' . (($renewal_days->value ?? 0) + ($inv_days_before_renewal->value ?? 0) + 1) . ' days',
                                'Y-m-d 00:00:00',
                                Configure::get('Blesta.company_timezone')
                            );
                        $filters = [
                            'services' => [
                                ['column' => 'date_renews', 'operator' => '>=', 'value' => $pre_renewal_invoice_date]
                            ],
                            'clients' => [
                                ['column' => 'client_group_id', 'operator' => '=', 'value' => $client_group->id]
                            ],
                        ];
                        $services = $this->DomainsDomains->getAll([], ['date_added' => 'DESC'], $filters);
                        $this->synchronizeDomainServices($services, $renewal_days);
                    }
        {code}

        To


        {code:java}
                    $client_groups = $this->ClientGroups->getAll(Configure::get('Blesta.company_id'));
                    foreach ($client_groups as $client_group) {
                        $inv_days_before_renewal = $this->ClientGroups->getSetting($client_group->id, 'inv_days_before_renewal');
                        $pre_renewal_invoice_date = $this->Date->modify(
                                date('c'),
                                '+' . (($inv_days_before_renewal->value ?? 0) + 5) . ' days',
                                'Y-m-d 00:00:00',
                                Configure::get('Blesta.company_timezone')
                            );
                        $filters = [
                            'services' => [
                                ['column' => 'date_renews', 'operator' => '<=', 'value' => $pre_renewal_invoice_date]
                            ],
                            'clients' => [
                                ['column' => 'client_group_id', 'operator' => '=', 'value' => $client_group->id]
                            ],
                        ];
                        $services = $this->DomainsDomains->getAll([], ['date_added' => 'DESC'], $filters);
                        $this->synchronizeDomainServices($services, $renewal_days);
                    }
        {code}
        Hide
        admin Paul Phillips added a comment -

        One customer that implemented this shared a screenshot of the module log that seemed to indicate the sync sync'd the same exact domain 3 times in a row as part of the same sync run. Not sure the cause in that case, but we should make sure that this implementation does not allow for this.

        Show
        admin Paul Phillips added a comment - One customer that implemented this shared a screenshot of the module log that seemed to indicate the sync sync'd the same exact domain 3 times in a row as part of the same sync run. Not sure the cause in that case, but we should make sure that this implementation does not allow for this.
        abdy Abdy Franco made changes -
        Assignee Abdy Franco [ abdy ]
        abdy Abdy Franco made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        abdy Abdy Franco made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 33 minutes [ 1980 ]
        Worklog Id 17969 [ 17969 ]
        abdy Abdy Franco made changes -
        Status In Progress [ 3 ] In Review [ 5 ]
        Resolution Fixed [ 1 ]
        jonathan Jonathan Reissmueller made changes -
        Status In Review [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            abdy Abdy Franco
            Reporter:
            jonathan Jonathan Reissmueller
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 33 minutes
              33m

                Agile