Busca los domicilios, devuelve la cantidad y establece la lista
329582
def ConsultarDomicilios(self, nro_doc, tipo_doc=80, cat_iva=None):
        ""
        self.cursor.execute("SELECT direccion FROM domicilio WHERE "
                            " tipo_doc=? AND nro_doc=? ORDER BY id ", 
                            [tipo_doc, nro_doc])
        filas = self.cursor.fetchall()
        self.domicilios = [fila['direccion'] for fila in filas]
        return len(filas)
837187
public function describe()
    {
        $columns = [];
        foreach ($this->columns as $id => $params) {
            $columns[$id] = [
                'title'     => $params['title'],
                'type'      => $params['type'],
                'filters'   => $params['filters'],
                'sortable'  => $params['sortable'],
                'visible'   => $params['visible'],
            ];
        }

        return [
            'columns' => $columns,
        ];
    }
580142
public function index() {
		$this->Prg->commonProcess();
        $conds = $this->Cliente->parseCriteria( $this->Prg->parsedParams() );
		$this->Cliente->recursive = 0;
                
        $descuentoMaximo = Configure::read('Mozo.descuento_maximo');
        $currentRole = $this->Session->read('Auth.User.role');
             
        
        if ( strtolower($currentRole) == 'mozo' && is_numeric( $descuentoMaximo ) ) {                
            $conds['OR'] = array(
                    "Descuento.porcentaje <= $descuentoMaximo",
                    'Descuento.porcentaje IS NULL'
                );
        }
        $this->Paginator->settings['conditions'] = $conds;
        
        $descuentos = $this->Cliente->Descuento->find('list');
		$tipoDocumentos = $this->Cliente->TipoDocumento->find('list');
		$ivaResponsabilidades = $this->Cliente->IvaResponsabilidad->find('list');
		$this->set(compact('descuentos', 'tipoDocumentos', 'ivaResponsabilidades'));
		$this->set('clientes', $this->Paginator->paginate());
		$this->set('_serialize', array('clientes'));
	}
33697
public function indexAction()
    {
        if (!$this->name) {
            return '';
        }
        //lista dozwolonych znaków
        $characters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'W', 'Z'];
        $word = '';
        $charsCount = count($characters) - 1;

        //generuje 5 literowy string
        for ($i = 0; $i < 5; $i++) {
            $word .= $characters[rand(0, $charsCount)];
        }

        //tworzenie obrazu
        $img = imagecreatetruecolor(130, 50);

        //konfiguracja kolorów
        $green = imagecolorallocate($img, 0x00, 0x77, 0x00);
        $gray = imagecolorallocate($img, 0xF5, 0xF5, 0xF5);
        $darkGray = imagecolorallocate($img, 0x99, 0x99, 0x99);

        //czcionka
        $font = BASE_PATH . '/web/resource/cmsAdmin/ttf/dejavu.ttf';

        //ramka
        imagefilledrectangle($img, 0, 0, 129, 49, $darkGray);
        imagefilledrectangle($img, 1, 1, 128, 48, $gray);

        $prevSpace = -5;
        $prevAngle = 0;

        //przesunięcia i obroty
        for ($i = 0; $i < strlen($word); $i++) {
            if ($i % 2 != 0) {
                $size = rand(32, 36);
                $height = rand(42, 46);
                $angle = rand(5, 15);
                $space = 25 + $prevSpace;
            } else {
                $size = rand(28, 32);
                $height = rand(39, 43);
                $angle = rand(-15, 5);
                $space = 13 + $prevSpace;
            }
            $prevSpace = $space;
            $prevAngle = $angle;
            imagefttext($img, $size, $angle, $space, $height, $green, $font, $word[$i]);
        }

        //zapis do sesji
        $formSession = new \Mmi\Session\SessionSpace('captcha');
        //filtracja nazwy pola z nazwy formularza + pola
        $name = strpos($this->name, '[') === false ? $this->name : substr($this->name, strpos($this->name, '[') + 1, -1);
        $formSession->$name = $word;

        //ustalenie nagłówka na niebuforowany
        $this->getResponse()
            ->setHeader('Expires', 'Mon, 15 Dec ' . (date('Y') - 1) . ' 01:00:00 GMT+0100')
            ->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT')
            ->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate')
            ->setHeader('Cache-Control', 'post-check=0, pre-check=0', false)
            ->setHeader('Pragma', 'no-cache')
            ->setTypeJpeg();

        //zwrot obrazu
        imagejpeg($img, NULL, 25);
        return '';
    }
