Question: Error When Need To Delete Or Edit The Invoice

Error When Need To Delete Or Edit The Invoice

i found some error when i need edit or delete the invoice when i need delete the invoice come out 419 unknow status 419 Unknown Status The page token has been expired! please click OK to r

W

Wordpress实战教学

Asked

i found some error when i need edit or delete the invoice

when i need delete the invoice come out 419 unknow status

419 Unknown Status The page token has been expired! please click OK to refresh then try again.

this i found at F12

TypeError: Cannot read property ‘status’ of null at Mn. (app.js?id=a2c86405dcf4d4f19f65:2) at Wt (app.js?id=a2c86405dcf4d4f19f65:2) at Mn.INkZ.t.$emit (app.js?id=a2c86405dcf4d4f19f65:2) at t.value (app.js?id=a2c86405dcf4d4f19f65:2) at components.a46bdd7d9eaef7df672b.js?_sw-precache=39439ab06b7a5b62c47a44e25ee506f4:1

Failed to load resource: the server responded with a status of 419 (unknown status)

Thanks for help *xampp

  • MS

    Mian Saleem

    Answered

    Hello,

    The issue is due to payment. I will fix this in next update.

    I have seen errors mostly for database connection.

    Thank you

  • MS

    Mian Saleem

    Answered

    Hello,

    Please replace the contents of app/Invoice.php with follwoing

    <?php
    
    namespace App;
    
    use Ulid\Ulid;
    use App\Traits\VueTable;
    use App\Traits\LogActivity;
    use Illuminate\Support\Str;
    use App\Traits\Restrictable;
    use App\Traits\AttributableModel;
    use Illuminate\Database\Eloquent\Model;
    
    class Invoice extends Model
    {
        use AttributableModel;
        use LogActivity;
        use Restrictable;
        use VueTable;
    
        public static $columns = ['id', 'date', 'reference', 'customer.name', 'draft'];
    
        protected $casts = ['draft' => 'boolean'];
    
        protected $fillable = [
            'date', 'reference', 'hash', 'draft', 'user_id', 'paid', 'note',
            'customer_id', 'total', 'grand_total', 'all_taxes', 'recurring_id',
            'discount', 'product_tax_amount', 'order_tax_amount', 'total_tax_amount',
        ];
    
        protected $hidden = ['updated_at'];
    
        protected $with = ['customer', 'taxes'];
    
        protected static function boot()
        {
            parent::boot();
    
            static::creating(function ($model) {
                if (!$model->reference) {
                    $model->reference = Ulid::generate(true);
                }
            });
    
            static::created(function ($invoice) {
                $invoice->disableLogging();
                $invoice->fill(['hash' => sha1(now() . Str::random())])->save();
            });
    
            static::deleting(function ($invoice) {
                $invoice->directPayments()->update(['invoice_id' => null]);
                $invoice->payments()->detach();
                $invoice->taxes()->detach();
                $invoice->items()->delete();
            });
        }
    
        public function company()
        {
            return $this->belongsTo(Company::class);
        }
    
        public function customer()
        {
            return $this->belongsTo(Customer::class);
        }
    
        public function directPayments()
        {
            return $this->hasMany(Payment::class);
        }
    
        public function items()
        {
            return $this->hasMany(InvoiceItem::class);
        }
    
        public function payments()
        {
            return $this->belongsToMany(Payment::class)->withPivot('amount');
        }
    
        public function routeNotificationForMail($notification)
        {
            return $this->customer->email;
        }
    
        public static function scopeActive($query)
        {
            return $query->whereDraft('0')->orWhereNull('draft');
        }
    
        public static function scopeOfCustomer($query, $customer_id)
        {
            return $query->where('customer_id', $customer_id);
        }
    
        public static function scopePaid($query)
        {
            return $query->where('paid', 1);
        }
    
        public static function scopeUnpaid($query)
        {
            return $query->wherePaid('0')->orWhereNull('paid');
        }
    
        public function taxes()
        {
            return $this->morphToMany(Tax::class, 'taxable')->withPivot('total_amount');
        }
    
        public function user()
        {
            return $this->belongsTo(User::class);
        }
    }
    
    

    This should fix the delete invoice issue.

    Thank you

  • W

    Wordpress实战教学

    Answered

    yes follow your step i done deleted the old invoice but i cant create a new invoice anymore… come out this error

    TypeError: Cannot read property ‘qty’ of null at components.a46bdd7d9eaef7df672b.js?_sw-precache=39439ab06b7a5b62c47a44e25ee506f4:1 at o.ve [as _l] (app.js?id=a2c86405dcf4d4f19f65:2) at o. (components.a46bdd7d9eaef7df672b.js?_sw-precache=39439ab06b7a5b62c47a44e25ee506f4:1) at o.INkZ.t._render (app.js?id=a2c86405dcf4d4f19f65:2) at o.r (app.js?id=a2c86405dcf4d4f19f65:2) at fn.INkZ.fn.get (app.js?id=a2c86405dcf4d4f19f65:2) at fn.INkZ.fn.run (app.js?id=a2c86405dcf4d4f19f65:2) at dn (app.js?id=a2c86405dcf4d4f19f65:2) at Array. (app.js?id=a2c86405dcf4d4f19f65:2) at Kt (app.js?id=a2c86405dcf4d4f19f65:2)

  • W

    Wordpress实战教学

    Answered

    and need edit for old invoice come out this error

    Manifest: Line: 1, column: 1, Syntax error. 2app.js?id=a2c86405dcf4d4f19f65:2 TypeError: Cannot read property ‘status’ of null at Mn. (app.js?id=a2c86405dcf4d4f19f65:2) at Wt (app.js?id=a2c86405dcf4d4f19f65:2) at Mn.INkZ.t.$emit (app.js?id=a2c86405dcf4d4f19f65:2) at t.value (app.js?id=a2c86405dcf4d4f19f65:2) at components.a46bdd7d9eaef7df672b.js?_sw-precache=39439ab06b7a5b62c47a44e25ee506f4:1

  • MS

    Mian Saleem

    Answered

    Hello,

    If front-end didn’t get the expect data, it will log such errors. These are not helpful at all as the javascript code is minified.

    I have check. I can add/edit invoices. My settings might be different or the issue might be totally different. Please check the latest error logs from storage/logs/ folder and let me know the last error.

    Thank you

  • W

    Wordpress实战教学

    Answered

    sorry for late reply below the attachments is the logs file thanks

    Attachments
  • MS

    Mian Saleem

    Answered

    Hello,

    I have checked the log. There are mixup errors. Is your install working as I have seen

    1. No application encryption key has been specified 2.Unable to send email, please check your system settings. Error: Failed to authenticate on SMTP server with username “SKGMARKETING”
    2. Access denied for user ‘forge’@‘localhost’ (using password: NO)

    Please let me know the installation link in private reply with login details to have a look.

    Thank you

  • W

    Wordpress实战教学

    Answered

    what time you ready for help me the installation via teamviewer? bcos this install on xampp

  • MS

    Mian Saleem

    Answered

    Hello, I am sorry as I can’t use any remote access software. Can you please install it on live server to that I can check it for you?

  • W

    Wordpress实战教学

    Answered

    if i install to the hosting…after that can i move back to offline?

  • Login to Reply