mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-31 13:41:09 -04:00 
			
		
		
		
	Merge branch 'master' of gitlab.com:mohit.panjvani/crater-web
This commit is contained in:
		| @ -105,13 +105,6 @@ class CompanyController extends Controller | ||||
|             ['key' => 'december-november', 'value' => '12-11'], | ||||
|         ]; | ||||
|  | ||||
|         $languages = [ | ||||
|             "en" => "English", | ||||
|             "de" => "German", | ||||
|             "fr" => "French", | ||||
|             "es" => "Spanish" | ||||
|         ]; | ||||
|  | ||||
|         $language = CompanySetting::getSetting('language', $request->header('company')); | ||||
|         $carbon_date_format = CompanySetting::getSetting('carbon_date_format', $request->header('company')); | ||||
|         $moment_date_format = CompanySetting::getSetting('moment_date_format', $request->header('company')); | ||||
| @ -121,7 +114,6 @@ class CompanyController extends Controller | ||||
|  | ||||
|         $languages = [ | ||||
|             ["code"=>"en", "name" => "English"], | ||||
|             ["code"=>"de", "name" => "German"], | ||||
|             ["code"=>"fr", "name" => "French"], | ||||
|             ["code"=>"es", "name" => "Spanish"] | ||||
|         ]; | ||||
|  | ||||
| @ -55,6 +55,7 @@ class ItemsController extends Controller | ||||
|  | ||||
|         if ($request->has('taxes')) { | ||||
|             foreach ($request->taxes as $tax) { | ||||
|                 $tax['company_id'] = $request->header('company'); | ||||
|                 $item->taxes()->create($tax); | ||||
|             } | ||||
|         } | ||||
| @ -75,12 +76,16 @@ class ItemsController extends Controller | ||||
|         $item->price = $request->price; | ||||
|         $item->save(); | ||||
|  | ||||
|         $oldTaxes = $item->taxes->toArray(); | ||||
|  | ||||
|         foreach ($oldTaxes as $oldTax) { | ||||
|             Tax::destroy($oldTax['id']); | ||||
|         } | ||||
|  | ||||
|         if ($request->has('taxes')) { | ||||
|             foreach ($request->taxes as $tax) { | ||||
|                 $item->taxes()->updateOrCreate( | ||||
|                     ['tax_type_id' => $tax['tax_type_id']], | ||||
|                     ['amount' => $tax['amount'], 'percent' => $tax['percent'], 'name' => $tax['name']] | ||||
|                 ); | ||||
|                 $tax['company_id'] = $request->header('company'); | ||||
|                 $item->taxes()->create($tax); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|  | ||||
| @ -38,7 +38,8 @@ class OnboardingController extends Controller | ||||
|         $time_zones = TimeZones::get_list(); | ||||
|         $languages = [ | ||||
|             ["code"=>"en", "name" => "English"], | ||||
|             ["code"=>"de", "name" => "German"], | ||||
|             ["code"=>"fr", "name" => "French"], | ||||
|             ["code"=>"es", "name" => "Spanish"] | ||||
|         ]; | ||||
|         $fiscal_years = [ | ||||
|             ['key' => 'january-december' , 'value' => '1-12'], | ||||
|  | ||||
| @ -1,32 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Crater\Listeners\Updates\V10; | ||||
|  | ||||
| use Illuminate\Contracts\Queue\ShouldQueue; | ||||
| use Illuminate\Queue\InteractsWithQueue; | ||||
| use Crater\Listeners\Updates\Listener; | ||||
| use Crater\Events\UpdateFinished; | ||||
| use Illuminate\Support\Facades\Artisan; | ||||
| use Crater\Setting; | ||||
|  | ||||
| class Version101 extends Listener | ||||
| { | ||||
|     const VERSION = '1.0.1'; | ||||
|  | ||||
|     /** | ||||
|      * Handle the event. | ||||
|      * | ||||
|      * @param  object  $event | ||||
|      * @return void | ||||
|      */ | ||||
|     public function handle(UpdateFinished $event) | ||||
|     { | ||||
|         if (!$this->check($event)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); | ||||
|  | ||||
|         Setting::setSetting('version', self::VERSION); | ||||
|     } | ||||
| } | ||||
| @ -5,7 +5,6 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvi | ||||
| use Illuminate\Auth\Events\Registered; | ||||
| use Illuminate\Auth\Listeners\SendEmailVerificationNotification; | ||||
| use Crater\Events\UpdateFinished; | ||||
| use Crater\Listeners\Updates\V10\Version101; | ||||
|  | ||||
| class EventServiceProvider extends ServiceProvider | ||||
| { | ||||
| @ -16,7 +15,6 @@ class EventServiceProvider extends ServiceProvider | ||||
|      */ | ||||
|     protected $listen = [ | ||||
|         UpdateFinished::class=> [ | ||||
|             Version101::class, | ||||
|         ], | ||||
|         Registered::class => [ | ||||
|             SendEmailVerificationNotification::class, | ||||
|  | ||||
| @ -11,7 +11,7 @@ trait SiteApi | ||||
|  | ||||
|     protected static function getRemote($url, $data = array()) | ||||
|     { | ||||
|         $base = 'http://crater-main.test/'; | ||||
|         $base = 'https://craterapp.com/'; | ||||
|  | ||||
|         $client = new Client(['verify' => false, 'base_uri' => $base]); | ||||
|  | ||||
|  | ||||
| @ -48,36 +48,37 @@ class Updater | ||||
|             File::makeDirectory($temp_path2); | ||||
|         } | ||||
|  | ||||
|         $file = $temp_path . '/upload.zip'; | ||||
|  | ||||
|         // Add content to the Zip file | ||||
|         $uploaded = is_int(file_put_contents($file, $data)) ? true : false; | ||||
|  | ||||
|         if (!$uploaded) { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         // Unzip the file | ||||
|         $zip = new ZipArchive(); | ||||
|  | ||||
|         if ($zip->open($file)) { | ||||
|             $zip->extractTo($temp_path2); | ||||
|         } | ||||
|  | ||||
|         $zip->close(); | ||||
|  | ||||
|         // Delete zip file | ||||
|         File::delete($file); | ||||
|  | ||||
|         if (!File::copyDirectory($temp_path2.'/crater', base_path())) { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         // Delete temp directory | ||||
|         File::deleteDirectory($temp_path); | ||||
|         File::deleteDirectory($temp_path2); | ||||
|  | ||||
|         try { | ||||
|  | ||||
|             $file = $temp_path . '/upload.zip'; | ||||
|  | ||||
|             // Add content to the Zip file | ||||
|             $uploaded = is_int(file_put_contents($file, $data)) ? true : false; | ||||
|  | ||||
|             if (!$uploaded) { | ||||
|                 return false; | ||||
|             } | ||||
|  | ||||
|             // Unzip the file | ||||
|             $zip = new ZipArchive(); | ||||
|  | ||||
|             if ($zip->open($file)) { | ||||
|                 $zip->extractTo($temp_path2); | ||||
|             } | ||||
|  | ||||
|             $zip->close(); | ||||
|  | ||||
|             // Delete zip file | ||||
|             File::delete($file); | ||||
|  | ||||
|             if (!File::copyDirectory($temp_path2.'/Crater', base_path())) { | ||||
|                 return false; | ||||
|             } | ||||
|  | ||||
|             // Delete temp directory | ||||
|             File::deleteDirectory($temp_path); | ||||
|             File::deleteDirectory($temp_path2); | ||||
|  | ||||
|             if (!$isMinor) { | ||||
|                 event(new UpdateFinished($installed, $version)); | ||||
|             } | ||||
| @ -88,6 +89,13 @@ class Updater | ||||
|                 'data' => [] | ||||
|             ]; | ||||
|         } catch (\Exception $e) { | ||||
|  | ||||
|             if (File::isDirectory($temp_path)) { | ||||
|                 // Delete temp directory | ||||
|                 File::deleteDirectory($temp_path); | ||||
|                 File::deleteDirectory($temp_path2); | ||||
|             } | ||||
|  | ||||
|             return [ | ||||
|                 'success' => false, | ||||
|                 'error' => 'Update error', | ||||
|  | ||||
		Reference in New Issue
	
	Block a user