102318
public function indexAction()
    {
        $config = clone (\App\Registry::$config);
        //za długie dane do wyświetlenia
        $config->navigation = self::THREE_DOTS;
        $config->router = self::THREE_DOTS;
        $this->view->config = \Mmi\Http\ResponseDebugger\Colorify::colorify(print_r($config, true));
        $this->view->server = \Mmi\Http\ResponseDebugger\Colorify::colorify(print_r($_SERVER, true));
    }
24120
public function addAction()
    {
        //wyszukiwanie kategorii
        if (null === $cat = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->id)) {
            return;
        }
        //zakładka sekcje
        $widgetForm = (new \CmsAdmin\Form\CategoryAddWidget($cat));
        //zapisany form
        if ($widgetForm->isSaved()) {
            $this->getResponse()->redirect('cmsAdmin', 'categoryWidgetRelation', 'config', ['categoryId' => $this->id, 'widgetId' => $widgetForm->getElement('cmsWidgetId')->getValue()]);
        }
        //form do widoku
        $this->view->widgetForm = $widgetForm;
    }
588798
public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['bloodlineId'] === null) {
            $invalidProperties[] = "'bloodlineId' can't be null";
        }
        if ($this->container['name'] === null) {
            $invalidProperties[] = "'name' can't be null";
        }
        if ($this->container['description'] === null) {
            $invalidProperties[] = "'description' can't be null";
        }
        if ($this->container['raceId'] === null) {
            $invalidProperties[] = "'raceId' can't be null";
        }
        if ($this->container['shipTypeId'] === null) {
            $invalidProperties[] = "'shipTypeId' can't be null";
        }
        if ($this->container['corporationId'] === null) {
            $invalidProperties[] = "'corporationId' can't be null";
        }
        if ($this->container['perception'] === null) {
            $invalidProperties[] = "'perception' can't be null";
        }
        if ($this->container['willpower'] === null) {
            $invalidProperties[] = "'willpower' can't be null";
        }
        if ($this->container['charisma'] === null) {
            $invalidProperties[] = "'charisma' can't be null";
        }
        if ($this->container['memory'] === null) {
            $invalidProperties[] = "'memory' can't be null";
        }
        if ($this->container['intelligence'] === null) {
            $invalidProperties[] = "'intelligence' can't be null";
        }
        return $invalidProperties;
    }
