本文整理汇总了PHP中Zend_Validate_Date类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Validate_Date类的具体用法?PHP Zend_Validate_Date怎么用?PHP Zend_Validate_Date使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Validate_Date类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: overrrideDateValidator
public static function overrrideDateValidator($p_format)
{
$validator = new Zend_Validate_Date();
$validator->setFormat($p_format);
$validator->setMessage(_("'%value%' does not fit the date format '%format%'"), Zend_Validate_Date::FALSEFORMAT);
return $validator;
}
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:7,代码来源:ValidationTypes.php
示例2: __construct
public function __construct($data, $sodu, $tongno)
{
$val = new Zend_Validate_NotEmpty();
$num = new Zend_Validate_Digits();
$date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
if ($val->isValid($data['tenhoadon']) == false) {
$this->messages[] = "Tên Hóa Đơn không được trống";
}
if ($val->isValid($data['tienthanhtoan']) == false) {
$this->messages[] = "Tiền thanh toán được trống";
} else {
if ($num->isValid($data['tienthanhtoan']) == false) {
$this->messages[] = "Tiền thanh toán phải là số";
} else {
if ($data['tienthanhtoan'] > $sodu) {
$this->messages[] = "Tiền thanh toán phải nhỏ hơn số dư";
} else {
if ($data['tienthanhtoan'] > $tongno) {
$this->messages[] = "Tiền thanh toán không lớn hơn số nợ";
} else {
if ($data['tienthanhtoan'] < 0) {
$this->messages[] = "Tiền thanh toán phải là số dương";
}
}
}
}
}
if ($date->isValid($data['ngaythanhtoan']) == false) {
$this->messages[] = "Ngày thanh toán không đúng";
}
}
开发者ID:LongNguyen-51101909,项目名称:Dimopla,代码行数:31,代码来源:hoadon.php
示例3: __construct
public function __construct($data)
{
$val = new Zend_Validate_NotEmpty();
$num = new Zend_Validate_Digits();
$date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
if ($val->isValid($data['tendonhang']) == false) {
$this->messages[] = "Tên đơn hàng không được trống";
}
if ($date->isValid($data['ngaydathang']) == false) {
$this->messages[] = "Ngày đặt hàng không đúng";
}
if ($val->isValid($data['tiendathang']) == false) {
$this->messages[] = "Tiền đặt hàng Không được trống";
}
if ($num->isValid($data['tiendathang']) == false) {
$this->messages[] = "Tiền đặt hàng phải là số";
}
if ($num->isValid($data['sometvai']) == false) {
$this->messages[] = "Số mét vải phải là số";
}
if ($val->isValid($data['sometvai']) == false) {
$this->messages[] = "Số mét vải Không được trống";
}
if (array_key_exists('makhachhang', $data)) {
if ($num->isValid($data['makhachhang']) == false) {
$this->messages[] = "Mã khách hàng phải là số";
}
if ($val->isValid($data['makhachhang']) == false) {
$this->messages[] = "Mã khách hàng không được trống";
}
}
}
开发者ID:LongNguyen-51101909,项目名称:Dimopla,代码行数:32,代码来源:donhang.php
示例4: isValid
/**
* Validate element value
*
* @param array $data
* @param mixed $context
* @return boolean
*/
public function isValid($value, $context = null)
{
$v1 = new Zend_Validate_Regex('/^\\d{4}\\-\\d{2}\\-\\d{2}$/');
$v2 = new Zend_Validate_Date(array('format' => 'Y-m-d'));
if (!$v1->isValid($value) || !$v2->isValid($value)) {
$this->_messages = array(self::INVALID_DATE_FORMAT => $this->_templateMessages[self::INVALID_DATE_FORMAT]);
return false;
}
return true;
}
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:17,代码来源:DateInterval.php
示例5: __construct
public function __construct($data)
{
$val = new Zend_Validate_NotEmpty();
$date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
if ($val->isValid($data['tendonxuat']) == false) {
$this->messages[] = "Tên đơn xuất không được trống";
}
if ($date->isValid($data['ngayxuat']) == false) {
$this->messages[] = "Ngày xuất không đúng";
}
}
开发者ID:LongNguyen-51101909,项目名称:Dimopla,代码行数:11,代码来源:donxuat.php
示例6: __construct
public function __construct($date, $active = true)
{
$validate = new Zend_Validate_Date(array("format" => "dd/MM/yyyy hh:mm"));
if (!$validate->isValid($date)) {
throw new Application_Model_Exception("Date {$date} is not valid !");
} else {
$this->_date = new Zend_Date($date, "dd/MM/yyyy hh:mm");
}
unset($validate);
$this->_active = (bool) $active;
}
开发者ID:esandre,项目名称:CoeurDeTruffes,代码行数:11,代码来源:Data.php
示例7: __construct
public function __construct($data)
{
$val = new Zend_Validate_NotEmpty();
$num = new Zend_Validate_Digits();
$date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
if ($val->isValid($data['socaynhuom']) == false) {
$this->messages[] = "Tên lô nhuộm không được trống";
}
if ($date->isValid($data['ngaynhuom']) == false) {
$this->messages[] = "Ngày nhuộm không đúng";
}
}
开发者ID:LongNguyen-51101909,项目名称:Zend1Example,代码行数:12,代码来源:lonhuom.php
示例8: postAction
/**
* Sauvegarde
*/
public function postAction()
{
if ($datas = $this->getRequest()->getPost()) {
try {
$errors = '';
// Recherche des sections
$section = new Form_Model_Section();
$sections = $section->findByValueId($this->getCurrentOptionValue()->getId());
$field = new Form_Model_Field();
// Validator date
$validator = new Zend_Validate_Date(array('format' => 'yyyy-mm-dd'));
foreach ($sections as $k => $section) {
// Recherche les fields de la section
$section->findFields($section->getId());
// Boucle sur les fields
foreach ($section->getFields() as $key => $field) {
if ($field->isRequired() == 1 && $datas['field_' . $k . '_' . $key] == '') {
$errors .= $this->_('<strong>%s</strong> must be filled<br />', $field->getName());
}
if ($field->getType() == 'email' && !Zend_Validate::is($datas['field_' . $k . '_' . $key], 'EmailAddress')) {
$errors .= $this->_('<strong>%s</strong> must be a valid email address<br />', $field->getName());
}
if ($field->getType() == 'nombre' && !Zend_Validate::is($datas['field_' . $k . '_' . $key], 'Digits')) {
$errors .= $this->_('<strong>%s</strong> must be a numerical value<br />', $field->getName());
}
if ($field->getType() == 'date' && !$validator->isValid($datas['field_' . $k . '_' . $key])) {
$errors .= $this->_('<strong>%s</strong> must be a valid date<br />', $field->getName());
}
$datasChanged['field_' . $k . '_' . $key] = array('name' => $field->getName(), 'value' => $datas['field_' . $k . '_' . $key]);
}
}
if (empty($errors)) {
$form = $this->getCurrentOptionValue()->getObject();
$layout = $this->getLayout()->loadEmail('form', 'send_email');
$layout->getPartial('content_email')->setDatas($datasChanged);
$content = $layout->render();
$mail = new Zend_Mail('UTF-8');
$mail->setBodyHtml($content);
$mail->setFrom($form->getEmail(), $this->getApplication()->getName());
$mail->addTo($form->getEmail(), $this->_('Your app\'s form'));
$mail->setSubject($this->_('Your app\'s form'));
$mail->send();
$html = array('success' => 1);
} else {
$html = array('error' => 1, 'message' => $errors);
}
} catch (Exception $e) {
$html = array('error' => 1, 'message' => $e->getMessage());
}
$this->_sendHtml($html);
}
}
开发者ID:bklein01,项目名称:SiberianCMS,代码行数:55,代码来源:MobileController.php
示例9: __construct
public function __construct($data)
{
$val = new Zend_Validate_NotEmpty();
$num = new Zend_Validate_Digits();
$date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
if ($num->isValid($data['sotansoi']) == false) {
$this->messages[] = "Số Tấn Sợi phải là số";
}
if ($date->isValid($data['ngaymua']) == false) {
$this->messages[] = "Ngày mua không đúng";
}
if ($num->isValid($data['thanhtien']) == false) {
$this->messages[] = "Thành Tiền phải là số";
}
}
开发者ID:LongNguyen-51101909,项目名称:Dimopla,代码行数:15,代码来源:hopdong.php
示例10: isValid
/**
* Defined by Zend_Validate_Interface
*
* Returns true if $value is a valid date of the format YYYY-MM-DD
* If optional $format or $locale is set the date format is checked
* according to Zend_Date, see Zend_Date::isDate()
*
* @param string $value
* @return boolean
*/
public function isValid($value)
{
$result = true;
$date_validator = new Zend_Validate_Date($this->_format);
if (!$date_validator->isValid($value['from']) || !$date_validator->isValid($value['to'])) {
$this->_error(self::NOT_YYYY_MM_DD);
$result = false;
}
$from_date = new Zend_Date($value['from']);
$to_date = new Zend_Date($value['to']);
if ($to_date->isEarlier($from_date)) {
$this->_error(self::END_DATE_EARLIER);
$result = false;
}
return $result;
}
开发者ID:anunay,项目名称:stentors,代码行数:26,代码来源:DateRange.php
示例11: init
public function init()
{
$this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'))->setAttribs(array('id' => 'filter_form'));
$this->addElement('Text', 'key_search', array('label' => 'Event name:', ''));
$this->addElement('select', 'date_search', array('label' => 'Search by date of:', 'multiOptions' => array('starttime' => 'Event Start', 'endtime' => 'Event End')));
$date_validate = new Zend_Validate_Date("YYYY-MM-dd");
$date_validate->setMessage("Please pick a valid day (yyyy-mm-dd)", Zend_Validate_Date::FALSEFORMAT);
$this->addElement('Text', 'start_date', array('label' => 'From Date:', 'required' => false));
$this->getElement('start_date')->addValidator($date_validate);
$this->addElement('Text', 'end_date', array('label' => 'To Date:', 'required' => false));
$this->getElement('end_date')->addValidator($date_validate);
$this->addElement('Hidden', 'order', array('order' => 10004));
// Element: direction
$this->addElement('Hidden', 'direction', array('order' => 10005));
$this->addElement('Button', 'submit1', array('label' => 'Search', 'type' => 'submit', 'ignore' => true));
}
开发者ID:hoalangoc,项目名称:ftf,代码行数:16,代码来源:SearchEvents.php
示例12: checarEmissaoGuia
/**
* Verifica se deve emitir a guia considerando:
* 1 - as características do contribuinte no alvará
* 2 - tributação dentro ou fora do municipio
*
*
* @param stdClass $oParametro
* $oParametro->inscricao_municipal
* $oParametro->data
* @throws Exception
* @return boolean
*
* @tutorial: Abaixo constam as regras para emissão de guia
*
* Regime(4)/Exigibilidade(5) |Exigível(23)|Não Incide(24)|Isento(25)|Export.(26)|Imune(27)|Susp.Judic(28)|Susp.Adm(29)
* ------------------------------------------------------------------------------------------------------------------
* (--)Optante Simples |Não |Não |Não |Não |Não |Não |Não
* (14)Normal |Sim |Não |Não |sim |Não |Não |Não
* (15)Cooperativa |Sim |Não |Não |sim |Não |Não |Não
* (16)EPP |Sim |Não |Não |sim |Não |Não |Não
* (17)Estimativa |Sim |Não |Não |sim |Não |Não |Não
* (18)Fixado |Não |Não |Não |Não |Não |Não |Não
* (19)ME municipal |Sim |Não |Não |sim |Não |Não |Não
* (20)MEI |Não |Não |Não |Não |Não |Não |Não
* (21)ME |Sim |Não |Não |sim |Não |Não |Não
* (22)Sociedade profissional |Não |Não |Não |Não |Não |Não |Não
*/
public static function checarEmissaoGuia($oParametro = NULL)
{
$oValidaData = new Zend_Validate_Date();
if (!is_object($oParametro)) {
throw new Exception('O parâmetro informado deve ser um objeto.');
} else {
if (!isset($oParametro->data) || !isset($oParametro->inscricao_municipal)) {
throw new Exception('Verifique os parâmetros informados.');
} else {
if (!$oValidaData->isValid($oParametro->data)) {
throw new Exception('Parâmetro "data" inválido.');
}
}
}
// Busca os dados do contribuinte da sessão
$oContribuinte = Contribuinte_Model_Contribuinte::getByInscricaoMunicipal($oParametro->inscricao_municipal);
if (!is_object($oContribuinte)) {
throw new Exception('Nenhum contribuinte foi encontrado.');
}
// Optante pelo simples no período pesquisado, não emite guia
$oDataSimples = new DateTime(DBSeller_Helper_Date_Date::invertDate($oParametro->data));
if ($oContribuinte->isOptanteSimples($oDataSimples)) {
return FALSE;
}
// Verifica se deve emitir a guia conforme as regras de emissão
$iRegimeTributario = $oContribuinte->getRegimeTributario();
$iExigibilidade = $oContribuinte->getExigibilidade();
switch ("{$iRegimeTributario}-{$iExigibilidade}") {
case '14-23':
case '14-26':
case '15-23':
case '15-26':
case '16-23':
case '16-26':
case '17-23':
case '17-26':
case '19-23':
case '19-26':
case '21-23':
case '21-26':
return TRUE;
break;
default:
return FALSE;
}
return FALSE;
}
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:74,代码来源:EmissorGuia.php
示例13: isValidDate
public function isValidDate($value, $format)
{
if (empty($value)) {
$message = 'Date can not be empty.';
return array('Error' => $message);
}
$validator = new Zend_Validate_Date();
$validator->setFormat($format);
if ($validator->isValid($value)) {
return true;
} else {
// value failed validation; print reasons
foreach ($validator->getMessages() as $message) {
return array('Error' => $message);
}
}
}
开发者ID:roycocup,项目名称:Tests,代码行数:17,代码来源:Validator.php
示例14: _beforeSave
/**
* Perform actions before object save
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract
* @throws Mage_Core_Exception
*/
public function _beforeSave(Mage_Core_Model_Abstract $object)
{
$dateFrom = $object->getDateFrom();
$dateTo = $object->getDateTo();
if (!empty($dateFrom) && !empty($dateTo)) {
$validator = new Zend_Validate_Date();
if (!$validator->isValid($dateFrom) || !$validator->isValid($dateTo)) {
Mage::throwException(Mage::helper('core')->__('Invalid date'));
}
if (Varien_Date::toTimestamp($dateFrom) > Varien_Date::toTimestamp($dateTo)) {
Mage::throwException(Mage::helper('core')->__('Start date cannot be greater than end date.'));
}
}
$check = $this->_checkIntersection($object->getStoreId(), $dateFrom, $dateTo, $object->getId());
if ($check) {
Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.'));
}
parent::_beforeSave($object);
}
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:26,代码来源:Design.php
示例15: getDownloadByDate
/**
* Returns download by date in database
*
* @param string $user
* @param string $pass
* @param string $date
* @return array|Exception
*/
public function getDownloadByDate($user, $pass, $date)
{
if (strcmp($user, '[email protected]') == 0 && strcmp($pass, '[email protected]') == 0) {
$validator = new Zend_Validate_Date();
if (!$validator->isValid($date)) {
throw new Service_Exception('Invalid input');
}
$db = Zend_Registry::get('connectDB');
$mySql = $db->select()->from('download');
if ($date) {
$mySql->where('time=?', $date);
}
$result = $db->fetchAll($mySql);
if (!count($result)) {
throw new Exception('Invalid download by date: ' . $date);
}
} else {
throw new Service_Exception('Username and password is incorrect');
}
return $result;
}
开发者ID:backviet01,项目名称:zegome-service,代码行数:29,代码来源:Manager.php
示例16: _validateInputRule
/**
* Validate value by attribute input validation rule
*
* @param string $value
* @return string
*/
protected function _validateInputRule($value)
{
// skip validate empty value
if (empty($value)) {
return true;
}
$label = Mage::helper('customer')->__($this->getAttribute()->getStoreLabel());
$validateRules = $this->getAttribute()->getValidateRules();
if (!empty($validateRules['input_validation'])) {
switch ($validateRules['input_validation']) {
case 'alphanumeric':
$validator = new Zend_Validate_Alnum(true);
$validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_Alnum::INVALID);
$validator->setMessage(Mage::helper('customer')->__('"%s" has not only alphabetic and digit characters.', $label), Zend_Validate_Alnum::NOT_ALNUM);
$validator->setMessage(Mage::helper('customer')->__('"%s" is an empty string.', $label), Zend_Validate_Alnum::STRING_EMPTY);
if (!$validator->isValid($value)) {
return $validator->getMessages();
}
break;
case 'numeric':
$validator = new Zend_Validate_Digits();
$validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_Digits::INVALID);
$validator->setMessage(Mage::helper('customer')->__('"%s" contains not only digit characters.', $label), Zend_Validate_Digits::NOT_DIGITS);
$validator->setMessage(Mage::helper('customer')->__('"%s" is an empty string.', $label), Zend_Validate_Digits::STRING_EMPTY);
if (!$validator->isValid($value)) {
return $validator->getMessages();
}
break;
case 'alpha':
$validator = new Zend_Validate_Alpha(true);
$validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_Alpha::INVALID);
$validator->setMessage(Mage::helper('customer')->__('"%s" has not only alphabetic characters.', $label), Zend_Validate_Alpha::NOT_ALPHA);
$validator->setMessage(Mage::helper('customer')->__('"%s" is an empty string.', $label), Zend_Validate_Alpha::STRING_EMPTY);
if (!$validator->isValid($value)) {
return $validator->getMessages();
}
break;
case 'email':
/**
$this->__("'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded")
$this->__("Invalid type given. String expected")
$this->__("'%value%' appears to be a DNS hostname but contains a dash in an invalid position")
$this->__("'%value%' does not match the expected structure for a DNS hostname")
$this->__("'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'")
$this->__("'%value%' does not appear to be a valid local network name")
$this->__("'%value%' does not appear to be a valid URI hostname")
$this->__("'%value%' appears to be an IP address, but IP addresses are not allowed")
$this->__("'%value%' appears to be a local network name but local network names are not allowed")
$this->__("'%value%' appears to be a DNS hostname but cannot extract TLD part")
$this->__("'%value%' appears to be a DNS hostname but cannot match TLD against known list")
*/
$validator = new Zend_Validate_EmailAddress();
$validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_EmailAddress::INVALID);
$validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid email address.', $label), Zend_Validate_EmailAddress::INVALID_FORMAT);
$validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid hostname.', $label), Zend_Validate_EmailAddress::INVALID_HOSTNAME);
$validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid hostname.', $label), Zend_Validate_EmailAddress::INVALID_MX_RECORD);
$validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid hostname.', $label), Zend_Validate_EmailAddress::INVALID_MX_RECORD);
$validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid email address.', $label), Zend_Validate_EmailAddress::DOT_ATOM);
$validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid email address.', $label), Zend_Validate_EmailAddress::QUOTED_STRING);
$validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid email address.', $label), Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
$validator->setMessage(Mage::helper('customer')->__('"%s" exceeds the allowed length.', $label), Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
$validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be an IP address, but IP addresses are not allowed"), Zend_Validate_Hostname::IP_ADDRESS_NOT_ALLOWED);
$validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot match TLD against known list"), Zend_Validate_Hostname::UNKNOWN_TLD);
$validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but contains a dash in an invalid position"), Zend_Validate_Hostname::INVALID_DASH);
$validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'"), Zend_Validate_Hostname::INVALID_HOSTNAME_SCHEMA);
$validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot extract TLD part"), Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
$validator->setMessage(Mage::helper('customer')->__("'%value%' does not appear to be a valid local network name"), Zend_Validate_Hostname::INVALID_LOCAL_NAME);
$validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a local network name but local network names are not allowed"), Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
$validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded"), Zend_Validate_Hostname::CANNOT_DECODE_PUNYCODE);
if (!$validator->isValid($value)) {
return array_unique($validator->getMessages());
}
break;
case 'url':
$parsedUrl = parse_url($value);
if ($parsedUrl === false || empty($parsedUrl['scheme']) || empty($parsedUrl['host'])) {
return array(Mage::helper('customer')->__('"%s" is not a valid URL.', $label));
}
$validator = new Zend_Validate_Hostname();
if (!$validator->isValid($parsedUrl['host'])) {
return array(Mage::helper('customer')->__('"%s" is not a valid URL.', $label));
}
break;
case 'date':
$validator = new Zend_Validate_Date(Varien_Date::DATE_INTERNAL_FORMAT);
$validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_Date::INVALID);
$validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid date.', $label), Zend_Validate_Date::INVALID_DATE);
$validator->setMessage(Mage::helper('customer')->__('"%s" does not fit the entered date format.', $label), Zend_Validate_Date::FALSEFORMAT);
if (!$validator->isValid($value)) {
return array_unique($validator->getMessages());
}
break;
}
}
//.........这里部分代码省略.........
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:101,代码来源:Abstract.php
示例17: indexAction
/**
* Monta a tela para emissão do RPS
*
* @return void
*/
public function indexAction()
{
try {
$aDados = $this->getRequest()->getParams();
$oContribuinte = $this->_session->contribuinte;
$this->view->empresa_nao_prestadora = FALSE;
$this->view->empresa_nao_emissora_nfse = FALSE;
$this->view->bloqueado_msg = FALSE;
$oForm = $this->formNota(NULL, $oContribuinte);
// Verifica se o contribuinte tem permissão para emitir nfse/rps
if ($oContribuinte->getTipoEmissao() != Contribuinte_Model_ContribuinteAbstract::TIPO_EMISSAO_NOTA) {
$this->view->empresa_nao_emissora_nfse = TRUE;
return;
}
// Verifica se a empresa é prestadora de serviços
$aServicos = Contribuinte_Model_Servico::getByIm($oContribuinte->getInscricaoMunicipal());
if ($aServicos == NULL || empty($aServicos)) {
$this->view->empresa_nao_prestadora = TRUE;
return;
}
// Verifica o prazo de emissão de documentos e retorna as mensagens de erro
self::mensagemPrazoEmissao();
// Configura o formulário
$oForm->preenche($aDados);
$oForm->setListaServicos($aServicos);
$this->view->form = $oForm;
// Validadores
$oValidaData = new Zend_Validate_Date(array('format' => 'yyyy-MM-dd'));
// Bloqueia a emissão se possuir declarações sem movimento
if (isset($aDados['dt_nota']) && $oValidaData->isValid($aDados['dt_nota'])) {
$oDataSimples = new DateTime($aDados['dt_nota']);
$aDeclaracaoSemMovimento = Contribuinte_Model_Competencia::getDeclaracaoSemMovimentoPorContribuintes($oContribuinte->getInscricaoMunicipal(), $oDataSimples->format('Y'), $oDataSimples->format('m'));
if (count($aDeclaracaoSemMovimento) > 0) {
$sMensagemErro = 'Não é possível emitir um documento nesta data, pois a competência foi declarada como ';
$sMensagemErro .= 'sem movimento.<br>Entre em contato com o setor de arrecadação da prefeitura.';
$this->view->messages[] = array('error' => $sMensagemErro);
return;
}
}
// Trata o post do formulário
if ($this->getRequest()->isPost()) {
$oNota = new Contribuinte_Model_Nota();
// Valida os dados informados no formulário
if (!$oForm->isValid($aDados)) {
$this->view->form = $oForm;
$this->view->messages[] = array('error' => $this->translate->_('Preencha os dados corretamente.'));
} else {
if ($oNota::existeRps($oContribuinte, $aDados['n_rps'], $aDados['tipo_nota'])) {
$this->view->form = $oForm;
$this->view->messages[] = array('error' => $this->translate->_('Já existe um RPS com esta numeração.'));
} else {
$oAidof = new Administrativo_Model_Aidof();
$iInscricaoMunicipal = $oContribuinte->getInscricaoMunicipal();
/*
* Verifica se a numeração do AIDOF é válida
*/
$lVerificaNumeracao = $oAidof->verificarNumeracaoValidaParaEmissaoDocumento($iInscricaoMunicipal, $aDados['n_rps'], $aDados['tipo_nota']);
if (!$lVerificaNumeracao) {
$sMensagem = 'A numeração do RPS não confere com os AIDOFs liberados.';
$this->view->messages[] = array('error' => $this->translate->_($sMensagem));
return;
}
// Remove chaves inválidas
unset($aDados['enviar'], $aDados['action'], $aDados['controller'], $aDados['module'], $aDados['estado']);
// Filtro para retornar somente numeros
$aFilterDigits = new Zend_Filter_Digits();
$aDados['p_im'] = $oContribuinte->getInscricaoMunicipal();
$aDados['grupo_nota'] = Contribuinte_Model_Nota::GRUPO_NOTA_RPS;
$aDados['t_cnpjcpf'] = $aFilterDigits->filter($aDados['t_cnpjcpf']);
$aDados['t_cep'] = $aFilterDigits->filter($aDados['t_cep']);
$aDados['t_telefone'] = $aFilterDigits->filter($aDados['t_telefone']);
$aDados['id_contribuinte'] = $oContribuinte->getIdUsuarioContribuinte();
$aDados['id_usuario'] = $this->usuarioLogado->getId();
if (!$oNota->persist($aDados)) {
$this->view->form = $oForm;
$this->view->messages[] = array('error' => $this->translate->_('Houver um erro ao tentar emitir a nota.'));
return NULL;
}
$this->view->messages[] = array('success' => $this->translate->_('Nota emitida com sucesso.'));
$this->_redirector->gotoSimple('dadosnota', 'nota', NULL, array('id' => $oNota->getId(), 'tipo_nota' => 'rps'));
}
}
}
} catch (Exception $oError) {
$this->view->messages[] = array('error' => $oError->getMessage());
return;
}
}
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:93,代码来源:RpsController.php
示例18: _validatePublicationDate
/**
* Validates expiration date
*
* @return boolean
*/
protected function _validatePublicationDate()
{
$validator = new Zend_Validate_Date();
$validator->setFormat('dd-MM-YYYY');
if (!$validator->isValid($this->_job->getPublicationDate())) {
$msg = Sanmax_MessageStack::getInstance('SxCms_Job');
$msg->addMessage('publication_date', $validator->getMessages(), 'save');
return false;
}
return true;
}
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:16,代码来源:BaseValidator.php
示例19: formValidator
public function formValidator($form,$formType)
{
$emptyValidator = new Zend_Validate_NotEmpty();
$emptyValidator->setMessage(General_Models_Text::$text_notEmpty);
$form->getElement('name')->setAllowEmpty(false)
->addValidator($emptyValidator);
$form->getElement('birth')->setAllowEmpty(false)
->addValidator($emptyValidator);
$form->getElement('edu')->setAllowEmpty(false)
->addValidator($emptyValidator);
$form->getElement('enroll')->setAllowEmpty(false)
->addValidator($emptyValidator);
$form->getElement('political')->setAllowEmpty(false)
->addValidator($emptyValidator);
$form->getElement('phoneMob')->setAllowEmpty(false)
->addValidator($emptyValidator);
$form->getElement('idCard')->setAllowEmpty(false)
->addValidator($emptyValidator);
$dateValidator = new Zend_Validate_Date();
$dateValidator->setMessage(General_Models_Text::$text_notDate);
$form->getElement('birth')->addValidator($dateValidator);
$form->getElement('enroll')->addValidator($dateValidator);
$form->getElement('probStart')->addValidator($dateValidator);
$form->getElement('probEnd')->addValidator($dateValidator);
$form->getElement('secDate')->addValidator($dateValidator);
return $form;
}
开发者ID:robliuning,项目名称:Luckyrabbit,代码行数:29,代码来源:ContactMapper.php
示例20: str_replace
$data['fixedRate'] = str_replace($kga['conf']['decimalSeparator'], '.', $_REQUEST['fixedRate']);
} else {
if (!$id) {
$data['rate'] = $database->get_best_fitting_rate($kga['user']['userID'], $data['projectID'], $data['activityID']);
$data['fixedRate'] = str_replace($kga['conf']['decimalSeparator'], '.', $_REQUEST['fixedRate']);
}
}
$data['cleared'] = isset($_REQUEST['cleared']);
$data['statusID'] = $_REQUEST['statusID'];
$data['billable'] = $_REQUEST['billable'];
$data['budget'] = str_replace($kga['conf']['decimalSeparator'], '.', $_REQUEST['budget']);
$data['approved'] = str_replace($kga['conf']['decimalSeparator'], '.', $_REQUEST['approved']);
$data['userID'] = $_REQUEST['userID'];
// check if the posted time values are possible
$validateDate = new Zend_Validate_Date(array('format' => 'dd.MM.yyyy'));
$validateTime = new Zend_Validate_Date(array('format' => 'HH:mm:ss'));
if (!$validateDate->isValid($_REQUEST['start_day'])) {
$errors['start_day'] = $kga['lang']['TimeDateInputError'];
}
if (!$validateTime->isValid($_REQUEST['start_time'])) {
$_REQUEST['start_time'] = $_REQUEST['start_time'] . ':00';
if (!$validateTime->isValid($_REQUEST['start_time'])) {
$errors['start_time'] = $kga['lang']['TimeDateInputError'];
}
}
if ($_REQUEST['end_day'] != '' && !$validateDate->isValid($_REQUEST['end_day'])) {
$errors['end_day'] = $kga['lang']['TimeDateInputError'];
}
if ($_REQUEST['end_time'] != '' && !$validateTime->isValid($_REQUEST['end_time'])) {
$_REQUEST['end_time'] = $_REQUEST['end_time'] . ':00';
if (!$validateTime->isValid($_REQUEST['end_time'])) {
开发者ID:lentschi,项目名称:kimai,代码行数:31,代码来源:processor.php
注:本文中的Zend_Validate_Date类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论