mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 01:17:30 -05:00 
			
		
		
		
	Merge pull request #7143 from turbo124/v5-develop
Fixes for recurring invoice opt out autobilling
This commit is contained in:
		
						commit
						ff0a74a3b8
					
				
							
								
								
									
										52
									
								
								database/migrations/2022_01_19_232436_add_kyd_currency.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								database/migrations/2022_01_19_232436_add_kyd_currency.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,52 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use App\Models\Currency;
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
use Illuminate\Database\Schema\Blueprint;
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
 | 
			
		||||
class AddKydCurrency extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    { 
 | 
			
		||||
 | 
			
		||||
        $currencies = [
 | 
			
		||||
 | 
			
		||||
            ['id' => 112, 'name' => 'Cayman Island Dollar', 'code' => 'KYD', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
 | 
			
		||||
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        foreach ($currencies as $currency) {
 | 
			
		||||
            $record = Currency::whereCode($currency['code'])->first();
 | 
			
		||||
            if ($record) {
 | 
			
		||||
                $record->name = $currency['name'];
 | 
			
		||||
                $record->symbol = $currency['symbol'];
 | 
			
		||||
                $record->precision = $currency['precision'];
 | 
			
		||||
                $record->thousand_separator = $currency['thousand_separator'];
 | 
			
		||||
                $record->decimal_separator = $currency['decimal_separator'];
 | 
			
		||||
                if (isset($currency['swap_currency_symbol'])) {
 | 
			
		||||
                    $record->swap_currency_symbol = $currency['swap_currency_symbol'];
 | 
			
		||||
                }
 | 
			
		||||
                $record->save();
 | 
			
		||||
            } else {
 | 
			
		||||
                Currency::create($currency);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        //
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<label class="flex items-center cursor-pointer">
 | 
			
		||||
    <input type="checkbox" class="form-checkbox mr-2"
 | 
			
		||||
           wire:change="updateAutoBilling" {{ $invoice->auto_bill_enabled || $invoice->auto_bill === 'optout' ? 'checked' : '' }}>
 | 
			
		||||
           wire:change="updateAutoBilling" {{ $invoice->auto_bill_enabled ? 'checked' : '' }}>
 | 
			
		||||
 | 
			
		||||
    <span class="text-sm leading-5 font-medium text-gray-900">
 | 
			
		||||
        {{ $invoice->auto_bill_enabled || $invoice->auto_bill === 'optout' ? ctrans('texts.auto_bill_enabled') : ctrans('texts.auto_bill_disabled') }}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user