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

Import Manager: Duplicate id error for WHMCS 5.2-7.10 migrator

    Details

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

      Description

      
      Array
      (
          \[error\] => Array
              (
                  \[0\] => The import completed but the following errors ocurred:
                  \[1\] => importClients: SQLSTATE\[23000\]: Integrity constraint violation: 1062 Duplicate entry '35' for key 'PRIMARY' on line 196
                  \[2\] => importContacts: There is already an active transaction on line 231
                  \[3\] => importTaxes: There is already an active transaction on line 231
                  \[4\] => importCurrencies: SQLSTATE\[HY093\]: Invalid parameter number: number of bound variables does not match number of tokens on line 196
                  \[5\] => importInvoices: There is already an active transaction on line 231
                  \[6\] => importTransactions: There is already an active transaction on line 231
                  \[7\] => importPackages: SQLSTATE\[HY093\]: Invalid parameter number: number of bound variables does not match number of tokens on line 196
                  \[8\] => importServices: There is already an active transaction on line 231
                  \[9\] => importSupportDepartments: There is already an active transaction on line 231
                  \[10\] => importSupportTickets: There is already an active transaction on line 231
                  \[11\] => importAffiliates: There is already an active transaction on line 231
                  \[12\] => importMisc: There is already an active transaction on line 231
              )
      )
      

      To resolve:
      In plugins/import_manager/components/migrators/whmcs/whmcs_migrator.php change line 340 from

                      // Set account for autodebit
                      if ($account_id) {
                          $vars = [
                              'client_id' => $this->mappings['clients'][$client->id],
                              'account_id' => $account_id,
                              'type' => 'cc'
                          ];
                          $this->local->insert('client_account', $vars);
                      }
      

      To

                      // Set account for autodebit
                      if ($account_id) {
                          try {
                              $vars = [
                                  'client_id' => $this->mappings['clients'][$client->id],
                                  'account_id' => $account_id,
                                  'type' => 'cc'
                              ];
                              $this->local->insert('client_account', $vars);
                          } catch (Exception $e) {
                              $this->local->reset();
                              // Skip duplicated entry
                              continue;
                          }
                      }
      

        Activity

        jonathan Jonathan Reissmueller created issue -
        jonathan Jonathan Reissmueller made changes -
        Field Original Value New Value
        Sprint 5.2.0 Sprint 3 [ 140 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Assignee Jonathan Reissmueller [ jonathan ]
        jonathan Jonathan Reissmueller made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        jonathan Jonathan Reissmueller made changes -
        Status In Progress [ 3 ] In Review [ 5 ]
        Resolution Fixed [ 1 ]
        jonathan Jonathan Reissmueller made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 7 minutes [ 420 ]
        Worklog Id 15240 [ 15240 ]
        jonathan Jonathan Reissmueller made changes -
        Status In Review [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            jonathan Jonathan Reissmueller
            Reporter:
            jonathan Jonathan Reissmueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              24/Aug/21

              Time Tracking

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

                Agile