!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.4.18 (Ubuntu). PHP/7.0.33-0ubuntu0.16.04.16 

uname -a: Linux digifus 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/almazen_alfa/ahab/resources/   drwxr-xr-x
Free 10.13 GB of 29.4 GB (34.45%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     order_resource.py (1.86 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
from ahab.resources.base_resource import BaseResource
from ahab.models.model import Model
from ahab.models.stock_model import StockModel
from json import loads
from flask import request


class OrderResource(BaseResource):
    def __init__(self):
        self.labels={
                'id_estado' : 'status',
                'id_pedido': 'order_id',
                'vendedor': 'seller_id',
                'id_cliente': 'client_id',
                'descuento': 'discount',
                'fecha': 'date'
        }
        BaseResource.__init__(self, 'pedidos',
            'id_pedido',
            labels=self.labels
        )
        self.items_model = Model('detalle_pedido', 'id')
        self.stock_model = StockModel()

    def post(self):
        data = loads(request.data)
        print "*"*10, data, "*"*10
        input = {}
        for d in data:
            if d in self.labels.values():
                input[self.labels.keys()[self.labels.values().index(d)]] = data[d]
            else:
                input[d] = data[d]

        input.pop('products', None)
        if 'client_name' in data:
            client = Model('clientes','id').get_by(**{'nombre': data['client_name']})
            print 'client {}'.format(client)
            input.pop('client_name', None)
            input.update({'id_cliente': client['id']})
 
        output = self.model.create(input)
        for p in data['products']:
            product_data = Model('productos', 'nombre').get(p['name'])
            item = {
                'id_pedido': output['id_pedido'],
                'cantidad': p['count'],
                'nombre_producto': p['name'],
                'precio': product_data['precio_venta']
            }
            self.items_model.create(item)
            self.stock_model.remove_stock(p['name'], p['count'])

        output.update({'products': data['products']})
        return output, 200


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0051 ]--