718507
public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['weight_unit'] === null) {
            $invalidProperties[] = "'weight_unit' can't be null";
        }
        $allowedValues = $this->getWeightUnitAllowableValues();
        if (!is_null($this->container['weight_unit']) && !in_array($this->container['weight_unit'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'weight_unit', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['dimensions_unit'] === null) {
            $invalidProperties[] = "'dimensions_unit' can't be null";
        }
        $allowedValues = $this->getDimensionsUnitAllowableValues();
        if (!is_null($this->container['dimensions_unit']) && !in_array($this->container['dimensions_unit'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'dimensions_unit', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }
1239778
public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['fuelBayView'] === null) {
            $invalidProperties[] = "'fuelBayView' can't be null";
        }
        $allowedValues = $this->getFuelBayViewAllowableValues();
        if (!in_array($this->container['fuelBayView'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'fuelBayView', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['fuelBayTake'] === null) {
            $invalidProperties[] = "'fuelBayTake' can't be null";
        }
        $allowedValues = $this->getFuelBayTakeAllowableValues();
        if (!in_array($this->container['fuelBayTake'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'fuelBayTake', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['anchor'] === null) {
            $invalidProperties[] = "'anchor' can't be null";
        }
        $allowedValues = $this->getAnchorAllowableValues();
        if (!in_array($this->container['anchor'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'anchor', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['unanchor'] === null) {
            $invalidProperties[] = "'unanchor' can't be null";
        }
        $allowedValues = $this->getUnanchorAllowableValues();
        if (!in_array($this->container['unanchor'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'unanchor', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['online'] === null) {
            $invalidProperties[] = "'online' can't be null";
        }
        $allowedValues = $this->getOnlineAllowableValues();
        if (!in_array($this->container['online'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'online', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['offline'] === null) {
            $invalidProperties[] = "'offline' can't be null";
        }
        $allowedValues = $this->getOfflineAllowableValues();
        if (!in_array($this->container['offline'], $allowedValues)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'offline', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['allowCorporationMembers'] === null) {
            $invalidProperties[] = "'allowCorporationMembers' can't be null";
        }
        if ($this->container['allowAllianceMembers'] === null) {
            $invalidProperties[] = "'allowAllianceMembers' can't be null";
        }
        if ($this->container['useAllianceStandings'] === null) {
            $invalidProperties[] = "'useAllianceStandings' can't be null";
        }
        if ($this->container['attackIfOtherSecurityStatusDropping'] === null) {
            $invalidProperties[] = "'attackIfOtherSecurityStatusDropping' can't be null";
        }
        if ($this->container['attackIfAtWar'] === null) {
            $invalidProperties[] = "'attackIfAtWar' can't be null";
        }
        return $invalidProperties;
    }
487593
public function index() {

		$this->Printer->recursive = 0;
		$impresoras = $this->Paginator->paginate();

		$impresorasModificadas = array();
		foreach( $impresoras as $imp ) {
			// por cada impresora, le agrego la cantidad de productos relacionados que tiene
			$printerId = $imp['Printer']['id'];
			$cant = $this->Printer->cantidadDeProductosEnImpresora($printerId);
			$imp['Printer']['cantidad_productos'] = $cant;
			$impresorasModificadas[] = $imp;
		}

		$this->set('printers', $impresorasModificadas);
	}
535006
public function actions()
    {
        return [
            'add-model-property-group' => [
                'class' => AddModelPropertyGroup::class,
            ],
            'delete-model-property-group' => [
                'class' => DeleteModelPropertyGroup::class,
            ],
            'list-property-groups' => [
                'class' => ListPropertyGroups::class,
            ],
            'edit-property-group' => [
                'class' => EditPropertyGroup::class,
            ],
            'delete-property-group' => [
                'class' => DeletePropertyGroup::class,
            ],
            'list-group-properties' => [
                'class' => ListGroupProperties::class,
            ],
            'edit-property' => [
                'class' => EditProperty::class,
            ],
            'edit-static-value' => [
                'class' => EditStaticValue::class,
            ],
            'delete-static-value' => [
                'class' => DeleteStaticValue::class,
            ],
            'delete-property' => [
                'class' => DeleteProperty::class,
            ],
            'get-attributes-names' => [
                'class' => GetAttributeNames::class,
            ],
            'ajax-related-entities' => [
                'class' => AjaxRelatedEntities::class,
            ],
            'restore-property' => [
                'class' => RestoreProperty::class
            ],
            'restore-property-group' => [
                'class' => RestorePropertyGroup::class
            ],
            'restore-static-value' => [
                'class' => RestoreStaticValue::class
            ]
        ];
    }
256871
public function items()
    {
        return [
            'home'  => [
                'title' => trans('dashboard::menus.principal.home'),
                'url'   => '#home',
                'data-scroll' => true
            ],
            'about'  => [
                'title' => trans('dashboard::menus.principal.about'),
                'url'   => '#about',
                'data-scroll' => true
            ],
            'team'  => [
                'title' => trans('dashboard::menus.principal.team'),
                'url'   => '#team',
                'data-scroll' => true
            ],
            'services'  => [
                'title' => trans('dashboard::menus.principal.services'),
                'url'   => '#services',
                'data-scroll' => true
            ],
            'platform'  => [
                'title' => trans('dashboard::menus.principal.platform'),
                'url'   => route('auth.loginGet'),
                'data-scroll' => true
            ],
            'contact'  => [
                'title' => trans('dashboard::menus.principal.contact'),
                'url'   => '#contact',
                'data-scroll' => true
            ],
            'facebook'  => [
                'url'   => '#',
                'icon'  => 'fa fa-facebook',
            ],
            'twitter'  => [
                'url'   => '#',
                'icon'  => 'fa fa-twitter',
            ],
            'google'  => [
                'url'   => '#',
                'icon'  => 'fa fa-google',
            ],
        ];
    }
943274
public function toArray()
    {
        //tworzy array z opcji
        $array = $this->_options;
        //dołącza joinowane tabele
        foreach ($this->_joined as $name => $value) {
            if ($value instanceof \Mmi\Orm\RecordRo) {
                $value = $value->toArray();
            }
            $array[$name] = $value;
        }
        //dołącza pola obiektu
        foreach ($this as $name => $value) {
            //tylko publiczne zmienne
            if (substr($name, 0, 1) == '_') {
                continue;
            }
            $array[$name] = $value;
        }
        return $array;
    }
572267
public function listInvalidProperties()
    {
        $invalidProperties = [];

        if (!is_null($this->container['division']) && ($this->container['division'] > 7)) {
            $invalidProperties[] = "invalid value for 'division', must be smaller than or equal to 7.";
        }

        if (!is_null($this->container['division']) && ($this->container['division'] < 1)) {
            $invalidProperties[] = "invalid value for 'division', must be bigger than or equal to 1.";
        }

        if (!is_null($this->container['name']) && (strlen($this->container['name']) > 50)) {
            $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 50.";
        }

        return $invalidProperties;
    }
1302350
public function formProperties()
    {
        $form = $this->form();
        $obj  = $form->obj();

        $availableProperties = $obj->properties();
        $sidebarProperties   = $this->sidebarProperties();
        $propertiesOptions   = $this->propertiesOptions();

        foreach ($sidebarProperties as $propertyIdent) {
            if (!$obj->hasProperty($propertyIdent)) {
                continue;
            }

            $property = $obj->property($propertyIdent);
            $value    = $obj->propertyValue($propertyIdent);

            $formProperty = $form->createFormProperty();
            $formProperty->setOutputType($formProperty::PROPERTY_DISPLAY);
            $formProperty->setShowNotes(false);
            $formProperty->setViewController($form->viewController());

            $formProperty->setProperty($property);
            $formProperty->setPropertyIdent($property->ident());
            $formProperty->setPropertyVal($obj[$propertyIdent]);

            if (!empty($propertiesOptions[$propertyIdent])) {
                $propertyOptions = $propertiesOptions[$propertyIdent];

                if (is_array($propertyOptions)) {
                    $formProperty->setData($propertyOptions);
                }
            }

            if (!empty($formProperty['required_acl_permissions']) && $this instanceof AuthAwareInterface) {
                $formProperty['active'] = $this->hasPermissions($formProperty['required_acl_permissions']);
                if (!$this->hasPermissions($formProperty['required_acl_permissions'])) {
                    continue;
                }
            }

            yield $propertyIdent => $formProperty;
        }
    }
1241153
def verifica(ver_list, res_dict, difs):
    ""
    for k, v in ver_list.items():
        # normalizo a float para poder comparar numericamente:
        if isinstance(v, (Decimal, int, long)):
            v = float(v)
        if isinstance(res_dict.get(k), (Decimal, int, long)):
            res_dict[k] = float(res_dict[k])
        if isinstance(v, list):
            # verifico que ambas listas tengan la misma cantidad de elementos:
            if v and not k in res_dict and v:
                difs.append("falta tag %s: %s %s" % (k, repr(v), repr(res_dict.get(k))))
            elif len(res_dict.get(k, []))!=len(v or []):
                difs.append("tag %s len !=: %s %s" % (k, repr(v), repr(res_dict.get(k))))
            else:
                # ordeno las listas para poder compararlas si vienen mezcladas
                rl = sorted(res_dict.get(k, []))
                # comparo los elementos uno a uno:
                for i, vl in enumerate(sorted(v)):
                    verifica(vl, rl[i], difs)
        elif isinstance(v, dict):
            # comparo recursivamente los elementos:
            verifica(v, res_dict.get(k, {}), difs)
        elif res_dict.get(k) is None or v is None:
            # alguno de los dos es nulo, verifico si ambos lo son o faltan
            if v=="":
                v = None
            r = res_dict.get(k)
            if r=="":
                r = None
            if not (r is None and v is None):
                difs.append("%s: nil %s!=%s" % (k, repr(v), repr(r)))
        elif type(res_dict.get(k)) == type(v):
            # tipos iguales, los comparo directamente
            if res_dict.get(k) != v:
                difs.append("%s: %s!=%s" % (k, repr(v), repr(res_dict.get(k))))
        elif isinstance(v, float) or isinstance(res_dict.get(k), float):
            # comparar numericamente
            if float(res_dict.get(k)) != float(v):
                difs.append("%s: %s!=%s" % (k, repr(v), repr(res_dict.get(k))))
        elif unicode(res_dict.get(k)) != unicode(v):
            # tipos diferentes, comparo la representación  
            difs.append("%s: str %s!=%s" % (k, repr(v), repr(res_dict.get(k))))
        else:
            pass
1233537
public function withNotNull()
    {
        /**
         * @var PropertyContract[] $propertiesWithNotNull
         */
        $propertiesWithNotNull = $this::$schema->getPropertiesWithNotNullConstraint();
        if (!$propertiesWithNotNull) {
            return $this;
        }

        foreach ($propertiesWithNotNull as $property) {
            if (is_null($this->{$property->getProperty()})) {
                throw new Exception("Propriedade obrigatória não pode ser nula [ " . $property->getAlias() . " ]", 400);
            }
        }

        return $this;
    }