예제 #1
0
 public static function fromArray($data)
 {
     $address = new Address();
     if (isset($data['street'])) {
         $address->setStreet($data['street']);
     }
     if (isset($data['street2'])) {
         $address->setStreet2($data['street2']);
     }
     if (isset($data['zip'])) {
         $address->setZip($data['zip']);
     }
     if (isset($data['city'])) {
         $address->setCity($data['city']);
     }
     if (isset($data['country'])) {
         $address->setCountry($data['country']);
     }
     if (isset($data['state'])) {
         $address->setState($data['state']);
     }
     if (isset($data['tel'])) {
         $address->setTel($data['tel']);
     }
     if (isset($data['fax'])) {
         $address->setFax($data['fax']);
     }
     if (isset($data['email'])) {
         $address->setEmail($data['email']);
     }
     return $address;
 }
예제 #2
0
 protected function getAsObject($row)
 {
     $result = new Address();
     $result->setNew(false);
     $result->setAddressId(Singleton::create("NullConverter")->fromDBtoDOM($row["addressId"]));
     $result->setStreet(Singleton::create("NullConverter")->fromDBtoDOM($row["street"]));
     $result->setLocation(Singleton::create("NullConverter")->fromDBtoDOM($row["location"]));
     return $result;
 }
예제 #3
0
    public function testPopulateWithPlace()
    {
        $point = new Point();
        $point->setLat('-23.59243454');
        $point->setLng('-46.68677054');
        $city = new City();
        $city->setCountry('BR');
        $city->setState('SP');
        $city->setName('São Paulo');
        $category = new Category();
        $category->setId('123');
        $category->setName('Empresas de Internet');
        $address = new Address();
        $address->setStreet("Rua Funchal");
        $address->setNumber(129);
        $address->setComplement('6o andar');
        $address->setCity($city);
        $place = new Place();
        $place->setId("M25GJ288");
        $place->setName("Apontador.com - São Paulo");
        $place->setDescription("Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br).");
        $place->setIconUrl("http://localphoto.s3.amazonaws.com/C40372534F143O1437_9896391605729015_l.jpg");
        $place->setPoint($point);
        $place->setCategory($category);
        $place->setAddress($address);
        $this->og->populate($place);
        $rootUrl = \ROOT_URL;
        $testMeta = <<<META
\t<meta property="og:title" content="Apontador.com - São Paulo"/>
\t<meta property="og:description" content="Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br)."/>
\t<meta property="og:image" content="http://maplink.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054"/>
\t<meta property="og:url" content="{$rootUrl}sp/s-o-paulo/empresas-de-internet/apontador-com-s-o-paulo/M25GJ288.html"/>
\t<meta property="og:street-address" content="Rua Funchal, 129"/>
\t<meta property="og:locality" content="São Paulo"/>
\t<meta property="og:region" content="SP"/>
\t<meta property="og:country-name" content="Brasil"/>
\t<meta property="og:latitude" content="-23.59243454"/>
\t<meta property="og:longitude" content="-46.68677054"/>
\t<meta property="og:type" content="company"/>

META;
        $this->assertEquals($testMeta, $this->og->getMeta());
        $testArray = array('title' => 'Apontador.com - São Paulo', 'description' => 'Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br).', 'image' => 'http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054', 'url' => ROOT_URL . 'sp/s-o-paulo/empresas-de-internet/apontador-com-s-o-paulo/M25GJ288.html', 'street-address' => 'Rua Funchal, 129', 'locality' => 'São Paulo', 'region' => 'SP', 'country-name' => 'Brasil', 'latitude' => '-23.59243454', 'longitude' => '-46.68677054', 'type' => 'company');
        $this->assertEquals($testArray, $this->og->getArray());
    }
예제 #4
0
    public function testPopulateWithPlace()
    {
        $point = new Point();
        $point->setLat('-23.59243454');
        $point->setLng('-46.68677054');
        $city = new City();
        $city->setCountry('BR');
        $city->setState('SP');
        $city->setName('São Paulo');
        $category = new Category();
        $category->setId('067');
        $category->setName('Restaurante');
        $address = new Address();
        $address->setStreet("R. Min. Jesuino Cardoso");
        $address->setNumber(473);
        $address->setCity($city);
        $place = new Place();
        $place->setId("UCV34B2P");
        $place->setName("Uziel Restaurante");
        $place->setDescription("Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R\$ 26,90, mas você paga no máximo R\$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant");
        $place->setIconUrl("http://maplink.com.br/widget?v=4.1&lat=-23.5926083&lng=-46.6818329");
        $place->setPoint($point);
        $place->setCategory($category);
        $place->setAddress($address);
        $this->abm->populate($place);
        $rootUrl = \ROOT_URL;
        $testMeta = <<<META
\t<meta property="restaurant:title" content="Uziel Restaurante"/>
\t<meta property="restaurant:description" content="Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R\$ 26,90, mas você paga no máximo R\$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant"/>
\t<meta property="restaurant:image" content="http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054"/>
\t<meta property="restaurant:url" content="{$rootUrl}sp/s-o-paulo/restaurante/uziel-restaurante/UCV34B2P.html"/>
\t<meta property="restaurant:address" content="R. Min. Jesuino Cardoso, 473"/>
\t<meta property="restaurant:city" content="São Paulo"/>
\t<meta property="restaurant:state" content="SP"/>
\t<meta property="restaurant:country-name" content="Brasil"/>
\t<meta property="restaurant:type" content="restaurant"/>

META;
        $this->assertEquals($testMeta, $this->abm->getMeta());
        $testArray = array('title' => 'Uziel Restaurante', 'description' => 'Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R$ 26,90, mas você paga no máximo R$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant', 'image' => 'http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054', 'url' => ROOT_URL . 'sp/s-o-paulo/restaurante/uziel-restaurante/UCV34B2P.html', 'address' => 'R. Min. Jesuino Cardoso, 473', 'city' => 'São Paulo', 'state' => 'SP', 'country-name' => 'Brasil', 'type' => 'restaurant');
        $this->assertEquals($testArray, $this->abm->getArray());
    }
 public static function map(Address $address, array $properties)
 {
     if (array_key_exists('id', $properties)) {
         $address->setId($properties['id']);
     }
     if (array_key_exists('street', $properties)) {
         $address->setStreet($properties['street']);
     }
     if (array_key_exists('suburb', $properties)) {
         $address->setSuburb($properties['suburb']);
     }
     if (array_key_exists('city', $properties)) {
         $address->setCity($properties['city']);
     }
     if (array_key_exists('post_code', $properties)) {
         $address->setPostCode($properties['post_code']);
     }
     if (array_key_exists('street_no', $properties)) {
         $address->setstreetNo($properties['street_no']);
     }
 }
예제 #6
0
 /**
  * @group shopobjects
  */
 function testSetAddressParameters()
 {
     // GIVEN
     $incompleteAddressParameter = $this->givenIncompleteAddressParameter();
     // WHEN
     $address = new Address($incompleteAddressParameter);
     $address->setBirthday("01.02.1900");
     $address->setCity("Cologne");
     $address->setCompany("FakeCompany");
     $address->setCountry("England");
     $address->setEmailAddress("*****@*****.**");
     $address->setFirstName("Max");
     $address->setLastName("Miller");
     $address->setSalutation("Mr.");
     $address->setState("NRW");
     $address->setStreet("First street 2");
     $address->setStreetDetails("c/o Mister Smith");
     $address->setTitle("Master");
     $address->setVatId("DE1234567890");
     $address->setZipCode("12345");
     // THEN
     $this->assertFalse($address->error());
     $this->thenCompleteAddressInformationIsExisting($address);
 }
