Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 817 | Revision 820 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 817 Revision 819
Zeile 21... Zeile 21...
21
    use App\Models\DirectoryMedium;
21
    use App\Models\DirectoryMedium;
22
    use App\Models\SalesPortal;
22
    use App\Models\SalesPortal;
23
    use App\Models\SalesPortalItem;
23
    use App\Models\SalesPortalItem;
24
    use App\Models\SalesPortalType;
24
    use App\Models\SalesPortalType;
25
    use App\Models\Shipping;
25
    use App\Models\Shipping;
-
 
26
    use App\Models\shippingCountry;
26
    use App\Models\ShippingGroup;
27
    use App\Models\ShippingGroup;
-
 
28
    use App\Models\shippingPaymentMethod;
27
    use App\Models\Shop;
29
    use App\Models\Shop;
28
    use App\Models\Template;
30
    use App\Models\Template;
29
    use App\Models\User;
31
    use App\Models\User;
30
    use App\Models\OrderItem;
32
    use App\Models\OrderItem;
31
    use Illuminate\Console\Command;
33
    use Illuminate\Console\Command;
Zeile 266... Zeile 268...
266
        private function migrateShippings()
268
        private function migrateShippings()
267
        {
269
        {
268
            $this->info( date( "d.m.Y H:i:s" ) . ": Migriere Versandoptionen" );
270
            $this->info( date( "d.m.Y H:i:s" ) . ": Migriere Versandoptionen" );
269
            $start = 0;
271
            $start = 0;
270
            $sql = "SELECT
272
            $sql = "SELECT
271
                    MAX(id) AS start
-
 
272
                FROM
-
 
273
                    shippings
-
 
274
            ";
-
 
275
            $row = DB::connection( "mysql" )->select( $sql );
-
 
276
            if ( $row[0]->start )
-
 
277
            {
-
 
278
                $start = $row[0]->start;
-
 
279
            }
-
 
280
            $sql = "SELECT
-
 
281
                    *
273
                    *
282
                FROM
274
                FROM
283
                    versand
275
                    versand
284
                WHERE
-
 
285
                    id>" . $start . "
-
 
286
            ";
276
            ";
287
            $methods = DB::connection( 'old' )->select( $sql );
277
            $methods = DB::connection( 'old' )->select( $sql );
288
            foreach ( $methods as $group )
278
            foreach ( $methods as $group )
289
            {
279
            {
-
 
280
                $item = Shipping::find( $group->ID );
-
 
281
                if ( isset( $item->id ) )
-
 
282
                {
-
 
283
                    $item->rank = $group->rang;
-
 
284
                    $item->shipping_group_id = $group->versandgruppen_id;
-
 
285
                    $item->name = $group->name;
-
 
286
                    $item->info_shop = $group->info_shop;
-
 
287
                    $item->info_mail = $group->info_mail;
-
 
288
                    $item->info_internal = $group->info_intern;
-
 
289
                    $item->island_shipping = $group->inselversand;
-
 
290
                    $item->additions = $group->zusaetze;
-
 
291
                    $item->status = $group->status;
-
 
292
                    $item->price = $group->preis;
-
 
293
                    $item->calc_weight_from = $group->berechnung_kg_von;
-
 
294
                    $item->calc_weight_to = $group->berechnung_kg_bis;
-
 
295
                    $item->calc_price_from = $group->berechnung_preis_von;
-
 
296
                    $item->calc_price_to = $group->berechnung_preis_bis;
-
 
297
                    $item->conditions = $group->bedingungen;
-
 
298
                    $item->tax_rate = $group->steuersatz;
-
 
299
                    $item->updated_by = $group->geaendert_von;
-
 
300
                    $item->updated_at = $group->bearbeitt_am;
-
 
301
                    $item->save();
-
 
302
                }
-
 
303
                else
-
 
304
                {
290
                Shipping::factory()->create( [
305
                    Shipping::factory()->create( [
291
                    "id"                => $group->id,
306
                        "id"                => $group->id,
292
                    "rank"              => $group->rang,
307
                        "rank"              => $group->rang,
293
                    "shipping_group_id" => $group->versandgruppen_id,
308
                        "shipping_group_id" => $group->versandgruppen_id,
294
                    "name"              => $group->name,
309
                        "name"              => $group->name,
295
                    "info_shop"         => $group->info_shop,
310
                        "info_shop"         => $group->info_shop,
296
                    "info_mail"         => $group->info_mail,
311
                        "info_mail"         => $group->info_mail,
297
                    "info_internal"     => $group->info_intern,
312
                        "info_internal"     => $group->info_intern,
298
                    "island_shipping"   => $group->inselversand,
313
                        "island_shipping"   => $group->inselversand,
299
                    "additions"         => $group->zusaetze,
314
                        "additions"         => $group->zusaetze,
300
                    "status"            => $group->status,
315
                        "status"            => $group->status,
301
                    "price"             => $group->preis,
316
                        "price"             => $group->preis,
302
                    "calc_weight_from"  => $group->berechnung_kg_von,
317
                        "calc_weight_from"  => $group->berechnung_kg_von,
303
                    "calc_weight_to"    => $group->berechnung_kg_bis,
318
                        "calc_weight_to"    => $group->berechnung_kg_bis,
304
                    "calc_price_from"   => $group->berechnung_preis_von,
319
                        "calc_price_from"   => $group->berechnung_preis_von,
305
                    "calc_price_to"     => $group->berechnung_preis_bis,
320
                        "calc_price_to"     => $group->berechnung_preis_bis,
306
                    "conditions"        => $group->bedingungen,
321
                        "conditions"        => $group->bedingungen,
307
                    "tax_rate"          => $group->steuersatz,
322
                        "tax_rate"          => $group->steuersatz,
308
                    "created_by"        => $group->erstellt_von,
323
                        "created_by"        => $group->erstellt_von,
309
                    "updated_by"        => $group->geaendert_von,
324
                        "updated_by"        => $group->geaendert_von,
310
                    "updated_at"        => $group->geaendert_am,
325
                        "updated_at"        => $group->geaendert_am,
311
                    "created_at"        => $group->erstellt_am,
326
                        "created_at"        => $group->erstellt_am,
-
 
327
                    ] );
-
 
328
                }
-
 
329
                $sql = "SELECT
-
 
330
                        *
-
 
331
                    FROM
-
 
332
                        versand_to_land
-
 
333
                    WHERE
-
 
334
                        verand_id=" . $group->id . "
-
 
335
                ";
-
 
336
                $r = DB::connection( 'old' )->select( $sql );
-
 
337
                foreach ( $r as $row )
-
 
338
                {
-
 
339
                    $item = ShippingCountry::where( "shipping_id", "=", $row->versand_id )->where( "country_id", "=", $row->land_id )->get();
-
 
340
                    if ( !isset( $item->id ) )
-
 
341
                    {
-
 
342
                        ShippingCountry::factory()->create( [ "shipping_id" => $row->versand_id, "country_id" => $row->land_id, ] );
-
 
343
                    }
-
 
344
                }
-
 
345
                $sql = "SELECT
-
 
346
                        *
-
 
347
                    FROM
-
 
348
                        versand_to_zahlarten
-
 
349
                    WHERE
-
 
350
                        verand_id=" . $group->id . "
312
                ] );
351
                ";
-
 
352
                $r = DB::connection( 'old' )->select( $sql );
-
 
353
                foreach ( $r as $row )
-
 
354
                {
-
 
355
                    $item = ShippingPaymentMethod::where( "shipping_id", "=", $row->versand_id )->where( "payment_method_id", "=", $row->zahlart_id )->get();
-
 
356
                    if ( !isset( $item->id ) )
-
 
357
                    {
-
 
358
                        ShippingPaymentMethod::factory()->create( [ "shipping_id" => $row->versand_id, "payment_method_id" => $row->zahlart_id, ] );
-
 
359
                    }
-
 
360
                }
313
            }
361
            }
314
        }
362
        }
Zeile 315... Zeile 363...
315
 
363
 
316
        private function migrateActions()
364
        private function migrateActions()