mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:57:32 -05:00 
			
		
		
		
	add checks prior to attempting to add in payment types
This commit is contained in:
		
							parent
							
								
									1ebaea42d1
								
							
						
					
					
						commit
						70db8052c0
					
				@ -56,6 +56,7 @@ class PaymentType extends StaticModel
 | 
				
			|||||||
    const INSTANT_BANK_PAY = 45;
 | 
					    const INSTANT_BANK_PAY = 45;
 | 
				
			||||||
    const FPX = 46;
 | 
					    const FPX = 46;
 | 
				
			||||||
    const KLARNA = 47;
 | 
					    const KLARNA = 47;
 | 
				
			||||||
 | 
					    const Interac_E_Transfer = 48;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function parseCardType($cardName)
 | 
					    public static function parseCardType($cardName)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
@ -21,9 +21,11 @@ class PDF extends FPDI
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->SetXY(0, -5);
 | 
					        $this->SetXY(0, -5);
 | 
				
			||||||
        $this->SetFont('Arial', 'I', 9);
 | 
					        $this->SetFont('Arial', 'I', 9);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->SetTextColor(135, 135, 135);
 | 
					        $this->SetTextColor(135, 135, 135);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $trans = ctrans('texts.pdf_page_info', ['current' => $this->PageNo(), 'total' => '{nb}']);
 | 
					        $trans = ctrans('texts.pdf_page_info', ['current' => $this->PageNo(), 'total' => '{nb}']);
 | 
				
			||||||
 | 
					        $trans = iconv('UTF-8', 'ISO-8859-7', $trans);
 | 
				
			||||||
        $this->Cell(0, 5, $trans, 0, 0, $this->text_alignment);
 | 
					        $this->Cell(0, 5, $trans, 0, 0, $this->text_alignment);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -14,21 +14,37 @@ return new class extends Migration {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function up()
 | 
					    public function up()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Schema::table('payment_types', function (Blueprint $table) {
 | 
					        $pt = PaymentType::find(47);
 | 
				
			||||||
            $type = new PaymentType();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(!$pt)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            $type = new PaymentType();
 | 
				
			||||||
            $type->id = 47;
 | 
					            $type->id = 47;
 | 
				
			||||||
            $type->name = 'Klarna';
 | 
					            $type->name = 'Klarna';
 | 
				
			||||||
            $type->gateway_type_id = GatewayType::KLARNA;
 | 
					            $type->gateway_type_id = GatewayType::KLARNA;
 | 
				
			||||||
 | 
					 | 
				
			||||||
            $type->save();
 | 
					            $type->save();
 | 
				
			||||||
        });
 | 
					        }
 | 
				
			||||||
        $type = new GatewayType();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $pt = PaymentType::find(48);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(!$pt)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            $type = new PaymentType();
 | 
				
			||||||
 | 
					            $type->id = 48;
 | 
				
			||||||
 | 
					            $type->name = 'Interac E-Transfer';
 | 
				
			||||||
 | 
					            $type->save();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $gt = GatewayType::find(23);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(!$gt)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            $type = new GatewayType();
 | 
				
			||||||
            $type->id = 23;
 | 
					            $type->id = 23;
 | 
				
			||||||
            $type->alias = 'klarna';
 | 
					            $type->alias = 'klarna';
 | 
				
			||||||
            $type->name = 'Klarna';
 | 
					            $type->name = 'Klarna';
 | 
				
			||||||
 | 
					 | 
				
			||||||
            $type->save();
 | 
					            $type->save();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -17,5 +17,6 @@ return new class extends Migration
 | 
				
			|||||||
            $table->string('matomo_url',191)->nullable();
 | 
					            $table->string('matomo_url',191)->nullable();
 | 
				
			||||||
            $table->bigInteger('matomo_id')->nullable();
 | 
					            $table->bigInteger('matomo_id')->nullable();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -4891,7 +4891,7 @@ $LANG = array(
 | 
				
			|||||||
    'restored_transaction_rule' => 'Successfully restored transaction rule',
 | 
					    'restored_transaction_rule' => 'Successfully restored transaction rule',
 | 
				
			||||||
    'search_transaction_rule' => 'Search Transaction Rule',
 | 
					    'search_transaction_rule' => 'Search Transaction Rule',
 | 
				
			||||||
    'search_transaction_rules' => 'Search Transaction Rules',
 | 
					    'search_transaction_rules' => 'Search Transaction Rules',
 | 
				
			||||||
 | 
					    'payment_type_Interac E-Transfer' => 'Interac E-Transfer',
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
return $LANG;
 | 
					return $LANG;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user