mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:07:32 -05:00 
			
		
		
		
	Fixes for Zoho imports
This commit is contained in:
		
							parent
							
								
									79ef62fefb
								
							
						
					
					
						commit
						e719c659ea
					
				@ -62,7 +62,7 @@ class BaseTransformer
 | 
				
			|||||||
    public function getClient($client_name, $client_email) {
 | 
					    public function getClient($client_name, $client_email) {
 | 
				
			||||||
		$clients = $this->maps['company']->clients;
 | 
							$clients = $this->maps['company']->clients;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$clients = $clients->where( 'name', $client_name );
 | 
							$clients = $clients->where( 'id_number', $client_name );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ( $clients->count() >= 1 ) {
 | 
							if ( $clients->count() >= 1 ) {
 | 
				
			||||||
			return $clients->first()->id;
 | 
								return $clients->first()->id;
 | 
				
			||||||
 | 
				
			|||||||
@ -42,7 +42,7 @@ class ClientTransformer extends BaseTransformer {
 | 
				
			|||||||
			'work_phone'    => $this->getString( $data, 'Phone' ),
 | 
								'work_phone'    => $this->getString( $data, 'Phone' ),
 | 
				
			||||||
			'private_notes' => $this->getString( $data, 'Notes' ),
 | 
								'private_notes' => $this->getString( $data, 'Notes' ),
 | 
				
			||||||
			'website'       => $this->getString( $data, 'Website' ),
 | 
								'website'       => $this->getString( $data, 'Website' ),
 | 
				
			||||||
 | 
								'id_number'		=> $this->getString( $data, 'Customer ID'),
 | 
				
			||||||
			'address1'    => $this->getString( $data, 'Billing Address' ),
 | 
								'address1'    => $this->getString( $data, 'Billing Address' ),
 | 
				
			||||||
			'address2'    => $this->getString( $data, 'Billing Street2' ),
 | 
								'address2'    => $this->getString( $data, 'Billing Street2' ),
 | 
				
			||||||
			'city'        => $this->getString( $data, 'Billing City' ),
 | 
								'city'        => $this->getString( $data, 'Billing City' ),
 | 
				
			||||||
 | 
				
			|||||||
@ -38,7 +38,7 @@ class InvoiceTransformer extends BaseTransformer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		$transformed = [
 | 
							$transformed = [
 | 
				
			||||||
			'company_id'   => $this->maps['company']->id,
 | 
								'company_id'   => $this->maps['company']->id,
 | 
				
			||||||
			'client_id'    => $this->getClient( $this->getString( $invoice_data, 'Company Name' ), null ),
 | 
								'client_id'    => $this->getClient( $this->getString( $invoice_data, 'Customer ID' ), null ),
 | 
				
			||||||
			'number'       => $this->getString( $invoice_data, 'Invoice Number' ),
 | 
								'number'       => $this->getString( $invoice_data, 'Invoice Number' ),
 | 
				
			||||||
			'date'         => isset( $invoice_data['Invoice Date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['Invoice Date'] ) ) : null,
 | 
								'date'         => isset( $invoice_data['Invoice Date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['Invoice Date'] ) ) : null,
 | 
				
			||||||
			'due_date'     => isset( $invoice_data['Due Date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['Due Date'] ) ) : null,
 | 
								'due_date'     => isset( $invoice_data['Due Date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['Due Date'] ) ) : null,
 | 
				
			||||||
@ -59,7 +59,7 @@ class InvoiceTransformer extends BaseTransformer {
 | 
				
			|||||||
				'notes'              => $this->getString( $record, 'Item Description' ),
 | 
									'notes'              => $this->getString( $record, 'Item Description' ),
 | 
				
			||||||
				'cost'               => $this->getFloat( $record, 'Item Price' ),
 | 
									'cost'               => $this->getFloat( $record, 'Item Price' ),
 | 
				
			||||||
				'quantity'           => $this->getFloat( $record, 'Quantity' ),
 | 
									'quantity'           => $this->getFloat( $record, 'Quantity' ),
 | 
				
			||||||
				'discount'           => $this->getFloat( $record, 'Discount Amount' ),
 | 
									'discount'           => $this->getString( $record, 'Discount Amount' ),
 | 
				
			||||||
				'is_amount_discount' => true,
 | 
									'is_amount_discount' => true,
 | 
				
			||||||
			];
 | 
								];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -111,7 +111,8 @@ class DeletePayment
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    //If the invoice is deleted we only update the meta data on the invoice
 | 
					                    //If the invoice is deleted we only update the meta data on the invoice
 | 
				
			||||||
                    //and reduce the clients paid to date
 | 
					                    //and reduce the clients paid to date
 | 
				
			||||||
                    $paymentable_invoice->updatePaidToDate($net_deletable * -1)
 | 
					                    $paymentable_invoice->service()
 | 
				
			||||||
 | 
					                                        ->updatePaidToDate($net_deletable * -1)
 | 
				
			||||||
                                        ->save();
 | 
					                                        ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    $paymentable_invoice->client
 | 
					                    $paymentable_invoice->client
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user