예제 #7
0
 public function executeConfirmStudent(sfWebRequest $request)
 {
     sfContext::getInstance()->set("user", new FakeUser());
     //tomo las intancias de las librerias.
     $i_identification_type = BaseCustomOptionsHolder::getInstance('IdentificationType');
     $i_sex_type = BaseCustomOptionsHolder::getInstance('SexType');
     $i_nationality = BaseCustomOptionsHolder::getInstance('Nationality');
     $s_lastname = $this->getRequestParameter('apellido');
     // Es obligatorio
     $s_firstname = $this->getRequestParameter('nombres');
     // Es obligatorio
     $s_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('tipo_documento_id'));
     $s_identification_number = $this->getRequestParameter('nro_documento');
     $s_sex = $i_sex_type->getSexType($this->getRequestParameter('sexo'));
     //Es obligatorio
     $s_phone = $this->getRequestParameter('telefono_fijo');
     $s_birthdate = $this->getRequestParameter('fecha_nacimiento');
     $s_birth_city = $this->getRequestParameter('ciudad_nacimiento_id');
     $s_health_coverage_id = $this->getRequestParameter('obra_social_id');
     $s_origin_school_id = $request->getParameter('escuela_procedencia_numero');
     //domicilio
     $s_city = $this->getRequestParameter('domicilio_ciudad_id');
     $s_street = $this->getRequestParameter('domicilio_calle');
     $s_number = $this->getRequestParameter('domicilio_numero');
     $s_floor = $this->getRequestParameter('domicilio_piso');
     $s_flat = $this->getRequestParameter('domicilio_departamento');
     //Chequeo tutor (madre)
     $m_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('madre_tipo_documento_id'));
     $m_identification_number = $this->getRequestParameter('madre_nro_documento');
     $m_firstname = $this->getRequestParameter('madre_nombres');
     $m_lastname = $this->getRequestParameter('madre_apellido');
     $m_occupation = $this->getRequestParameter('madre_actividad_id');
     $m_occupation_category = $this->getRequestParameter('madre_ocupacion_id');
     $m_study = $this->getRequestParameter('madre_estudios_id');
     $m_email = $this->getRequestParameter('madre_email');
     $m_phone = $this->getRequestParameter('madre_telefono_celular');
     $m_birthdate = $this->getRequestParameter('madre_fecha_nacimiento');
     $m_birth_city = $this->getRequestParameter('madre_ciudad_nacimiento_id');
     $m_nationality = $i_nationality->getNationality($this->getRequestParameter('madre_nacionalidad_id'));
     $m_is_alive = $this->getRequestParameter('madre_vive');
     //chequeo is_alive
     if ($m_is_alive == 'S') {
         $m_is_alive = true;
     } elseif ($m_is_alive == 'N') {
         $m_is_alive = false;
     }
     //domicilio
     $m_city = $this->getRequestParameter('madre_domicilio_ciudad_id');
     $m_street = $this->getRequestParameter('madre_domicilio_calle');
     $m_number = $this->getRequestParameter('madre_domicilio_numero');
     $m_floor = $this->getRequestParameter('madre_domicilio_piso');
     $m_flat = $this->getRequestParameter('madre_domicilio_departamento');
     //Chequeo tutor (padre)
     $p_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('padre_tipo_documento_id'));
     $p_identification_number = $this->getRequestParameter('padre_nro_documento');
     $p_firstname = $this->getRequestParameter('padre_nombres');
     $p_lastname = $this->getRequestParameter('padre_apellido');
     $p_occupation = $this->getRequestParameter('padre_actividad_id');
     $p_occupation_category = $this->getRequestParameter('padre_ocupacion_id');
     $p_study = $this->getRequestParameter('padre_estudios_id');
     $p_email = $this->getRequestParameter('padre_email');
     $p_phone = $this->getRequestParameter('padre_telefono_celular');
     $p_birthdate = $this->getRequestParameter('padre_fecha_nacimiento');
     $p_birth_city = $this->getRequestParameter('padre_ciudad_nacimiento_id');
     $p_nationality = $i_nationality->getNationality($this->getRequestParameter('padre_nacionalidad_id'));
     $p_is_alive = $this->getRequestParameter('padre_vive');
     //chequeo is_alive
     if ($p_is_alive == 'S') {
         $p_is_alive = true;
     } elseif ($p_is_alive == 'N') {
         $p_is_alive = false;
     }
     //domicilio
     $p_city = $this->getRequestParameter('padre_domicilio_ciudad_id');
     $p_street = $this->getRequestParameter('padre_domicilio_calle');
     $p_number = $this->getRequestParameter('padre_domicilio_numero');
     $p_floor = $this->getRequestParameter('padre_domicilio_piso');
     $p_flat = $this->getRequestParameter('padre_domicilio_departamento');
     $data = array();
     //chequeo campos obligatorios
     if (is_null($s_identification_type) || is_null($s_identification_number) || is_null($s_lastname) || trim($s_lastname) == "" || is_null($s_firstname) || trim($s_firstname) == "" || is_null($s_sex)) {
         throw new Exception('Missing data');
     } else {
         $con = Propel::getConnection();
         try {
             //chequeo que el alumno no haya sido ingresado en un año anterior (por lista de espera)
             $student = StudentPeer::retrieveByDocumentTypeAndNumber($s_identification_type, $s_identification_number);
             $con->beginTransaction();
             if (is_null($student)) {
                 //el alumno no existe. Creo la persona y el alumno
                 $s_person = new Person();
                 $s_person->setLastname($s_lastname);
                 $s_person->setFirstname($s_firstname);
                 $s_person->setSex($s_sex);
                 $s_person->setIdentificationType($s_identification_type);
                 $s_person->setIdentificationNumber($s_identification_number);
                 $s_person->setPhone($s_phone);
                 $s_person->setBirthdate($s_birthdate);
                 $s_person->setIsActive(true);
                 $s_person->setBirthCity($s_birth_city);
                 $s_person->save(Propel::getConnection());
                 $student = new Student();
                 $student->setPerson($s_person);
                 $student->setGlobalFileNumber('888888');
                 //Nro de legajo??
                 $student->setOriginSchoolId($s_origin_school_id);
                 $student->setHealthCoverageId($s_health_coverage_id);
                 $student->save(Propel::getConnection());
                 /* Recupero department, state ,country*/
                 if (!is_null($s_birth_city)) {
                     $city = CityPeer::retrieveByPk($s_birth_city);
                     $student->getPerson()->setBirthCountry($city->getDepartment()->getState()->getCountry()->getId());
                     $student->getPerson()->setBirthState($city->getDepartment()->getState()->getId());
                     $student->getPerson()->setBirthDepartment($city->getDepartment()->getId());
                 }
                 //chequeo domicilio
                 if (!is_null($s_city) || !is_null($s_street) || !is_null($s_number) || !is_null($s_floor) || is_null($s_flat)) {
                     $a = new Address();
                     $a->setCityId($s_city);
                     $a->setStreet($s_street);
                     $a->setNumber($s_number);
                     $a->setFloor($s_floor);
                     $a->setFlat($s_flat);
                     $student->getPerson()->setAddress($a);
                     $student->getPerson()->save(Propel::getConnection());
                     $data['message'] = "El alumno ha sido confirmado.";
                 }
             } else {
                 //seteo isActive
                 $student->getPerson()->setIsActive(true);
                 $student->save(Propel::getConnection());
                 $data['message'] = "El alumno fue actualizado correctamente.";
             }
             //chequeo campos obligatorios
             if (!is_null($m_identification_type) && !is_null($m_identification_number) && !is_null($m_lastname) && trim($m_lastname) != "" && !is_null($m_firstname) && trim($m_firstname) != "") {
                 //busco si ya existe.
                 $m_tutor = TutorPeer::findByDocumentTypeAndNumber($m_identification_type, $m_identification_number);
                 if (is_null($m_tutor)) {
                     //el tutor no existe. Lo creo
                     $m_person = new Person();
                     $m_person->setLastname($m_lastname);
                     $m_person->setFirstname($m_firstname);
                     $m_person->setIdentificationType($m_identification_type);
                     $m_person->setIdentificationNumber($m_identification_number);
                     $m_person->setSex(SexType::FEMALE);
                     $m_person->setPhone($m_phone);
                     $m_person->setEmail($m_email);
                     $m_person->setBirthdate($m_birthdate);
                     $m_person->setIsActive(true);
                     $m_person->setBirthCity($m_birth_city);
                     $m_person->save(Propel::getConnection());
                     $m_tutor = new Tutor();
                     $m_tutor->setPerson($m_person);
                     $m_tutor->setOccupationId($m_occupation);
                     $m_tutor->setOccupationCategoryId($m_occupation_category);
                     $m_tutor->setStudyId($m_study);
                     //coincide con la tabla sga_tipos_est_cur
                     $m_tutor->setNationality($m_nationality);
                     $m_tutor->setIsAlive($m_is_alive);
                     $m_tutor->save(Propel::getConnection());
                     /* Recupero department, state ,country*/
                     if (!is_null($m_birth_city)) {
                         $m_city = CityPeer::retrieveByPk($m_birth_city);
                         $m_tutor->getPerson()->setBirthCountry($m_city->getDepartment()->getState()->getCountry()->getId());
                         $m_tutor->getPerson()->setBirthState($m_city->getDepartment()->getState()->getId());
                         $m_tutor->getPerson()->setBirthDepartment($m_city->getDepartment()->getId());
                     }
                     //chequeo domicilio
                     if (!is_null($m_city) || !is_null($m_street) || !is_null($m_number) || !is_null($m_floor) || is_null($m_flat)) {
                         $a = new Address();
                         $a->setCityId($m_birth_city);
                         $a->setStreet($m_street);
                         $a->setNumber($m_number);
                         $a->setFloor($m_floor);
                         $a->setFlat($m_flat);
                         $m_tutor->getPerson()->setAddress($a);
                         $m_tutor->getPerson()->save(Propel::getConnection());
                     }
                 } else {
                     $data['info'] = "El tutor con " . $i_identification_type->getStringFor($m_identification_type) . " " . $m_identification_number;
                 }
                 $st = StudentTutorPeer::retrieveByStudentAndTutor($student, $m_tutor);
                 if (is_null($st)) {
                     //datos de tutor(madre)
                     $student_tutor = new StudentTutor();
                     $student_tutor->setStudent($student);
                     $student_tutor->setTutor($m_tutor);
                     $student_tutor->save(Propel::getConnection());
                     $m_tutor->addStudentTutor($student_tutor);
                     $m_tutor->save(Propel::getConnection());
                 }
             }
             //chequeo campos obligatorios
             if (!is_null($p_identification_type) && !is_null($p_identification_number) && !is_null($p_lastname) && trim($p_lastname) != "" && !is_null($p_firstname) && trim($p_firstname) != "") {
                 //busco si ya existe.
                 $tutor = TutorPeer::findByDocumentTypeAndNumber($p_identification_type, $p_identification_number);
                 if (is_null($tutor)) {
                     //el tutor no existe. Lo creo
                     $p_person = new Person();
                     $p_person->setLastname($p_lastname);
                     $p_person->setFirstname($p_firstname);
                     $p_person->setIdentificationType($p_identification_type);
                     $p_person->setIdentificationNumber($p_identification_number);
                     $p_person->setSex(SexType::MALE);
                     $p_person->setPhone($p_phone);
                     $p_person->setEmail($p_email);
                     $p_person->setBirthdate($p_birthdate);
                     $p_person->setIsActive(true);
                     $p_person->setBirthCity($p_birth_city);
                     $p_person->save(Propel::getConnection());
                     $tutor = new Tutor();
                     $tutor->setPerson($p_person);
                     $tutor->setOccupationId($p_occupation);
                     $tutor->setOccupationCategoryId($p_occupation_category);
                     $tutor->setStudyId($p_study);
                     //coincide con la tabla sga_tipos_est_cur
                     $tutor->setNationality($p_nationality);
                     $tutor->save(Propel::getConnection());
                     /* Recupero department, state ,country*/
                     if (!is_null($p_birth_city)) {
                         $p_city = CityPeer::retrieveByPk($p_birth_city);
                         $tutor->getPerson()->setBirthCountry($p_city->getDepartment()->getState()->getCountry()->getId());
                         $tutor->getPerson()->setBirthState($p_city->getDepartment()->getState()->getId());
                         $tutor->getPerson()->setBirthDepartment($p_city->getDepartment()->getId());
                     }
                     //chequeo domicilio
                     if (!is_null($p_city) || !is_null($p_street) || !is_null($p_number) || !is_null($p_floor) || is_null($p_flat)) {
                         $a = new Address();
                         $a->setCityId($p_birth_city);
                         $a->setStreet($p_street);
                         $a->setNumber($p_number);
                         $a->setFloor($p_floor);
                         $a->setFlat($p_flat);
                         $tutor->getPerson()->setAddress($a);
                         $tutor->getPerson()->save(Propel::getConnection());
                     }
                     if (!is_null($data['info'])) {
                         $data['info'] = $data['info'] . " ya existe en el sistema. Por favor actualice los datos.";
                     }
                 } else {
                     if (!is_null($data['info'])) {
                         $data['info'] = "Los tutores con " . $i_identification_type->getStringFor($m_identification_type) . " " . $m_identification_number . " y " . $i_identification_type->getStringFor($p_identification_type) . " " . $p_identification_number . " ya existen en el sistema. Por favor actualice los datos.";
                     } else {
                         $data['info'] = "El tutor con " . $i_identification_type->getStringFor($p_identification_type) . " " . $p_identification_number . " ya existe en el sistema. Por favor actualice los datos.";
                     }
                 }
                 //datos de tutor(padre)
                 $st = StudentTutorPeer::retrieveByStudentAndTutor($student, $tutor);
                 if (is_null($st)) {
                     $student_tutor = new StudentTutor();
                     $student_tutor->setStudent($student);
                     $student_tutor->setTutor($tutor);
                     $student_tutor->save(Propel::getConnection());
                     $tutor->addStudentTutor($student_tutor);
                     $tutor->save(Propel::getConnection());
                 }
             }
             $con->commit();
         } catch (PropelException $e) {
             $con->rollBack();
             throw $e;
         }
     }
     $this->data = $data;
     $this->getResponse()->setHttpHeader('Content-type', 'application/json');
     $this->getResponse()->setContent(json_encode($data));
     $this->setLayout(false);
 }
예제 #8
0
 /**
  * Populates the Venue object from the request
  * @return bean Venue
  */
 private function getBeanFromRequest()
 {
     $venue = new Venue();
     $addr = new Address();
     $addr->setOid($_REQUEST['aoid']);
     $addr->setStreet($_REQUEST['street']);
     $addr->setUnit($_REQUEST['unit']);
     $addr->setCity($_REQUEST['city']);
     $addr->setState($_REQUEST['state']);
     $addr->setPostalCode($_REQUEST['postalCode']);
     $addr->setPhone($_REQUEST['phone']);
     $venue->setOid($_REQUEST['oid']);
     $venue->setName($_REQUEST['name']);
     $venue->setDescription($_REQUEST['description']);
     $venue->setPubState($_REQUEST['pubState']);
     $venue->setAddress($addr);
     if (isset($_REQUEST['gallery'])) {
         $venue->setGallery($_REQUEST['gallery']);
     }
     $links = array();
     //$links['exhibition'] = $_REQUEST['exhibition'];
     //$links['program'] = isset($_REQUEST['program']) ? $_REQUEST['program'] : null;
     //$links['course'] = isset($_REQUEST['course']) ? $_REQUEST['course'] : null;
     $venue->setEvents($links);
     return $venue;
 }
예제 #9
0
파일: PlaceTest.php 프로젝트: EHER/chegamos
 public function testPopulate()
 {
     $subCategory = new Subcategory();
     $subCategory->setId(1234);
     $subCategory->setName("Self Service");
     $category = new Category();
     $category->setId(12);
     $category->setName("Restaurantes");
     $category->setSubCategory($subCategory);
     $city = new City();
     $city->setCountry("Brasil");
     $city->setState("SP");
     $city->setName("São Paulo");
     $address = new Address();
     $address->setCity($city);
     $address->setComplement("1 Andar");
     $address->setDistrict("Vila Olímpia");
     $address->setNumber("129");
     $address->setStreet("Rua Funchal");
     $address->setZipcode("04551-069");
     $gasStation = new GasStation(array('price_gas' => 1, 23, 'price_vodka' => 23, 45));
     $placeInfo = new PlaceInfo();
     $placeInfo->setGasStation($gasStation);
     $data = new \stdClass();
     $data->id = 123;
     $data->name = "Chegamos!";
     $data->average_rating = 4;
     $data->review_count = 3;
     $data->category = $category;
     $data->subcategory = $subCategory;
     $data->address = $address;
     $data->point->lat = "-23.529366";
     $data->point->lng = "-47.467117";
     $data->main_url = "http://chegamos.com/";
     $data->other_url = "http://chegamos.com.br/";
     $data->icon_url = "http://chegamos.com/img/icon.png";
     $data->description = "Description";
     $data->created = "01/12/2010 16:19";
     $data->phone = "11 2222-3333";
     $data->extended = $placeInfo;
     $data->num_visitors = 1024;
     $data->num_photos = 5;
     $this->object->populate($data);
     $this->assertEquals(123, $this->object->getId());
     $this->assertEquals("Chegamos!", $this->object->getName());
     $this->assertEquals(4, $this->object->getAverageRating());
     $this->assertEquals("Bom", $this->object->getAverageRatingString());
     $this->assertEquals(3, $this->object->getReviewCount());
     $this->assertEquals("app\\models\\Category", \get_class((object) $this->object->getCategory()));
     $this->assertEquals("Restaurantes - Self Service", (string) $this->object->getCategory());
     $this->assertEquals("app\\models\\Address", \get_class((object) $this->object->getAddress()));
     $this->assertEquals("Rua Funchal, 129 - Vila Olímpia<br/>São Paulo - SP", (string) $this->object->getAddress());
     $this->assertEquals("-23.529366,-47.467117", (string) $this->object->getPoint());
     $this->assertEquals("http://chegamos.com/", $this->object->getMainUrl());
     $this->assertEquals("http://chegamos.com.br/", $this->object->getOtherUrl());
     $this->assertEquals("http://chegamos.com/img/icon.png", $this->object->getIconUrl());
     $this->assertEquals("Description", $this->object->getDescription());
     $this->assertEquals("01/12/2010 16:19", $this->object->getCreated());
     $this->assertEquals("11 2222-3333", $this->object->getPhone());
     $this->assertEquals("app\\models\\PlaceInfo", \get_class((object) $this->object->getPlaceInfo()));
     $this->assertEquals(1024, $this->object->getNumVisitors());
     $this->assertEquals(5, $this->object->getNumPhotos());
 }
