mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:07:33 -05:00 
			
		
		
		
	Merge pull request #6284 from turbo124/v5-develop
Fixes for importing payments with non-transformed invoices
This commit is contained in:
		
						commit
						b7b3a8f95c
					
				@ -558,14 +558,12 @@ class Import implements ShouldQueue
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $value = trim($value);
 | 
					        $value = trim($value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $model_query = (new $model())
 | 
					        $model_query = $model::where($column, $value)
 | 
				
			||||||
                            ->query()
 | 
					                             ->where('company_id', $this->company->id)
 | 
				
			||||||
                            ->where($column, $value)
 | 
					                             ->exists();
 | 
				
			||||||
                            ->where('company_id', $this->company->id)
 | 
					 | 
				
			||||||
                            ->exists();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($model_query)
 | 
					        if($model_query)
 | 
				
			||||||
            return $value.'_'. Str::random(5);
 | 
					            return $value . '_' . Str::random(5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $value;
 | 
					        return $value;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -1102,10 +1100,8 @@ class Import implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $modified['client_id'] = $this->transformId('clients', $resource['client_id']);
 | 
					            $modified['client_id'] = $this->transformId('clients', $resource['client_id']);
 | 
				
			||||||
            $modified['user_id'] = $this->processUserId($resource);
 | 
					            $modified['user_id'] = $this->processUserId($resource);
 | 
				
			||||||
            //$modified['invoice_id'] = $this->transformId('invoices', $resource['invoice_id']);
 | 
					 | 
				
			||||||
            $modified['company_id'] = $this->company->id;
 | 
					            $modified['company_id'] = $this->company->id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //unset($modified['invoices']);
 | 
					 | 
				
			||||||
            unset($modified['invoice_id']);
 | 
					            unset($modified['invoice_id']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (isset($modified['invoices'])) {
 | 
					            if (isset($modified['invoices'])) {
 | 
				
			||||||
@ -1114,8 +1110,8 @@ class Import implements ShouldQueue
 | 
				
			|||||||
                        $modified['invoices'][$key]['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']);
 | 
					                        $modified['invoices'][$key]['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                       nlog($modified['invoices']);
 | 
					                       nlog($modified['invoices']);
 | 
				
			||||||
                        // $modified['credits'][$key]['credit_id'] = $this->transformId('credits', $invoice['invoice_id']);
 | 
					                       unset($modified['invoices']);
 | 
				
			||||||
                        // $modified['credits'][$key]['amount'] = $modified['invoices'][$key]['amount'];
 | 
					                       //if the transformation didn't work - you _must_ unset this data as it will be incorrect!
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -29,6 +29,7 @@ class PaymentType extends StaticModel
 | 
				
			|||||||
    const NOVA = 11;
 | 
					    const NOVA = 11;
 | 
				
			||||||
    const CREDIT_CARD_OTHER = 12;
 | 
					    const CREDIT_CARD_OTHER = 12;
 | 
				
			||||||
    const PAYPAL = 13;
 | 
					    const PAYPAL = 13;
 | 
				
			||||||
 | 
					    const CHECK = 15;
 | 
				
			||||||
    const CARTE_BLANCHE = 16;
 | 
					    const CARTE_BLANCHE = 16;
 | 
				
			||||||
    const UNIONPAY = 17;
 | 
					    const UNIONPAY = 17;
 | 
				
			||||||
    const JCB = 18;
 | 
					    const JCB = 18;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user