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

        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.

          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