예제 #10
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $CompanyDetails = new SoapObject(NCCBIZ . "CompanyDetails.php", "urn:Object");
             if (!($xmlStr = $CompanyDetails->getCompanyDetails($this->formArray["companyID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "record not found");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "error xmlDoc");
                 } else {
                     $company = new Company();
                     $company->parseDomDocument($domDoc);
                     $this->formArray["companyID"] = $company->getCompanyID();
                     $this->formArray["companyName"] = $company->getCompanyName();
                     $this->formArray["tin"] = $company->getTin();
                     $this->formArray["telephone"] = $company->getTelephone();
                     $this->formArray["fax"] = $company->getFax();
                     $address = $company->addressArray[0];
                     if (is_a($address, Address)) {
                         $this->formArray["addressID"] = $address->getAddressID();
                         $this->formArray["number"] = $address->getNumber();
                         $this->formArray["street"] = $address->getStreet();
                         $this->formArray["barangay"] = $address->getBarangay();
                         $this->formArray["district"] = $address->getDistrict();
                         $this->formArray["municipalityCity"] = $address->getMunicipalitycity();
                         $this->formArray["province"] = $address->getProvince();
                     }
                     $this->formArray["email"] = $company->getEmail();
                     $this->formArray["website"] = $company->getWebsite();
                 }
             }
             break;
         case "save":
             $CompanyEncode = new SoapObject(NCCBIZ . "CompanyEncode.php", "urn:Object");
             if ($this->formArray["companyID"] != "") {
                 $CompanyDetails = new SoapObject(NCCBIZ . "CompanyDetails.php", "urn:Object");
                 if (!($xmlStr = $CompanyDetails->getCompanyDetails($this->formArray["companyID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $company = new Company();
                         $company->parseDomDocument($domDoc);
                         $address = $company->addressArray[0];
                         if (is_a($address, Address)) {
                             $address->setAddressID($this->formArray["addressID"]);
                             $address->setNumber($this->formArray["number"]);
                             $address->setStreet($this->formArray["street"]);
                             $address->setBarangay($this->formArray["barangay"]);
                             $address->setDistrict($this->formArray["district"]);
                             $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                             $address->setProvince($this->formArray["province"]);
                             $address->setDomDocument();
                         }
                         //$company->selectRecord($this->formArray["companyID"]);
                         $company->setCompanyID($this->formArray["companyID"]);
                         $company->setCompanyName($this->formArray["companyName"]);
                         $company->setTin($this->formArray["tin"]);
                         $company->setTelephone($this->formArray["telephone"]);
                         $company->setFax($this->formArray["fax"]);
                         $company->setAddressArray($address);
                         $company->setEmail($this->formArray["email"]);
                         $company->setWebsite($this->formArray["website"]);
                         $company->setDomDocument();
                         $doc = $company->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $CompanyEncode->updateCompany($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $company = new Company();
                 $company->setCompanyID($this->formArray["companyID"]);
                 $company->setCompanyName($this->formArray["companyName"]);
                 $company->setTelephone($this->formArray["telephone"]);
                 $company->setFax($this->formArray["fax"]);
                 $company->setTin($this->formArray["tin"]);
                 $company->setAddressArray($address);
                 $company->setEmail($this->formArray["email"]);
                 $company->setWebsite($this->formArray["website"]);
                 $company->setDomDocument();
                 $doc = $company->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $CompanyEncode->saveCompany($xmlStr, $this->formArray["ownerID"]))) {
                     exit("error save");
                 }
             }
             $this->formArray["companyID"] = $ret;
             //echo $ret;
             //}
             header("location: CompanyClose.php?parentURL=" . urlencode($this->formArray["parentURL"]));
             exit;
             //*/
             //else echo "tumpak!";
             break;
         case "cancel":
             header("location: CompanyList.php");
             exit;
             break;
         default:
             if ($this->formArray["locID"]) {
                 $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
                 if (!($xmlStr = $ODDetails->getLocation($this->formArray["locID"]))) {
                     exit("xml failed");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                     } else {
                         $loc = new LocationAddress();
                         $loc->parseDomDocument($domDoc);
                         foreach ($loc as $key => $value) {
                             $this->formArray[$key] = $value;
                         }
                     }
                 }
             }
             $this->tpl->set_block("rptsTemplate", "companyID", "companyIDBlock");
             $this->tpl->set_var("companyIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
     }
     //*/
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
예제 #11
0
 public function testSetStreetWorks()
 {
     $address = new Address();
     $address->setStreet('Rua dos bobos');
     $this->assertEquals('Rua dos bobos', $address->getStreet());
 }
예제 #12
0
파일: testparse.php 프로젝트: armic/erpts
    }
}
//*
$address = new Address();
//$address->setAddressID(124);
$address->setNumber("xunit 2415 Megaplaza Building");
$address->setStreet("xADB Avenue corner Garnett Street");
$address->setBarangay("xBarangay San Antonio");
$address->setDistrict("xOrtigas Center");
$address->setMunicipalityCity("xPasig City");
$address->setProvince("xMetro Manila");
$address->setDomDocument();
$address1 = new Address();
//$address->setAddressID(124);
$address1->setNumber("unit 2415 Megaplaza Building");
$address1->setStreet("ADB Avenue corner Garnett Street");
$address1->setBarangay("Barangay San Antonio");
$address1->setDistrict("Ortigas Center");
$address1->setMunicipalityCity("Pasig City");
$address1->setProvince("Metro Manila");
$address1->setDomDocument();
$person = new Person();
//$person->setPersonID(126);
$person->setFirstName("Nelson Juan");
$person->setMiddleName("Miranda");
$person->setLastName(date("H:i:s"));
$person->setGender("male");
$person->setBirthday("1977/07/09");
$person->setMaritalStatus("single");
$person->setTin("1234567890");
$person->setTelephone("026584746");
예제 #13
0
파일: AFSEncode.php 프로젝트: armic/erpts
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 echo "xml failed";
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $afs = new AFS();
                     $afs->parseDomAFS($domDoc);
                     foreach ($afs as $key => $value) {
                         $this->formArray[$key] = $value;
                     }
                     //print_r($afs);
                     //exit();
                     $administrator = $afs->getAdministratorArray();
                     foreach ($administrator as $key => $value) {
                         $this->formArray["lastName"] = $value->getLastName();
                         $this->formArray["firstName"] = $value->getFirstName();
                         $this->formArray["middleName"] = $value->getMiddleName();
                         $this->formArray["number"] = $value->getNumber();
                         $this->formArray["street"] = $value->getStreet();
                         $this->formArray["barangay"] = $value->getBarangay();
                         $this->formArray["district"] = $value->getDistrict();
                         $this->formArray["municipalityCity"] = $value->getMunicipalityCity();
                         $this->formArray["province"] = $value->getProvince();
                         $this->formArray["telephone"] = $value->getTelephone();
                     }
                 }
             }
             break;
         case "save":
             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
             if ($this->formArray["afsID"] != "") {
                 $afs = new AFS();
                 $afs->selectAFS($this->formArray["afsID"]);
                 $afs->setOdID($this->formArray["odID"]);
                 $afs->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $afs->setCertificateOfTitleNumber($this->formArray["certificateOfTitleNumber"]);
                 $afs->setCadastralLotNumber($this->formArray["cadastralLotNumber"]);
                 $afs->setNorth($this->formArray["north"]);
                 $afs->setSouth($this->formArray["south"]);
                 $afs->setEast($this->formArray["east"]);
                 $afs->setWest($this->formArray["west"]);
                 $afs->setCreatedBy($this->userID);
                 $afs->setModifiedBy($this->userID);
                 $person = new Person();
                 $person->setPersonID($afs->getAdministrator());
                 $person->setLastName($this->formArray["lastName"]);
                 $person->setFirstName($this->formArray["firstName"]);
                 $person->setMiddleName($this->formArray["middleName"]);
                 $person->setNumber($this->formArray["number"]);
                 $person->setStreet($this->formArray["street"]);
                 $person->setBarangay($this->formArray["barangay"]);
                 $person->setDistrict($this->formArray["district"]);
                 $person->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $person->setProvince($this->formArray["province"]);
                 $person->setTelephone($this->formArray["telephone"]);
                 $person->setDom();
                 $afs->setAdministratorArray($person);
                 $afs->setDomAFS();
                 $doc = $afs->getDomAFS();
                 $xmlStr = $doc->dump_mem();
                 if (!($ret = $AFSEncode->updateAFS($xmlStr))) {
                     echo "error update";
                 }
                 header("location: AFSClose.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $ret)));
                 exit;
             } else {
                 $afs = new AFS();
                 $afs->setOdID($this->formArray["odID"]);
                 $afs->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $afs->setCertificateOfTitleNumber($this->formArray["certificateOfTitleNumber"]);
                 $afs->setCadastralLotNumber($this->formArray["cadastralLotNumber"]);
                 $afs->setNorth($this->formArray["north"]);
                 $afs->setSouth($this->formArray["south"]);
                 $afs->setEast($this->formArray["east"]);
                 $afs->setWest($this->formArray["west"]);
                 $afs->setCreatedBy($this->userID);
                 $afs->setModifiedBy($this->userID);
                 $adminAddress = new Address();
                 $adminAddress->setNumber($this->formArray["number"]);
                 $adminAddress->setStreet($this->formArray["street"]);
                 $adminAddress->setBarangay($this->formArray["barangay"]);
                 $adminAddress->setDistrict($this->formArray["district"]);
                 $adminAddress->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $adminAddress->setProvince($this->formArray["province"]);
                 $adminAddress->setDomDocument();
                 $person = new Person();
                 $person->setLastName($this->formArray["lastName"]);
                 $person->setFirstName($this->formArray["firstName"]);
                 $person->setMiddleName($this->formArray["middleName"]);
                 $person->setTelephone($this->formArray["telephone"]);
                 $person->setDomDocument();
                 $afs->setAdministratorArray($person);
                 $afs->setDomDocument();
                 $doc = $afs->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $AFSEncode->saveAFS($xmlStr))) {
                     echo "ret=" . $ret;
                 }
                 $this->formArray["afsID"] = $ret;
                 header("location: AFSClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $ret)));
                 exit;
             }
             break;
         case "cancel":
             header("location: AFSList.php");
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
             $this->tpl->set_var("odIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
예제 #14
0
    if (is_null($address)) {
        $response['msg'] = array('desc' => 'Address with id "' . $addressId . '" not found.', 'code' => '404');
    } else {
        $address->setActive(!$address->isActive());
        $entityManager->flush();
        $response['address'] = $address->__toJson();
        $response['msg'] = array('desc' => 'Address with id "' . $addressId . '" successful updated.', 'code' => '200');
    }
    /** only if we want add some entry in our database */
} elseif ($request->getMethod() === "POST" && $request->get('action', false) === 'add') {
    /** simple add without checks - while not required - only try catch */
    try {
        $address = new Address();
        $address->setForename($request->get('forename'));
        $address->setSurname($request->get('surname'));
        $address->setStreet($request->get('street'));
        $address->setZip($request->get('zip'));
        $address->setCity($request->get('city'));
        $address->setPhonenumber($request->get('phonenumber'));
        $address->setDateofbirth($request->get('date_of_birth') ? new DateTime($request->get('date_of_birth')) : null);
        $entityManager->persist($address);
        $entityManager->flush();
        $response['address'] = $address->__toJson();
        $response['msg'] = array('desc' => 'Address with id "' . $address->getId() . '" successful created.', 'code' => '200');
    } catch (Exception $e) {
        $response['msg'] = array('desc' => $e->getMessage(), 'code' => '500');
    }
    /** simple get with filtered query */
} else {
    /** @var \Doctrine\ORM\QueryBuilder $addressRepository */
    $addressRepository = $entityManager->getRepository('Address')->createQueryBuilder('a');
예제 #15
0
 public static function getAddresses($where = null)
 {
     $dados = Database::ReadAll("address a, city c, state s", "a.*, c.*, s.*", "WHERE a.id_city = c.id_city AND s.id_state = c.id_state " . $where);
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $address = new Address();
         $address->setId($dado['ID_ADDRESS']);
         $address->setStreet($dado['NAME_ADDRESS']);
         $address->setNumber($dado['NUMBER']);
         $address->setComplement($dado['COMPLEMENT']);
         $address->setDistrict($dado['DISTRICT']);
         $address->setLatitude($dados['LATITUDE']);
         $address->setLongitude($dados['LONGITUDE']);
         $address->setCity($dado['NAME_CITY']);
         $address->setState($dado['INITIALS']);
         $address->setPs($dado['PS']);
         $addresses[] = $address;
     }
     return $addresses;
 }
