/** * @param Logic_Negotiator_Option $option * @param $reasons * @return boolean */ public static function qualifyForManualService(Logic_Negotiator_Option $option, &$reasons) { $manual = false; $reasons = array(); if (self::$_model === null) { self::$_model = new ManualserviceFactor(); } $data = array(); $step = $option->getStep(); $negotiation = $step->getNegotiation(); $data['branchid'] = Base_Convert::strToHex($negotiation->getBranchId()); $data['period'] = $option->getDuration(); $data['requestNo'] = $step->getOrder(); $data['amount'] = $negotiation->getTotalAmount(); $data['interest'] = $option->getInterest()->getValue(); $data['clienttype'] = $negotiation->getCustomerType(); $data['operationtype'] = $negotiation->getOperationType(); $data['currency'] = $negotiation->getCurrency(); $data['commitment'] = $negotiation->getCustomer()->engagement; $rows = self::$_model->fetchAllActive(); foreach ($rows as $row) { if ($row->factor->check($data)) { $reasons[] = $row->name; $manual = true; } } return $manual; }
/** * Inicjalizacja formularza */ public function baseInit() { $this->_atModel = $atModel = new AddonType(); $this->_bModel = $bModel = new Branch(); $rows = $atModel->fetchAll('not ghost', 'name asc'); $addons = array(); foreach ($rows as $row) { $addons[Base_Convert::strToHex($row->id)] = $row->name; } $this->addElement('MultiCheckbox', 'addons', array('label' => 'Uzwględnij następujące dodatki:', 'MultiOptions' => $addons, 'value' => array_keys($addons), 'required' => true)); $this->addons->getDecorator('row')->setOption('class', 'row widerow'); $rows = $bModel->fetchAll('not ghost', 'web_name asc'); $branches = array(); foreach ($rows as $row) { $branches[Base_Convert::strToHex($row->id)] = $row->branch_name; } $this->addElement('MultiCheckbox', 'branches', array('label' => 'Uwzględnij następujące brandy:', 'MultiOptions' => $branches, 'value' => array_keys($branches), 'required' => true)); $dic = new Logic_Dictionary(); $cTypes = array(); $this->_cDic = $cDic = $dic->getDictionaryEntriesByCode('client_type'); foreach ($cDic as $ct) { $cTypes[Base_Convert::strToHex($ct->id)] = ucfirst($ct->entry); } $rows = $bModel->fetchAll('not ghost', 'web_name asc'); $branches = array(); foreach ($rows as $row) { $branches[Base_Convert::strToHex($row->id)] = $row->branch_name; } $this->addElement('MultiCheckbox', 'clients', array('label' => 'Uwzględnij nastepujących klientów:', 'MultiOptions' => $cTypes, 'value' => array_keys($cTypes), 'required' => true)); $this->addElement('Select', 'timepoint', array('label' => 'Wyeksportuj wartości:', 'MultiOptions' => array('now' => 'Aktualne', 'archive' => 'Archiwalne'), 'required' => true)); $this->datee(false, 'date', 'Data:', true, array('value' => date('Y-m-d'), 'required' => true)); $this->addElement('text', 'time', array('label' => 'Godzina:', 'class' => 'timeentry', 'required' => true, 'value' => date('H:00:00'), 'validators' => array(array('validator' => 'Date', 'options' => array('format' => 'H:i:s'))))); $this->submit(false, 'submitbtn', 'Eksportuj'); }
/** * Konwersja hex (kodowanego base64) do stringa * * @param string $string * @return string */ public function hexToStr($hex) { return Base_Convert::hexToStr($hex); }