예제 #16
0
 /**
  * @expectedException NfeFocus\Exception\FieldRequiredException
  */
 public function testEmptyStreet()
 {
     $street = '';
     $address = new Address();
     $address->setStreet($street);
 }
 public static function readTransaction($str_xml)
 {
     // Parser
     $parser = new xmlParser($str_xml);
     // <transaction>
     $data = $parser->getResult('transaction');
     $transaction = new Transaction();
     // <transaction> <lastEventDate>
     if (isset($data["lastEventDate"])) {
         $transaction->setLastEventDate($data["lastEventDate"]);
     }
     // <transaction> <date>
     if (isset($data["date"])) {
         $transaction->setDate($data["date"]);
     }
     // <transaction> <code>
     if (isset($data["code"])) {
         $transaction->setCode($data["code"]);
     }
     // <transaction> <reference>
     if (isset($data["reference"])) {
         $transaction->setReference($data["reference"]);
     }
     // <transaction> <type>
     if (isset($data["type"])) {
         $transaction->setType(new TransactionType($data["type"]));
     }
     // <transaction> <status>
     if (isset($data["status"])) {
         $transaction->setStatus(new TransactionStatus($data["status"]));
     }
     if (isset($data["paymentMethod"]) && is_array($data["paymentMethod"])) {
         // <transaction> <paymentMethod>
         $paymentMethod = new PaymentMethod();
         // <transaction> <paymentMethod> <type>
         if (isset($data["paymentMethod"]['type'])) {
             $paymentMethod->setType(new PaymentMethodType($data["paymentMethod"]['type']));
         }
         // <transaction> <paymentMethod> <code>
         if (isset($data["paymentMethod"]['code'])) {
             $paymentMethod->setCode(new PaymentMethodCode($data["paymentMethod"]['code']));
         }
         $transaction->setPaymentMethod($paymentMethod);
     }
     // <transaction> <grossAmount>
     if (isset($data["grossAmount"])) {
         $transaction->setGrossAmount($data["grossAmount"]);
     }
     // <transaction> <discountAmount>
     if (isset($data["discountAmount"])) {
         $transaction->setDiscountAmount($data["discountAmount"]);
     }
     // <transaction> <feeAmount>
     if (isset($data["feeAmount"])) {
         $transaction->setFeeAmount($data["feeAmount"]);
     }
     // <transaction> <netAmount>
     if (isset($data["netAmount"])) {
         $transaction->setNetAmount($data["netAmount"]);
     }
     // <transaction> <extraAmount>
     if (isset($data["extraAmount"])) {
         $transaction->setExtraAmount($data["extraAmount"]);
     }
     // <transaction> <installmentCount>
     if (isset($data["installmentCount"])) {
         $transaction->setInstallmentCount($data["installmentCount"]);
     }
     if (isset($data["items"]['item']) && is_array($data["items"]['item'])) {
         $items = array();
         $i = 0;
         if (isset($data["items"]['item'][0])) {
             foreach ($data["items"]['item'] as $key => $value) {
                 $item = self::parseTransactionItem($value);
                 $items[$i] = $item;
                 $i++;
             }
         } else {
             $items[0] = self::parseTransactionItem($data["items"]['item']);
         }
         // <transaction> <items>
         $transaction->setItems($items);
     }
     if (isset($data["sender"])) {
         // <transaction> <sender>
         $sender = new Sender();
         // <transaction> <sender> <name>
         if (isset($data["sender"]["name"])) {
             $sender->setName($data["sender"]["name"]);
         }
         // <transaction> <sender> <email>
         if (isset($data["sender"]["email"])) {
             $sender->setEmail($data["sender"]["email"]);
         }
         if (isset($data["sender"]["phone"])) {
             // <transaction> <sender> <phone>
             $phone = new Phone();
             // <transaction> <sender> <phone> <areaCode>
             if (isset($data["sender"]["phone"]["areaCode"])) {
                 $phone->setAreaCode($data["sender"]["phone"]["areaCode"]);
             }
             // <transaction> <sender> <phone> <number>
             if (isset($data["sender"]["phone"]["number"])) {
                 $phone->setNumber($data["sender"]["phone"]["number"]);
             }
             $sender->setPhone($phone);
         }
         $transaction->setSender($sender);
     }
     if (isset($data["shipping"]) && is_array($data["shipping"])) {
         // <transaction> <shipping>
         $shipping = new Shipping();
         // <transaction> <shipping> <type>
         if (isset($data["shipping"]["type"])) {
             $shipping->setType(new ShippingType($data["shipping"]["type"]));
         }
         // <transaction> <shipping> <cost>
         if (isset($data["shipping"]["cost"])) {
             $shipping->setCost($data["shipping"]["cost"]);
         }
         if (isset($data["shipping"]["address"]) && is_array($data["shipping"]["address"])) {
             // <transaction> <shipping> <address>
             $address = new Address();
             // <transaction> <shipping> <address> <street>
             if (isset($data["shipping"]["address"]["street"])) {
                 $address->setStreet($data["shipping"]["address"]["street"]);
             }
             // <transaction> <shipping> <address> <number>
             if (isset($data["shipping"]["address"]["number"])) {
                 $address->setNumber($data["shipping"]["address"]["number"]);
             }
             // <transaction> <shipping> <address> <complement>
             if (isset($data["shipping"]["address"]["complement"])) {
                 $address->setComplement($data["shipping"]["address"]["complement"]);
             }
             // <transaction> <shipping> <address> <city>
             if (isset($data["shipping"]["address"]["city"])) {
                 $address->setCity($data["shipping"]["address"]["city"]);
             }
             // <transaction> <shipping> <address> <state>
             if (isset($data["shipping"]["address"]["state"])) {
                 $address->setState($data["shipping"]["address"]["state"]);
             }
             // <transaction> <shipping> <address> <district>
             if (isset($data["shipping"]["address"]["district"])) {
                 $address->setDistrict($data["shipping"]["address"]["district"]);
             }
             // <transaction> <shipping> <address> <postalCode>
             if (isset($data["shipping"]["address"]["postalCode"])) {
                 $address->setPostalCode($data["shipping"]["address"]["postalCode"]);
             }
             // <transaction> <shipping> <address> <country>
             if (isset($data["shipping"]["address"]["country"])) {
                 $address->setCountry($data["shipping"]["address"]["country"]);
             }
             $shipping->setAddress($address);
         }
         // <transaction> <shipping>
         $transaction->setShipping($shipping);
     }
     return $transaction;
 }
예제 #18
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $ImprovementsBuildingsDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsDetails.php", "urn:Object");
             if (!($xmlStr = $ImprovementsBuildingsDetails->getImprovementsBuildings($this->formArray["propertyID"]))) {
                 echo "xml failed";
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $improvementsBuildings = new ImprovementsBuildings();
                     $improvementsBuildings->parseDomDocument($domDoc);
                     foreach ($improvementsBuildings as $key => $value) {
                         switch ($key) {
                             case "propertyAdministrator":
                                 if (is_a($value, Person)) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday());
                                     $this->formArray["personID"] = $value->getPersonID();
                                     $this->formArray["lastName"] = $value->getLastName();
                                     $this->formArray["firstName"] = $value->getFirstName();
                                     $this->formArray["middleName"] = $value->getMiddleName();
                                     $this->formArray["gender"] = $value->getGender();
                                     $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                                     $this->formArray["maritalStatus"] = $value->getMaritalStatus();
                                     $this->formArray["tin"] = $value->getTin();
                                     if (is_array($value->addressArray)) {
                                         $this->formArray["addressID"] = $value->addressArray[0]->getAddressID();
                                         $this->formArray["number"] = $value->addressArray[0]->getNumber();
                                         $this->formArray["street"] = $value->addressArray[0]->getStreet();
                                         $this->formArray["barangay"] = $value->addressArray[0]->getBarangay();
                                         $this->formArray["district"] = $value->addressArray[0]->getDistrict();
                                         $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity();
                                         $this->formArray["province"] = $value->addressArray[0]->getProvince();
                                     }
                                     $this->formArray["telephone"] = $value->getTelephone();
                                     $this->formArray["mobileNumber"] = $value->getMobileNumber();
                                     $this->formArray["email"] = $value->getEmail();
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "appraisedByDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["as_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["as_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["as_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "recommendingApprovalDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["re_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["re_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["re_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "approvedByDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["av_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["av_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["av_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateConstructed":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["dc_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["dc_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["dc_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateOccupied":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["do_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["do_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["do_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateCompleted":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["dm_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["dm_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["dm_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             default:
                                 $this->formArray[$key] = $value;
                         }
                     }
                 }
             }
             break;
         case "save":
             if ($this->formArray["verifiedByID"] != "" && $this->formArray["verifiedByID"] != "xx" && $this->formArray["propertyID"] != "") {
                 $this->saveVerified($this->formArray["afsID"], $this->formArray["verifiedByID"], $this->formArray["propertyID"]);
             }
             $ImprovementsBuildingsEncode = new SoapObject(NCCBIZ . "ImprovementsBuildingsEncode.php", "urn:Object");
             if ($this->formArray["propertyID"] != "") {
                 $ImprovementsBuildingsDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsDetails.php", "urn:Object");
                 if (!($xmlStr = $ImprovementsBuildingsDetails->getImprovementsBuildings($this->formArray["propertyID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $address = new Address();
                         $address->setAddressID($this->formArray["addressID"]);
                         $address->setNumber($this->formArray["number"]);
                         $address->setStreet($this->formArray["street"]);
                         $address->setBarangay($this->formArray["barangay"]);
                         $address->setDistrict($this->formArray["district"]);
                         $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                         $address->setProvince($this->formArray["province"]);
                         $address->setDomDocument();
                         $propertyAdministrator = new Person();
                         $propertyAdministrator->setPersonID($this->formArray["personID"]);
                         $propertyAdministrator->setLastName($this->formArray["lastName"]);
                         $propertyAdministrator->setFirstName($this->formArray["firstName"]);
                         $propertyAdministrator->setMiddleName($this->formArray["middleName"]);
                         //$propertyAdministrator->setGender($this->formArray["gender"]);
                         //$propertyAdministrator->setBirthday($this->birthdate);
                         //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]);
                         //$propertyAdministrator->setTin($this->formArray["tin"]);
                         $propertyAdministrator->setAddressArray($address);
                         $propertyAdministrator->setTelephone($this->formArray["telephone"]);
                         //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]);
                         $propertyAdministrator->setEmail($this->formArray["email"]);
                         $propertyAdministrator->setDomDocument();
                         $improvementsBuildings = new ImprovementsBuildings();
                         $improvementsBuildings->parseDomDocument($domDoc);
                         $improvementsBuildings->setPropertyID($this->formArray["propertyID"]);
                         $improvementsBuildings->setAfsID($this->formArray["afsID"]);
                         $improvementsBuildings->setArpNumber($this->formArray["arpNumber"]);
                         $improvementsBuildings->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                         $improvementsBuildings->setPropertyAdministrator($propertyAdministrator);
                         $improvementsBuildings->setVerifiedBy($this->formArray["verifiedByID"]);
                         $improvementsBuildings->setPlottingsBy($this->formArray["plottingsByID"]);
                         $improvementsBuildings->setNotedBy($this->formArray["notedByID"]);
                         $improvementsBuildings->setMarketValue($this->formArray["marketValue"]);
                         $improvementsBuildings->setKind($this->formArray["kind"]);
                         $improvementsBuildings->setActualUse($this->formArray["actualUse"]);
                         $improvementsBuildings->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                         $improvementsBuildings->setAssessmentLevel($this->formArray["assessmentLevel"]);
                         $improvementsBuildings->setAssessedValue($this->formArray["assessedValue"]);
                         $improvementsBuildings->setPreviousOwner($this->formArray["previousOwner"]);
                         $improvementsBuildings->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                         $improvementsBuildings->setTaxability($this->formArray["taxability"]);
                         $improvementsBuildings->setEffectivity($this->formArray["effectivity"]);
                         $improvementsBuildings->setAppraisedBy($this->formArray["appraisedByID"]);
                         $improvementsBuildings->setAppraisedByDate($this->formArray["appraisedByDate"]);
                         $improvementsBuildings->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                         $improvementsBuildings->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                         $improvementsBuildings->setApprovedBy($this->formArray["approvedByID"]);
                         $improvementsBuildings->setApprovedByDate($this->formArray["approvedByDate"]);
                         $improvementsBuildings->setMemoranda($this->formArray["memoranda"]);
                         $improvementsBuildings->setPostingDate($this->formArray["postingDate"]);
                         $improvementsBuildings->setLandPin($this->formArray["landPin"]);
                         $improvementsBuildings->setFoundation($this->formArray["foundation"]);
                         $improvementsBuildings->setColumnsBldg($this->formArray["columnsBldg"]);
                         $improvementsBuildings->setBeams($this->formArray["beams"]);
                         $improvementsBuildings->setTrussFraming($this->formArray["trussFraming"]);
                         $improvementsBuildings->setRoof($this->formArray["roof"]);
                         $improvementsBuildings->setExteriorWalls($this->formArray["exteriorWalls"]);
                         $improvementsBuildings->setFlooring($this->formArray["flooring"]);
                         $improvementsBuildings->setDoors($this->formArray["doors"]);
                         $improvementsBuildings->setCeiling($this->formArray["ceiling"]);
                         $improvementsBuildings->setStructuralTypes($this->formArray["structuralTypes"]);
                         $improvementsBuildings->setBuildingClassification($this->formArray["buildingClassification"]);
                         $improvementsBuildings->setBuildingPermit($this->formArray["buildingPermit"]);
                         $improvementsBuildings->setBuildingAge($this->formArray["buildingAge"]);
                         $improvementsBuildings->setCctNumber($this->formArray["cctNumber"]);
                         $improvementsBuildings->setNumberOfStoreys($this->formArray["numberOfStoreys"]);
                         $improvementsBuildings->setWindows($this->formArray["windows"]);
                         $improvementsBuildings->setStairs($this->formArray["stairs"]);
                         $improvementsBuildings->setPartition($this->formArray["partition"]);
                         $improvementsBuildings->setWallFinish($this->formArray["wallFinish"]);
                         $improvementsBuildings->setElectrical($this->formArray["electrical"]);
                         $improvementsBuildings->setToiletAndBath($this->formArray["toiletAndBath"]);
                         $improvementsBuildings->setPlumbingSewer($this->formArray["plumbingSewer"]);
                         $improvementsBuildings->setFixtures($this->formArray["fixtures"]);
                         $improvementsBuildings->setDateConstructed($this->formArray["dateConstructed"]);
                         $improvementsBuildings->setDateOccupied($this->formArray["dateOccupied"]);
                         $improvementsBuildings->setDateCompleted($this->formArray["dateCompleted"]);
                         $improvementsBuildings->setAreaOfGroundFloor($this->formArray["areaOfGroundFloor"]);
                         $improvementsBuildings->setTotalBuildingArea($this->formArray["totalBuildingArea"]);
                         $improvementsBuildings->setUnitValue($this->formArray["unitValue"]);
                         $improvementsBuildings->setBuildingCoreAndAdditionalItems($this->formArray["buildingCoreAndAdditionalItems"]);
                         $improvementsBuildings->setAddItems($this->formArray["addItems"]);
                         $improvementsBuildings->setDepreciationRate($this->formArray["depreciationRate"]);
                         $improvementsBuildings->setAccumulatedDepreciation($this->formArray["accumulatedDepreciation"]);
                         $improvementsBuildings->setDepreciatedMarketValue($this->formArray["depreciatedMarketValue"]);
                         $improvementsBuildings->setCreatedBy($this->userID);
                         $improvementsBuildings->setModifiedBy($this->userID);
                         $improvementsBuildings->setDomDocument();
                         $doc = $improvementsBuildings->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         //echo $xmlStr;
                         $ret = $ImprovementsBuildingsEncode->updateImprovementsBuildings($xmlStr);
                         if (!($ret = $ImprovementsBuildingsEncode->updateImprovementsBuildings($xmlStr))) {
                             exit("error update" . $ret);
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 //$address->setAddressID($this->formArray["addressID"]);
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $propertyAdministrator = new Person();
                 //$propertyAdministrator->setPersonID($this->formArray["personID"]);
                 $propertyAdministrator->setLastName($this->formArray["lastName"]);
                 $propertyAdministrator->setFirstName($this->formArray["firstName"]);
                 $propertyAdministrator->setMiddleName($this->formArray["middleName"]);
                 //$propertyAdministrator->setGender($this->formArray["gender"]);
                 //$propertyAdministrator->setBirthday($this->birthdate);
                 //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]);
                 //$propertyAdministrator->setTin($this->formArray["tin"]);
                 $propertyAdministrator->setAddressArray($address);
                 $propertyAdministrator->setTelephone($this->formArray["telephone"]);
                 //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]);
                 $propertyAdministrator->setEmail($this->formArray["email"]);
                 $propertyAdministrator->setDomDocument();
                 $improvementsBuildings = new ImprovementsBuildings();
                 $improvementsBuildings->parseDomDocument($domDoc);
                 //$improvementsBuildings->setPropertyID($this->formArray["propertyID"]);
                 $improvementsBuildings->setAfsID($this->formArray["afsID"]);
                 $improvementsBuildings->setArpNumber($this->formArray["arpNumber"]);
                 $improvementsBuildings->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $improvementsBuildings->setPropertyAdministrator($propertyAdministrator);
                 $improvementsBuildings->setVerifiedBy($this->formArray["verifiedByID"]);
                 $improvementsBuildings->setPlottingsBy($this->formArray["plottingsByID"]);
                 $improvementsBuildings->setNotedBy($this->formArray["notedByID"]);
                 $improvementsBuildings->setMarketValue($this->formArray["marketValue"]);
                 $improvementsBuildings->setKind($this->formArray["kind"]);
                 $improvementsBuildings->setActualUse($this->formArray["actualUse"]);
                 $improvementsBuildings->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                 $improvementsBuildings->setAssessmentLevel($this->formArray["assessmentLevel"]);
                 $improvementsBuildings->setAssessedValue($this->formArray["assessedValue"]);
                 $improvementsBuildings->setPreviousOwner($this->formArray["previousOwner"]);
                 $improvementsBuildings->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                 $improvementsBuildings->setTaxability($this->formArray["taxability"]);
                 $improvementsBuildings->setEffectivity($this->formArray["effectivity"]);
                 $improvementsBuildings->setAppraisedBy($this->formArray["appraisedByID"]);
                 $improvementsBuildings->setAppraisedByDate($this->formArray["appraisedByDate"]);
                 $improvementsBuildings->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                 $improvementsBuildings->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                 $improvementsBuildings->setApprovedBy($this->formArray["approvedByID"]);
                 $improvementsBuildings->setApprovedByDate($this->formArray["approvedByDate"]);
                 $improvementsBuildings->setMemoranda($this->formArray["memoranda"]);
                 $improvementsBuildings->setPostingDate($this->formArray["postingDate"]);
                 $improvementsBuildings->setLandPin($this->formArray["landPin"]);
                 $improvementsBuildings->setFoundation($this->formArray["foundation"]);
                 $improvementsBuildings->setColumnsBldg($this->formArray["columnsBldg"]);
                 $improvementsBuildings->setBeams($this->formArray["beams"]);
                 $improvementsBuildings->setTrussFraming($this->formArray["trussFraming"]);
                 $improvementsBuildings->setRoof($this->formArray["roof"]);
                 $improvementsBuildings->setExteriorWalls($this->formArray["exteriorWalls"]);
                 $improvementsBuildings->setFlooring($this->formArray["flooring"]);
                 $improvementsBuildings->setDoors($this->formArray["doors"]);
                 $improvementsBuildings->setCeiling($this->formArray["ceiling"]);
                 $improvementsBuildings->setStructuralTypes($this->formArray["structuralTypes"]);
                 $improvementsBuildings->setBuildingClassification($this->formArray["buildingClassification"]);
                 $improvementsBuildings->setBuildingPermit($this->formArray["buildingPermit"]);
                 $improvementsBuildings->setBuildingAge($this->formArray["buildingAge"]);
                 $improvementsBuildings->setCctNumber($this->formArray["cctNumber"]);
                 $improvementsBuildings->setNumberOfStoreys($this->formArray["numberOfStoreys"]);
                 $improvementsBuildings->setWindows($this->formArray["windows"]);
                 $improvementsBuildings->setStairs($this->formArray["stairs"]);
                 $improvementsBuildings->setPartition($this->formArray["partition"]);
                 $improvementsBuildings->setWallFinish($this->formArray["wallFinish"]);
                 $improvementsBuildings->setElectrical($this->formArray["electrical"]);
                 $improvementsBuildings->setToiletAndBath($this->formArray["toiletAndBath"]);
                 $improvementsBuildings->setPlumbingSewer($this->formArray["plumbingSewer"]);
                 $improvementsBuildings->setFixtures($this->formArray["fixtures"]);
                 $improvementsBuildings->setDateConstructed($this->formArray["dateConstructed"]);
                 $improvementsBuildings->setDateOccupied($this->formArray["dateOccupied"]);
                 $improvementsBuildings->setDateCompleted($this->formArray["dateCompleted"]);
                 $improvementsBuildings->setAreaOfGroundFloor($this->formArray["areaOfGroundFloor"]);
                 $improvementsBuildings->setTotalBuildingArea($this->formArray["totalBuildingArea"]);
                 $improvementsBuildings->setUnitValue($this->formArray["unitValue"]);
                 $improvementsBuildings->setBuildingCoreAndAdditionalItems($this->formArray["buildingCoreAndAdditionalItems"]);
                 $improvementsBuildings->setAddItems($this->formArray["addItems"]);
                 $improvementsBuildings->setDepreciationRate($this->formArray["depreciationRate"]);
                 $improvementsBuildings->setAccumulatedDepreciation($this->formArray["accumulatedDepreciation"]);
                 $improvementsBuildings->setDepreciatedMarketValue($this->formArray["depreciatedMarketValue"]);
                 $improvementsBuildings->setCreatedBy($this->userID);
                 $improvementsBuildings->setModifiedBy($this->userID);
                 $improvementsBuildings->setDomDocument();
                 $doc = $improvementsBuildings->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //echo $xmlStr;
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $ImprovementsBuildingsEncode->saveImprovementsBuildings($xmlStr))) {
                     echo "ret=" . $ret;
                 }
             }
             $this->formArray["propertyID"] = $ret;
             header("location: ImprovementsBuildingsClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         case "cancel":
             header("location: ImprovementsBuildingsList.php");
             exit;
             break;
         default:
             if (!($firstPropertyID = $this->getFirstPropertyID())) {
                 $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
                 $this->tpl->set_var("odIDBlock", "");
                 $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
                 $this->tpl->set_var("ACKBlock", "");
             } else {
                 $ImprovementsBuildingsDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsDetails.php", "urn:Object");
                 if (!($xmlStr = $ImprovementsBuildingsDetails->getImprovementsBuildings($firstPropertyID))) {
                     echo "xml failed";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                         $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                     } else {
                         $improvementsBuildings = new ImprovementsBuildings();
                         $improvementsBuildings->parseDomDocument($domDoc);
                         foreach ($improvementsBuildings as $key => $value) {
                             switch ($key) {
                                 case "propertyID":
                                     $this->formArray["propertyID"] = "";
                                     break;
                                 case "propertyAdministrator":
                                     if (is_a($value, Person)) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday());
                                         $this->formArray["personID"] = $value->getPersonID();
                                         $this->formArray["lastName"] = $value->getLastName();
                                         $this->formArray["firstName"] = $value->getFirstName();
                                         $this->formArray["middleName"] = $value->getMiddleName();
                                         $this->formArray["gender"] = $value->getGender();
                                         $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                                         $this->formArray["maritalStatus"] = $value->getMaritalStatus();
                                         $this->formArray["tin"] = $value->getTin();
                                         $this->formArray["addressID"] = $value->addressArray[0]->getAddressID();
                                         $this->formArray["number"] = $value->addressArray[0]->getNumber();
                                         $this->formArray["street"] = $value->addressArray[0]->getStreet();
                                         $this->formArray["barangay"] = $value->addressArray[0]->getBarangay();
                                         $this->formArray["district"] = $value->addressArray[0]->getDistrict();
                                         $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity();
                                         $this->formArray["province"] = $value->addressArray[0]->getProvince();
                                         $this->formArray["telephone"] = $value->getTelephone();
                                         $this->formArray["mobileNumber"] = $value->getMobileNumber();
                                         $this->formArray["email"] = $value->getEmail();
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "appraisedByDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["as_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["as_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["as_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "recommendingApprovalDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["re_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["re_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["re_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "approvedByDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["av_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["av_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["av_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateConstructed":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["dc_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["dc_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["dc_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateOccupied":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["do_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["do_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["do_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateCompleted":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["dm_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["dm_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["dm_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "arpNumber":
                                 case "propertyIndexNumber":
                                 case "propertyAdministrator":
                                 case "personID":
                                 case "lastName":
                                 case "firstName":
                                 case "middleName":
                                 case "gender":
                                 case "birth_month":
                                 case "birth_day":
                                 case "birth_year":
                                 case "maritalStatus":
                                 case "tin":
                                 case "addressID":
                                 case "number":
                                 case "street":
                                 case "barangay":
                                 case "district":
                                 case "municipalityCity":
                                 case "province":
                                 case "telephone":
                                 case "mobileNumber":
                                 case "email":
                                 case "verifiedByID":
                                 case "verifiedBy":
                                 case "verifiedByName":
                                 case "plottingsByID":
                                 case "plottingsBy":
                                 case "plottingsByName":
                                 case "notedByID":
                                 case "notedBy":
                                 case "notedByName":
                                 case "marketValue":
                                 case "kind":
                                 case "actualUse":
                                 case "adjustedMarketValue":
                                 case "assessmentLevel":
                                 case "assessedValue":
                                 case "previousOwner":
                                 case "previousAssessedValue":
                                 case "taxability":
                                 case "effectivity":
                                 case "appraisedByID":
                                 case "appraisedBy":
                                 case "appraisedByName":
                                 case "appraisedByDate":
                                 case "recommendingApprovalID":
                                 case "recommendingApproval":
                                 case "recommendingApprovalName":
                                 case "recommendingApprovalDate":
                                 case "approvedByID":
                                 case "approvedBy":
                                 case "approvedByName":
                                 case "approvedByDate":
                                 case "memoranda":
                                 case "postingDate":
                                 case "landPin":
                                 case "foundation":
                                 case "columnsBldg":
                                 case "beams":
                                 case "trussFraming":
                                 case "roof":
                                 case "exteriorWalls":
                                 case "flooring":
                                 case "doors":
                                 case "ceiling":
                                 case "structuralTypes":
                                 case "buildingClassification":
                                 case "buildingPermit":
                                 case "buildingAge":
                                 case "cctNumber":
                                 case "numberOfStoreys":
                                 case "windows":
                                 case "stairs":
                                 case "partition":
                                 case "wallFinish":
                                 case "electrical":
                                 case "toiletAndBath":
                                 case "plumbingSewer":
                                 case "fixtures":
                                 case "dateConstructed":
                                 case "dateOccupied":
                                 case "dateCompleted":
                                 case "areaOfGroundFloor":
                                 case "totalBuildingArea":
                                 case "unitValue":
                                 case "buildingCoreAndAdditionalItems":
                                 case "addItems":
                                 case "depreciationRate":
                                 case "accumulatedDepreciation":
                                 case "depreciatedMarketValue":
                                 case "as_month":
                                 case "as_day":
                                 case "as_year":
                                 case "re_month":
                                 case "re_day":
                                 case "re_year":
                                 case "av_month":
                                 case "av_day":
                                 case "av_year":
                                 case "dc_month":
                                 case "dc_day":
                                 case "dc_year":
                                 case "do_month":
                                 case "do_day":
                                 case "do_year":
                                 case "dm_month":
                                 case "dm_day":
                                 case "dm_year":
                                     $this->formArray[$key] = $value;
                                     break;
                             }
                         }
                     }
                 }
             }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
예제 #19
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
             if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "record not found");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "error xmlDoc");
                 } else {
                     $person = new Person();
                     $person->parseDomDocument($domDoc);
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $person->getBirthday());
                     $this->formArray["personID"] = $person->getPersonID();
                     $this->formArray["lastName"] = $person->getLastName();
                     $this->formArray["firstName"] = $person->getFirstName();
                     $this->formArray["middleName"] = $person->getMiddleName();
                     $this->formArray["gender"] = $person->getGender();
                     $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                     $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                     $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                     $this->formArray["maritalStatus"] = $person->getMaritalStatus();
                     $this->formArray["tin"] = $person->getTin();
                     $address = $person->addressArray[0];
                     if (is_a($address, Address)) {
                         $this->formArray["addressID"] = $address->getAddressID();
                         $this->formArray["number"] = $address->getNumber();
                         $this->formArray["street"] = $address->getStreet();
                         $this->formArray["barangay"] = $address->getBarangay();
                         $this->formArray["district"] = $address->getDistrict();
                         $this->formArray["municipalityCity"] = $address->getMunicipalitycity();
                         $this->formArray["province"] = $address->getProvince();
                     }
                     $this->formArray["telephone"] = $person->getTelephone();
                     $this->formArray["mobileNumber"] = $person->getMobileNumber();
                     $this->formArray["email"] = $person->getEmail();
                 }
             }
             break;
         case "save":
             $PersonEncode = new SoapObject(NCCBIZ . "PersonEncode.php", "urn:Object");
             if ($this->formArray["personID"] != "") {
                 $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
                 if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $person = new Person();
                         $person->parseDomDocument($domDoc);
                         $address = $person->addressArray[0];
                         if (is_a($address, Address)) {
                             $address->setAddressID($this->formArray["addressID"]);
                             $address->setNumber($this->formArray["number"]);
                             $address->setStreet($this->formArray["street"]);
                             $address->setBarangay($this->formArray["barangay"]);
                             $address->setDistrict($this->formArray["district"]);
                             $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                             $address->setProvince($this->formArray["province"]);
                             $address->setDomDocument();
                         }
                         $person->setPersonID($this->formArray["personID"]);
                         $person->setLastName($this->formArray["lastName"]);
                         $person->setFirstName($this->formArray["firstName"]);
                         $person->setMiddleName($this->formArray["middleName"]);
                         $person->setGender($this->formArray["gender"]);
                         $person->setBirthday($this->birthdate);
                         $person->setMaritalStatus($this->formArray["maritalStatus"]);
                         $person->setTin($this->formArray["tin"]);
                         $person->setAddressArray($address);
                         $person->setTelephone($this->formArray["telephone"]);
                         $person->setMobileNumber($this->formArray["mobileNumber"]);
                         $person->setEmail($this->formArray["email"]);
                         $person->setDomDocument();
                         $doc = $person->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $PersonEncode->updatePerson($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $person = new Person();
                 $person->setPersonID($this->formArray["personID"]);
                 $person->setLastName($this->formArray["lastName"]);
                 $person->setFirstName($this->formArray["firstName"]);
                 $person->setMiddleName($this->formArray["middleName"]);
                 $person->setGender($this->formArray["gender"]);
                 $person->setBirthday($this->birthdate);
                 $person->setMaritalStatus($this->formArray["maritalStatus"]);
                 $person->setTin($this->formArray["tin"]);
                 $person->setAddressArray($address);
                 $person->setTelephone($this->formArray["telephone"]);
                 $person->setMobileNumber($this->formArray["mobileNumber"]);
                 $person->setEmail($this->formArray["email"]);
                 $person->setDomDocument();
                 $doc = $person->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //echo $this->formArray["ownerID"].$xmlStr;
                 if (!($ret = $PersonEncode->savePerson($xmlStr, $this->formArray["ownerID"]))) {
                     exit("error save");
                 }
             }
             $this->formArray["personID"] = $ret;
             header("location: ChangeOfOwnershipPropertyInfoClose.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "personID" => $ret, "formAction" => "view")));
             exit;
             break;
         case "cancel":
             header("location: PersonList.php");
             exit;
             break;
         default:
             if ($this->formArray["locID"]) {
                 $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
                 if (!($xmlStr = $ODDetails->getLocation($this->formArray["locID"]))) {
                     exit("xml failed");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                     } else {
                         $loc = new LocationAddress();
                         $loc->parseDomDocument($domDoc);
                         foreach ($loc as $key => $value) {
                             $this->formArray[$key] = $value;
                         }
                     }
                 }
             }
             $this->tpl->set_block("rptsTemplate", "personID", "personIDBlock");
             $this->tpl->set_var("personIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
 /**
  * Sets the shipping address for this payment request
  * @param String $postalCode
  * @param String $street
  * @param String $number
  * @param String $complement
  * @param String $district
  * @param String $city
  * @param String $state
  * @param String $country
  */
 public function setShippingAddress($postalCode = null, $street = null, $number = null, $complement = null, $district = null, $city = null, $state = null, $country = null)
 {
     $param = $postalCode;
     if ($this->shipping == null) {
         $this->shipping = new Shipping();
     }
     if (is_array($param)) {
         $this->shipping->setAddress(new Address($param));
     } elseif ($param instanceof Address) {
         $this->shipping->setAddress($param);
     } else {
         $address = new Address();
         $address->setPostalCode($postalCode);
         $address->setStreet($street);
         $address->setNumber($number);
         $address->setComplement($complement);
         $address->setDistrict($district);
         $address->setCity($city);
         $address->setState($state);
         $address->setCountry($country);
         $this->shipping->setAddress($address);
     }
 }
예제 #21
0
 function main()
 {
     switch ($this->formArray["formAction"]) {
         case "clear":
             $this->tpl->set_var("myAssessorId", "");
             $this->tpl->set_var("myPersonId", "");
             $this->tpl->set_var("myLastName", "");
             $this->tpl->set_var("myFirstName", "");
             $this->tpl->set_var("myMiddleName", "");
             $this->tpl->set_var("myPosition", "");
             $this->tpl->set_var("myGender", "");
             $this->tpl->set_var("myBirthday", "");
             $this->tpl->set_var("myMaritalStatus", "");
             $this->tpl->set_var("myTin", "");
             $this->tpl->set_var("myAddressID", "");
             $this->tpl->set_var("myNumber", "");
             $this->tpl->set_var("myStreet", "");
             $this->tpl->set_var("myBarangay", "");
             $this->tpl->set_var("myDistrict", "");
             $this->tpl->set_var("myMunicipalityCity", "");
             $this->tpl->set_var("myProvince", "");
             $this->tpl->set_var("myTelephone", "");
             $this->tpl->set_var("myMobileNumber", "");
             $this->tpl->set_var("myEmail", "");
             $this->tpl->set_var("myPosition", "");
             $this->tpl->set_block("testAssessorTemplate", "myXMLentries");
             $this->tpl->set_var("myXMLentries", "");
             $this->tpl->set_var("myXML", "");
             break;
         case "submit":
             $this->assessorDude->setAssessorID($this->formArray["myAssessorId"]);
             $this->assessorDude->setPersonID($this->formArray["myPersonId"]);
             $this->assessorDude->setLastName($this->formArray["myLastName"]);
             $this->assessorDude->setFirstName($this->formArray["myFirstName"]);
             $this->assessorDude->setMiddleName($this->formArray["myMiddleName"]);
             $this->assessorDude->setPosition($this->formArray["myPosition"]);
             $this->assessorDude->setGender($this->formArray["myGender"]);
             $this->assessorDude->setBirthday($this->formArray["myBirthday"]);
             $this->assessorDude->setMaritalStatus($this->formArray["myMaritalStatus"]);
             $this->assessorDude->setTin($this->formArray["myTin"]);
             $myAddress = new Address();
             $myAddress->setAddressID($this->formArray["myAddressID"]);
             $myAddress->setNumber($this->formArray["myNumber"]);
             $myAddress->setStreet($this->formArray["myStreet"]);
             $myAddress->setBarangay($this->formArray["myBarangay"]);
             $myAddress->setDistrict($this->formArray["myDistrict"]);
             $myAddress->setMunicipalityCity($this->formArray["myMunicipalityCity"]);
             $myAddress->setProvince($this->formArray["myProvince"]);
             $this->assessorDude->setTelephone($this->formArray["myTelephone"]);
             $this->assessorDude->setMobileNumber($this->formArray["myMobileNumber"]);
             $this->assessorDude->setEmail($this->formArray["myEmail"]);
             $this->assessorDude->setPosition($this->formArray["myPosition"]);
             $myAddress->setDomDocument();
             $this->assessorDude->setAddressArray($myAddress);
             $this->assessorDude->setDomDocument();
             $domObj = $this->assessorDude->getDomDocument();
             $assessorDudeInfo = $this->parseMyDom($domObj);
             $this->tpl->set_var("myAssessorId", $this->formArray["myAssessorId"]);
             $this->tpl->set_var("myPersonId", $this->formArray["myPersonId"]);
             $this->tpl->set_var("myLastName", $this->formArray["myLastName"]);
             $this->tpl->set_var("myFirstName", $this->formArray["myFirstName"]);
             $this->tpl->set_var("myMiddleName", $this->formArray["myMiddleName"]);
             $this->tpl->set_var("myPosition", $this->formArray["myPosition"]);
             $this->tpl->set_var("myGender", $this->formArray["myGender"]);
             $this->tpl->set_var("myBirthday", $this->formArray["myBirthday"]);
             $this->tpl->set_var("myMaritalStatus", $this->formArray["myMaritalStatus"]);
             $this->tpl->set_var("myTin", $this->formArray["myTin"]);
             $this->tpl->set_var("myAddressID", $this->formArray["myAddressID"]);
             $this->tpl->set_var("myNumber", $this->formArray["myNumber"]);
             $this->tpl->set_var("myStreet", $this->formArray["myStreet"]);
             $this->tpl->set_var("myBarangay", $this->formArray["myBarangay"]);
             $this->tpl->set_var("myDistrict", $this->formArray["myDistrict"]);
             $this->tpl->set_var("myMunicipalityCity", $this->formArray["myMunicipalityCity"]);
             $this->tpl->set_var("myProvince", $this->formArray["myProvince"]);
             $this->tpl->set_var("myTelephone", $this->formArray["myTelephone"]);
             $this->tpl->set_var("myMobileNumber", $this->formArray["myMobileNumber"]);
             $this->tpl->set_var("myEmail", $this->formArray["myEmail"]);
             $this->tpl->set_var("myPosition", $this->formArray["myPosition"]);
             $this->tpl->set_block("testAssessorTemplate", "myXMLentries");
             $this->tpl->set_var("myParsedXML", "" . $assessorDudeInfo . "" . $myAddressString . "");
             $this->tpl->set_var("myXML", htmlentities($domObj->dump_mem(true)));
             break;
         default:
             $this->tpl->set_var("myAssessorId", "fill in the blank");
             $this->tpl->set_var("myPersonId", "fill in the blank");
             $this->tpl->set_var("myLastName", "fill in the blank");
             $this->tpl->set_var("myFirstName", "fill in the blank");
             $this->tpl->set_var("myMiddleName", "fill in the blank");
             $this->tpl->set_var("myPosition", "fill in the blank");
             $this->tpl->set_var("myGender", "fill in the blank");
             $this->tpl->set_var("myBirthday", "fill in the blank");
             $this->tpl->set_var("myMaritalStatus", "fill in the blank");
             $this->tpl->set_var("myTin", "fill in the blank");
             $this->tpl->set_var("myAddressID", "fill in the blank");
             $this->tpl->set_var("myNumber", "fill in the blank");
             $this->tpl->set_var("myStreet", "fill in the blank");
             $this->tpl->set_var("myBarangay", "fill in the blank");
             $this->tpl->set_var("myDistrict", "fill in the blank");
             $this->tpl->set_var("myMunicipalityCity", "fill in the blank");
             $this->tpl->set_var("myProvince", "fill in the blank");
             $this->tpl->set_var("myTelephone", "fill in the blank");
             $this->tpl->set_var("myMobileNumber", "fill in the blank");
             $this->tpl->set_var("myEmail", "fill in the blank");
             $this->tpl->set_var("myPosition", "fill in the blank");
             $this->tpl->set_block("testAssessorTemplate", "myXMLentries");
             $this->tpl->set_var("myXMLentries", "");
             $this->tpl->set_var("myXML", "");
     }
     $this->tpl->parse("PrinttestAssessorTemplate", "testAssessorTemplate");
     $this->tpl->finish("PrinttestAssessorTemplate");
     $this->tpl->p("PrinttestAssessorTemplate");
 }
예제 #22
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object");
             if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($this->formArray["propertyID"]))) {
                 echo "xml failed";
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $plantsTrees = new PlantsTrees();
                     $plantsTrees->parseDomDocument($domDoc);
                     foreach ($plantsTrees as $key => $value) {
                         switch ($key) {
                             case "propertyAdministrator":
                                 if (is_a($value, Person)) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday());
                                     $this->formArray["personID"] = $value->getPersonID();
                                     $this->formArray["lastName"] = $value->getLastName();
                                     $this->formArray["firstName"] = $value->getFirstName();
                                     $this->formArray["middleName"] = $value->getMiddleName();
                                     $this->formArray["gender"] = $value->getGender();
                                     $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                                     $this->formArray["maritalStatus"] = $value->getMaritalStatus();
                                     $this->formArray["tin"] = $value->getTin();
                                     $this->formArray["addressID"] = $value->addressArray[0]->getAddressID();
                                     $this->formArray["number"] = $value->addressArray[0]->getNumber();
                                     $this->formArray["street"] = $value->addressArray[0]->getStreet();
                                     $this->formArray["barangay"] = $value->addressArray[0]->getBarangay();
                                     $this->formArray["district"] = $value->addressArray[0]->getDistrict();
                                     $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity();
                                     $this->formArray["province"] = $value->addressArray[0]->getProvince();
                                     $this->formArray["telephone"] = $value->getTelephone();
                                     $this->formArray["mobileNumber"] = $value->getMobileNumber();
                                     $this->formArray["email"] = $value->getEmail();
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "appraisedByDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["as_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["as_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["as_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "recommendingApprovalDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["re_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["re_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["re_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                             case "approvedByDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["av_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["av_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["av_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateAcquired":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["da_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["da_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["da_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateOfInstallation":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["di_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["di_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["di_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateOfOperation":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["do_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["do_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["do_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             default:
                                 $this->formArray[$key] = $value;
                         }
                     }
                 }
             }
             break;
         case "save":
             if ($this->formArray["verifiedByID"] != "" && $this->formArray["verifiedByID"] != "xx" && $this->formArray["propertyID"] != "") {
                 $this->saveVerified($this->formArray["afsID"], $this->formArray["verifiedByID"], $this->formArray["propertyID"]);
             }
             $PlantsTreesEncode = new SoapObject(NCCBIZ . "PlantsTreesEncode.php", "urn:Object");
             if ($this->formArray["propertyID"] != "") {
                 $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object");
                 if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($this->formArray["propertyID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $address = new Address();
                         $address->setAddressID($this->formArray["addressID"]);
                         $address->setNumber($this->formArray["number"]);
                         $address->setStreet($this->formArray["street"]);
                         $address->setBarangay($this->formArray["barangay"]);
                         $address->setDistrict($this->formArray["district"]);
                         $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                         $address->setProvince($this->formArray["province"]);
                         $address->setDomDocument();
                         $propertyAdministrator = new Person();
                         $propertyAdministrator->setPersonID($this->formArray["personID"]);
                         $propertyAdministrator->setLastName($this->formArray["lastName"]);
                         $propertyAdministrator->setFirstName($this->formArray["firstName"]);
                         $propertyAdministrator->setMiddleName($this->formArray["middleName"]);
                         //$propertyAdministrator->setGender($this->formArray["gender"]);
                         //$propertyAdministrator->setBirthday($this->birthdate);
                         //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]);
                         //$propertyAdministrator->setTin($this->formArray["tin"]);
                         $propertyAdministrator->setAddressArray($address);
                         $propertyAdministrator->setTelephone($this->formArray["telephone"]);
                         //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]);
                         $propertyAdministrator->setEmail($this->formArray["email"]);
                         $propertyAdministrator->setDomDocument();
                         $plantsTrees = new PlantsTrees();
                         $plantsTrees->parseDomDocument($domDoc);
                         $plantsTrees->setPropertyID($this->formArray["propertyID"]);
                         $plantsTrees->setAfsID($this->formArray["afsID"]);
                         $plantsTrees->setArpNumber($this->formArray["arpNumber"]);
                         $plantsTrees->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                         $plantsTrees->setPropertyAdministrator($propertyAdministrator);
                         $plantsTrees->setVerifiedBy($this->formArray["verifiedByID"]);
                         $plantsTrees->setPlottingsBy($this->formArray["plottingsByID"]);
                         $plantsTrees->setNotedBy($this->formArray["notedByID"]);
                         $plantsTrees->setMarketValue($this->formArray["marketValue"]);
                         $plantsTrees->setKind($this->formArray["kind"]);
                         $plantsTrees->setActualUse($this->formArray["actualUse"]);
                         $plantsTrees->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                         $plantsTrees->setAssessmentLevel($this->formArray["assessmentLevel"]);
                         $plantsTrees->setAssessedValue($this->formArray["assessedValue"]);
                         $plantsTrees->setPreviousOwner($this->formArray["previousOwner"]);
                         $plantsTrees->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                         $plantsTrees->setTaxability($this->formArray["taxability"]);
                         $plantsTrees->setEffectivity($this->formArray["effectivity"]);
                         $plantsTrees->setAppraisedBy($this->formArray["appraisedByID"]);
                         $plantsTrees->setAppraisedByDate($this->formArray["appraisedByDate"]);
                         $plantsTrees->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                         $plantsTrees->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                         $plantsTrees->setApprovedBy($this->formArray["approvedByID"]);
                         $plantsTrees->setApprovedByDate($this->formArray["approvedByDate"]);
                         $plantsTrees->setMemoranda($this->formArray["memoranda"]);
                         $plantsTrees->setPostingDate($this->formArray["postingDate"]);
                         $plantsTrees->setLandPin($this->formArray["landPin"]);
                         $plantsTrees->setSurveyNumber($this->formArray["surveyNumber"]);
                         $plantsTrees->setProductClass($this->formArray["productClass"]);
                         $plantsTrees->setAreaPlanted($this->formArray["areaPlanted"]);
                         $plantsTrees->setTotalNumber($this->formArray["totalNumber"]);
                         $plantsTrees->setNonFruitBearing($this->formArray["nonFruitBearing"]);
                         $plantsTrees->setFruitBearing($this->formArray["fruitBearing"]);
                         $plantsTrees->setAge($this->formArray["age"]);
                         $plantsTrees->setUnitPrice($this->formArray["unitPrice"]);
                         $plantsTrees->setAdjustmentFactor($this->formArray["adjustmentFactor"]);
                         $plantsTrees->setPercentAdjustment($this->formArray["percentAdjustment"]);
                         $plantsTrees->setValueAdjustment($this->formArray["valueAdjustment"]);
                         $plantsTrees->setCreatedBy($this->userID);
                         $plantsTrees->setModifiedBy($this->userID);
                         $plantsTrees->setDomDocument();
                         $doc = $plantsTrees->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         //echo $xmlStr;
                         if (!($ret = $PlantsTreesEncode->updatePlantsTrees($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 //$address->setAddressID($this->formArray["addressID"]);
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $propertyAdministrator = new Person();
                 //$propertyAdministrator->setPersonID($this->formArray["personID"]);
                 $propertyAdministrator->setLastName($this->formArray["lastName"]);
                 $propertyAdministrator->setFirstName($this->formArray["firstName"]);
                 $propertyAdministrator->setMiddleName($this->formArray["middleName"]);
                 //$propertyAdministrator->setGender($this->formArray["gender"]);
                 //$propertyAdministrator->setBirthday($this->birthdate);
                 //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]);
                 //$propertyAdministrator->setTin($this->formArray["tin"]);
                 $propertyAdministrator->setAddressArray($address);
                 $propertyAdministrator->setTelephone($this->formArray["telephone"]);
                 //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]);
                 $propertyAdministrator->setEmail($this->formArray["email"]);
                 $propertyAdministrator->setDomDocument();
                 $plantsTrees = new PlantsTrees();
                 $plantsTrees->parseDomDocument($domDoc);
                 //$plantsTrees->setPropertyID($this->formArray["propertyID"]);
                 $plantsTrees->setAfsID($this->formArray["afsID"]);
                 $plantsTrees->setArpNumber($this->formArray["arpNumber"]);
                 $plantsTrees->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $plantsTrees->setPropertyAdministrator($propertyAdministrator);
                 $plantsTrees->setVerifiedBy($this->formArray["verifiedByID"]);
                 $plantsTrees->setPlottingsBy($this->formArray["plottingsByID"]);
                 $plantsTrees->setNotedBy($this->formArray["notedByID"]);
                 $plantsTrees->setMarketValue($this->formArray["marketValue"]);
                 $plantsTrees->setKind($this->formArray["kind"]);
                 $plantsTrees->setActualUse($this->formArray["actualUse"]);
                 $plantsTrees->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                 $plantsTrees->setAssessmentLevel($this->formArray["assessmentLevel"]);
                 $plantsTrees->setAssessedValue($this->formArray["assessedValue"]);
                 $plantsTrees->setPreviousOwner($this->formArray["previousOwner"]);
                 $plantsTrees->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                 $plantsTrees->setTaxability($this->formArray["taxability"]);
                 $plantsTrees->setEffectivity($this->formArray["effectivity"]);
                 $plantsTrees->setAppraisedBy($this->formArray["appraisedByID"]);
                 $plantsTrees->setAppraisedByDate($this->formArray["appraisedByDate"]);
                 $plantsTrees->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                 $plantsTrees->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                 $plantsTrees->setApprovedBy($this->formArray["approvedByID"]);
                 $plantsTrees->setApprovedByDate($this->formArray["approvedByDate"]);
                 $plantsTrees->setMemoranda($this->formArray["memoranda"]);
                 $plantsTrees->setPostingDate($this->formArray["postingDate"]);
                 $plantsTrees->setLandPin($this->formArray["landPin"]);
                 $plantsTrees->setSurveyNumber($this->formArray["surveyNumber"]);
                 $plantsTrees->setProductClass($this->formArray["productClass"]);
                 $plantsTrees->setAreaPlanted($this->formArray["areaPlanted"]);
                 $plantsTrees->setTotalNumber($this->formArray["totalNumber"]);
                 $plantsTrees->setNonFruitBearing($this->formArray["nonFruitBearing"]);
                 $plantsTrees->setFruitBearing($this->formArray["fruitBearing"]);
                 $plantsTrees->setAge($this->formArray["age"]);
                 $plantsTrees->setUnitPrice($this->formArray["unitPrice"]);
                 $plantsTrees->setAdjustmentFactor($this->formArray["adjustmentFactor"]);
                 $plantsTrees->setPercentAdjustment($this->formArray["percentAdjustment"]);
                 $plantsTrees->setValueAdjustment($this->formArray["valueAdjustment"]);
                 $plantsTrees->setCreatedBy($this->userID);
                 $plantsTrees->setModifiedBy($this->userID);
                 $plantsTrees->setDomDocument();
                 $doc = $plantsTrees->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //exit($xmlStr);
                 if (!($ret = $PlantsTreesEncode->savePlantsTrees($xmlStr))) {
                     echo "ret=" . $ret;
                 }
             }
             $this->formArray["propertyID"] = $ret;
             header("location: PlantsTreesClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         case "cancel":
             header("location: PlantsTreesList.php");
             exit;
             break;
         default:
             if (!($firstPropertyID = $this->getFirstPropertyID())) {
                 $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
                 $this->tpl->set_var("odIDBlock", "");
                 $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
                 $this->tpl->set_var("ACKBlock", "");
             } else {
                 $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object");
                 if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($firstPropertyID))) {
                     echo "xml failed";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                         $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                     } else {
                         $plantsTrees = new PlantsTrees();
                         $plantsTrees->parseDomDocument($domDoc);
                         foreach ($plantsTrees as $key => $value) {
                             switch ($key) {
                                 case "propertyID":
                                     $this->formArray["propertyID"] = "";
                                     break;
                                 case "propertyAdministrator":
                                     if (is_a($value, Person)) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday());
                                         $this->formArray["personID"] = $value->getPersonID();
                                         $this->formArray["lastName"] = $value->getLastName();
                                         $this->formArray["firstName"] = $value->getFirstName();
                                         $this->formArray["middleName"] = $value->getMiddleName();
                                         $this->formArray["gender"] = $value->getGender();
                                         $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                                         $this->formArray["maritalStatus"] = $value->getMaritalStatus();
                                         $this->formArray["tin"] = $value->getTin();
                                         $this->formArray["addressID"] = $value->addressArray[0]->getAddressID();
                                         $this->formArray["number"] = $value->addressArray[0]->getNumber();
                                         $this->formArray["street"] = $value->addressArray[0]->getStreet();
                                         $this->formArray["barangay"] = $value->addressArray[0]->getBarangay();
                                         $this->formArray["district"] = $value->addressArray[0]->getDistrict();
                                         $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity();
                                         $this->formArray["province"] = $value->addressArray[0]->getProvince();
                                         $this->formArray["telephone"] = $value->getTelephone();
                                         $this->formArray["mobileNumber"] = $value->getMobileNumber();
                                         $this->formArray["email"] = $value->getEmail();
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "appraisedByDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["as_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["as_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["as_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "recommendingApprovalDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["re_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["re_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["re_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                 case "approvedByDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["av_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["av_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["av_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateAcquired":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["da_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["da_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["da_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateOfInstallation":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["di_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["di_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["di_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateOfOperation":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["do_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["do_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["do_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "arpNumber":
                                 case "propertyIndexNumber":
                                 case "verifiedByID":
                                 case "verifiedBy":
                                 case "verifiedByName":
                                 case "plottingsByID":
                                 case "plottingsBy":
                                 case "plottingsByName":
                                 case "notedByID":
                                 case "notedBy":
                                 case "notedByName":
                                 case "marketValue":
                                 case "kind":
                                 case "actualUse":
                                 case "adjustedMarketValue":
                                 case "assessmentLevel":
                                 case "assessedValue":
                                 case "previousOwner":
                                 case "previousAssessedValue":
                                 case "taxability":
                                 case "effectivity":
                                 case "appraisedByID":
                                 case "appraisedBy":
                                 case "appraisedByName":
                                 case "appraisedByDate":
                                 case "recommendingApprovalID":
                                 case "recommendingApproval":
                                 case "recommendingApprovalName":
                                 case "recommendingApprovalDate":
                                 case "approvedByID":
                                 case "approvedBy":
                                 case "approvedByName":
                                 case "approvedByDate":
                                 case "memoranda":
                                 case "postingDate":
                                 case "landPin":
                                 case "surveyNumber":
                                 case "productClass":
                                 case "areaPlanted":
                                 case "totalNumber":
                                 case "nonFruitBearing":
                                 case "fruitBearing":
                                 case "age":
                                 case "unitPrice":
                                 case "adjustmentFactor":
                                 case "percentAdjustment":
                                 case "valueAdjustment":
                                 case "as_month":
                                 case "as_day":
                                 case "as_year":
                                 case "re_month":
                                 case "re_day":
                                 case "re_year":
                                 case "av_month":
                                 case "av_day":
                                 case "av_year":
                                     $this->formArray[$key] = $value;
                                     break;
                             }
                         }
                     }
                 }
             }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
예제 #23
0
파일: UserEncode.php 프로젝트: armic/erpts
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object");
             if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "User record not found");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "error xmlDoc");
                 } else {
                     $user = new User();
                     $user->parseDomDocument($domDoc);
                     $this->formArray["userID"] = $user->getUserID();
                     $this->formArray["userType"] = $user->getUserType();
                     $this->formArray["username"] = $user->getUsername();
                     $this->formArray["password"] = $user->getPassword();
                     $this->formArray["personID"] = $user->getPersonID();
                     $this->formArray["status"] = $user->getStatus();
                 }
             }
             $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
             if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "Person record not found");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "error xmlDoc");
                 } else {
                     $person = new Person();
                     $person->parseDomDocument($domDoc);
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $person->getBirthday());
                     $this->formArray["personID"] = $person->getPersonID();
                     $this->formArray["lastName"] = $person->getLastName();
                     $this->formArray["firstName"] = $person->getFirstName();
                     $this->formArray["middleName"] = $person->getMiddleName();
                     $this->formArray["gender"] = $person->getGender();
                     $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                     $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                     $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                     $this->formArray["maritalStatus"] = $person->getMaritalStatus();
                     $this->formArray["tin"] = $person->getTin();
                     $address = $person->addressArray[0];
                     if (is_a($address, Address)) {
                         $this->formArray["addressID"] = $address->getAddressID();
                         $this->formArray["number"] = $address->getNumber();
                         $this->formArray["street"] = $address->getStreet();
                         $this->formArray["barangay"] = $address->getBarangay();
                         $this->formArray["district"] = $address->getDistrict();
                         $this->formArray["municipalityCity"] = $address->getMunicipalitycity();
                         $this->formArray["province"] = $address->getProvince();
                     }
                     $this->formArray["telephone"] = $person->getTelephone();
                     $this->formArray["mobileNumber"] = $person->getMobileNumber();
                     $this->formArray["email"] = $person->getEmail();
                 }
             }
             $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
             $this->tpl->set_var("NewUserPasswordBlock", "");
             $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
             $this->tpl->set_var("oldNewUserRowspan", 5);
             //$this->tpl->set_var("oldNewUserRowspan", 3);
             $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);
             break;
         case "save":
             /*
             			    if($this->isOldPasswordCorrect()==false){
             			        $this->message = "Error. Cannot Save. Old password incorrect to create new password.";
             		    	    $this->tpl->set_var("message", $this->message);	
             		    	    $this->tpl->parse("MessageBlock", "Message", true);
             		    	    
                                 $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
                                 $this->tpl->set_var("NewUserPasswordBlock", "");
             
                                 $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
                                 $this->tpl->set_var("oldNewUserRowspan", 3);
                                 $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);		    	
             		    	    break;
             			    }
             */
             if ($this->formArray["newPassword"] != "" && $this->formArray["newPassword"] != "null") {
                 $this->formArray["password"] = md5($this->formArray["newPassword"]);
             }
             if ($this->usernameAlreadyExists() == true) {
                 $this->message = "Error. Cannot Save. Username already exists.";
                 $this->tpl->set_var("message", $this->message);
                 $this->tpl->parse("MessageBlock", "Message", true);
                 $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
                 $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
                 if ($this->formArray["personID"] != "") {
                     $this->tpl->set_var("NewUserPasswordBlock", "");
                     $this->tpl->set_var("oldNewUserRowspan", 3);
                     $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);
                 } else {
                     $this->tpl->set_var("oldNewUserRowspan", 2);
                     $this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true);
                     $this->tpl->set_var("OldUserPasswordBlock", "");
                 }
                 break;
             }
             $PersonEncode = new SoapObject(NCCBIZ . "PersonEncode.php", "urn:Object");
             if ($this->formArray["personID"] != "") {
                 $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
                 if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "Person record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $person = new Person();
                         $person->parseDomDocument($domDoc);
                         $address = $person->addressArray[0];
                         if (is_a($address, Address)) {
                             $address->setAddressID($this->formArray["addressID"]);
                             $address->setNumber($this->formArray["number"]);
                             $address->setStreet($this->formArray["street"]);
                             $address->setBarangay($this->formArray["barangay"]);
                             $address->setDistrict($this->formArray["district"]);
                             $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                             $address->setProvince($this->formArray["province"]);
                             $address->setDomDocument();
                         }
                         $person->setPersonID($this->formArray["personID"]);
                         $person->setPersonType("adminUser");
                         $person->setLastName($this->formArray["lastName"]);
                         $person->setFirstName($this->formArray["firstName"]);
                         $person->setMiddleName($this->formArray["middleName"]);
                         $person->setGender($this->formArray["gender"]);
                         $person->setBirthday($this->birthdate);
                         $person->setMaritalStatus($this->formArray["maritalStatus"]);
                         $person->setTin($this->formArray["tin"]);
                         $person->setAddressArray($address);
                         $person->setTelephone($this->formArray["telephone"]);
                         $person->setMobileNumber($this->formArray["mobileNumber"]);
                         $person->setEmail($this->formArray["email"]);
                         $person->setDomDocument();
                         $doc = $person->getDomDocument();
                         //echo $doc->html_dump_mem();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $PersonEncode->updatePerson($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $person = new Person();
                 $person->setPersonID($this->formArray["personID"]);
                 $person->setPersonType("adminUser");
                 $person->setLastName($this->formArray["lastName"]);
                 $person->setFirstName($this->formArray["firstName"]);
                 $person->setMiddleName($this->formArray["middleName"]);
                 $person->setGender($this->formArray["gender"]);
                 $person->setBirthday($this->birthdate);
                 $person->setMaritalStatus($this->formArray["maritalStatus"]);
                 $person->setTin($this->formArray["tin"]);
                 $person->setAddressArray($address);
                 $person->setTelephone($this->formArray["telephone"]);
                 $person->setMobileNumber($this->formArray["mobileNumber"]);
                 $person->setEmail($this->formArray["email"]);
                 $person->setDomDocument();
                 $doc = $person->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //echo $this->formArray["ownerID"].$xmlStr;
                 if (!($ret = $PersonEncode->savePerson($xmlStr, $this->formArray["ownerID"]))) {
                     exit("error save");
                 }
             }
             $this->formArray["personID"] = $ret;
             $UserEncode = new SoapObject(NCCBIZ . "UserEncode.php", "urn:Object");
             if ($this->formArray["userID"] != "") {
                 $UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object");
                 if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) {
                     exit("User record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $user = new User();
                         $user->parseDomDocument($domDoc);
                         $user->setUserID($this->formArray["userID"]);
                         $user->setUserType($this->formArray["userType"]);
                         $user->setUsername($this->formArray["username"]);
                         $user->setPassword($this->formArray["password"]);
                         $user->setPersonID($this->formArray["personID"]);
                         $user->setStatus($this->formArray["status"]);
                         $user->setDomDocument();
                         $doc = $user->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $UserEncode->updateUser($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $user = new User();
                 //$user->setUserID($this->formArray["userID"]);
                 $user->setUserType($this->formArray["userType"]);
                 $user->setUsername($this->formArray["username"]);
                 $user->setPassword(md5($this->formArray["password"]));
                 $user->setPersonID($this->formArray["personID"]);
                 $user->setStatus($this->formArray["status"]);
                 $user->setDomDocument();
                 $doc = $user->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $UserEncode->saveUser($xmlStr))) {
                     exit("error save");
                 }
             }
             header("location: UserClose.php" . $this->sess->url(""));
             exit;
             break;
         case "cancel":
             header("location: UserClose.php" . $this->sess->url(""));
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "UserID", "UserIDBlock");
             $this->tpl->set_var("UserIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
             $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
             $this->tpl->set_var("oldNewUserRowspan", 2);
             $this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true);
             $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
             $this->tpl->set_var("OldUserPasswordBlock", "");
     }
     $this->setForm();
     if ($this->message == "") {
         $this->tpl->set_var("MessageBlock", "");
     }
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }