} if ($customeradd['post_apartment'] != '' && $customeradd['post_building'] == '') { $error['post_building'] = trans('Building number required!'); } if ($customeradd['ten'] != '' && !check_ten($customeradd['ten']) && !isset($customeradd['tenwarning'])) { $error['ten'] = trans('Incorrect Tax Exempt Number! If you are sure you want to accept it, then click "Submit" again.'); $customeradd['tenwarning'] = 1; } if ($customeradd['ssn'] != '' && !check_ssn($customeradd['ssn']) && !isset($customeradd['ssnwarning'])) { $error['ssn'] = trans('Incorrect Social Security Number! If you are sure you want to accept it, then click "Submit" again.'); $customeradd['ssnwarning'] = 1; } if ($customeradd['icn'] != '' && !check_icn($customeradd['icn'])) { $error['icn'] = trans('Incorrect Identity Card Number!'); } if ($customeradd['regon'] != '' && !check_regon($customeradd['regon'])) { $error['regon'] = trans('Incorrect Business Registration Number!'); } if ($customeradd['zip'] != '' && !check_zip($customeradd['zip']) && !isset($customeradd['zipwarning'])) { $error['zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.'); $customeradd['zipwarning'] = 1; } if ($customeradd['post_zip'] != '' && !check_zip($customeradd['post_zip']) && !isset($customeradd['post_zipwarning'])) { $error['post_zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.'); $customeradd['post_zipwarning'] = 1; } if ($customeradd['pin'] == '') { $error['pin'] = trans('PIN code is required!'); } elseif (!preg_match('/^[0-9]{4,6}$/', $customeradd['pin'])) { $error['pin'] = trans('Incorrect PIN code!'); }
} if ($customerdata['name'] == '' && !$customerdata['type']) { $error['name'] = trans('First name cannot be empty!'); } if ($customerdata['address'] == '') { $error['address'] = trans('Address required!'); } if ($customerdata['ten'] != '' && !check_ten($customerdata['ten']) && !isset($customerdata['tenwarning'])) { $error['ten'] = trans('Incorrect Tax Exempt Number! If you are sure you want to accept it, then click "Submit" again.'); $tenwarning = 1; } if ($customerdata['ssn'] != '' && !check_ssn($customerdata['ssn']) && !isset($customerdata['ssnwarning'])) { $error['ssn'] = trans('Incorrect Social Security Number! If you are sure you want to accept it, then click "Submit" again.'); $ssnwarning = 1; } if ($customerdata['regon'] != '' && !check_regon($customerdata['regon'])) { $error['regon'] = trans('Incorrect Business Registration Number!'); } if ($customerdata['icn'] != '' && !check_icn($customerdata['icn'])) { $error['icn'] = trans('Incorrect Identity Card Number!'); } if ($customerdata['zip'] != '' && !check_zip($customerdata['zip']) && !isset($customerdata['zipwarning'])) { $error['zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.'); $zipwarning = 1; } if ($customerdata['post_zip'] != '' && !check_zip($customerdata['post_zip']) && !isset($customerdata['post_zipwarning'])) { $error['post_zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.'); $post_zipwarning = 1; } if ($customerdata['pin'] == '') { $error['pin'] = trans('PIN code is required!');
if ($division['address'] == '') { $error['address'] = trans('Address is required!'); } if ($division['city'] == '') { $error['city'] = trans('City is required!'); } if ($division['zip'] == '') { $error['zip'] = trans('Zip code is required!'); } elseif (!check_zip($division['zip'])) { $error['zip'] = trans('Incorrect ZIP code!'); } if ($division['ten'] != '' && !check_ten($division['ten']) && !isset($division['tenwarning'])) { $error['ten'] = trans('Incorrect Tax Exempt Number! If you are sure you want to accept it, then click "Submit" again.'); $division['tenwarning'] = 1; } if ($division['regon'] != '' && !check_regon($division['regon'])) { $error['regon'] = trans('Incorrect Business Registration Number!'); } if ($division['account'] != '' && (strlen($division['account']) > 48 || !preg_match('/^([A-Z][A-Z])?[0-9]+$/', $division['account']))) { $error['account'] = trans('Wrong account number!'); } if ($division['inv_paytime'] == '') { $division['inv_paytime'] = NULL; } if (!$error) { $args = array('name' => $division['name'], 'shortname' => $division['shortname'], 'address' => $division['address'], 'city' => $division['city'], 'zip' => $division['zip'], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_COUNTRY] => $division['countryid'], 'ten' => $division['ten'], 'regon' => $division['regon'], 'account' => $division['account'], 'inv_header' => $division['inv_header'], 'inv_footer' => $division['inv_footer'], 'inv_author' => $division['inv_author'], 'inv_cplace' => $division['inv_cplace'], 'inv_paytime' => $division['inv_paytime'], 'inv_paytype' => $division['inv_paytype'] ? $division['inv_paytype'] : null, 'description' => $division['description']); $DB->Execute('INSERT INTO divisions (name, shortname, address, city, zip, countryid, ten, regon, account, inv_header, inv_footer, inv_author, inv_cplace, inv_paytime, inv_paytype, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($args)); if ($SYSLOG) {
foreach ($contractordata as $key => $value) { if ($key != 'uid' && $key != 'contacts') { $contractordata[$key] = trim($value); } } if ($contractordata['lastname'] == '') { $error['lastname'] = trans('Last/Company name cannot be empty!'); } if ($contractordata['address'] == '') { $error['address'] = trans('Address required!'); } if ($contractordata['ten'] != '' && !check_ten($contractordata['ten']) && !isset($contractordata['tenwarning'])) { $error['ten'] = trans('Incorrect Tax Exempt Number! If you are sure you want to accept it, then click "Submit" again.'); $tenwarning = 1; } if ($contractordata['regon'] != '' && !check_regon($contractordata['regon'])) { $error['regon'] = trans('Incorrect Business Registration Number!'); } if ($contractordata['zip'] != '' && !check_zip($contractordata['zip']) && !isset($contractordata['zipwarning'])) { $error['zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.'); $zipwarning = 1; } if ($contractordata['post_zip'] != '' && !check_zip($contractordata['post_zip']) && !isset($contractordata['post_zipwarning'])) { $error['post_zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.'); $post_zipwarning = 1; } if ($contractordata['email'] != '' && !check_email($contractordata['email'])) { $error['email'] = trans('Incorrect email!'); } foreach ($contractordata['uid'] as $idx => $val) { $val = trim($val);
function savecars($forms) { global $DB, $RE, $SMARTY, $AUTH; $blad = false; $inf = 'Pole wymagane'; $form = $forms['caredit']; $id = $form['id'] ? $form['id'] : NULL; unset($form['id']); $form['dr_a'] = strtoupper(str_replace(' ', '', $form['dr_a'])); $obj = new xajaxResponse(); foreach ($form as $key => $val) { $obj->script("removeClassId('" . $key . "','alerts');"); $obj->assign($key . "_alerts", "innerHTML", ""); } if (empty($form['shortname'])) { $obj->script("addClassId('shortname','alerts');"); $obj->assign("shortname_alerts", "innerHTML", "Nazwa skrócona jest wymagana od 5 do 32 znaków"); $blad = true; } elseif (strlen($form['shortname']) < 5 || strlen($form['shortname']) > 32) { $obj->script("addClassId('shortname','alerts');"); $obj->assign("shortname_alerts", "innerHTML", "Nazwa musi mieć od 5 do 32 znaków"); $blad = true; } elseif ($RE->checkissetshortnamecar($form['shortname'], $id)) { $obj->script("addClassId('shortname','alerts');"); $obj->assign("shortname_alerts", "innerHTML", "Podana nazwa jest już używana !!!"); $blad = true; } if (empty($form['status'])) { $obj->script("addClassId('status','alerts');"); $obj->assign("status_alerts", "innerHTML", "Proszę podać status pojazdu"); $blad = true; } if (empty($form['dr_a'])) { $obj->script("addClassId('dr_a','alerts');"); $obj->assign("dr_a_alerts", "innerHTML", $inf); $blad = true; // } elseif (strlen($form['dr_a']) != 7) { // $obj->script("addClassId('dr_a','alerts');"); // $obj->assign("dr_a_alerts","innerHTML","Błędnie podano nr. rejestracyjny"); // $blad = true; } elseif ($RE->checkissetnrrej($form['dr_a'], $id)) { $obj->script("addClassId('dr_a','alerts');"); $obj->assign("dr_a_alerts", "innerHTML", "Podany nr. rejestracyjny jest już bazie !!!"); $blad = true; } else { $obj->assign("dr_a", "value", $form['dr_a']); } if (empty($form['dr_d1'])) { $obj->script("addClassId('dr_d1','alerts');"); $obj->assign("dr_d1_alerts", "innerHTML", $inf); $blad = true; } else { $form['dr_d1'] = strtoupper($form['dr_d1']); $obj->assign("dr_d1", "value", $form['dr_d1']); } if (!empty($form['dr_d2'])) { $form['dr_d2'] = strtoupper($form['dr_d2']); $obj->assign("dr_d2", "value", $form['dr_d2']); } if (empty($form['dr_d3'])) { $obj->script("addClassId('dr_d3','alerts');"); $obj->assign("dr_d3_alerts", "innerHTML", $inf); $blad = true; } else { $form['dr_d3'] = strtoupper($form['dr_d3']); $obj->assign("dr_d3", "value", $form['dr_d3']); } if (empty($form['dr_e'])) { $obj->script("addClassId('dr_e','alerts');"); $obj->assign("dr_e_alerts", "innerHTML", $inf); $blad = true; } else { $form['dr_e'] = strtoupper($form['dr_e']); $obj->assign("dr_e", "value", $form['dr_e']); } if (empty($form['dr_rokprodukcji'])) { $obj->script("addClassId('dr_rokprodukcji','alerts');"); $obj->assign("dr_rokprodukcji_alerts", "innerHTML", $inf); $blad = true; } elseif (strlen($form['dr_rokprodukcji']) != 4) { $obj->script("addClassId('dr_rokprodukcji','alerts');"); $obj->assign("dr_rokprodukcji_alerts", "innerHTML", "Błędna data"); $blad = true; } elseif (!intval($form['dr_rokprodukcji'])) { $obj->script("addClassId('dr_rokprodukcji','alerts');"); $obj->assign("dr_rokprodukcji_alerts", "innerHTML", "Błędna data 12"); $blad = true; } if (empty($form['dr_b'])) { $obj->script("addClassId('dr_b','alerts');"); $obj->assign("dr_b_alerts", "innerHTML", $inf); $blad = true; } else { $form['dr_b'] = str_replace('-', '/', $form['dr_b']); $form['dr_b'] = str_replace('.', '/', $form['dr_b']); $form['dr_b'] = str_replace(',', '/', $form['dr_b']); $form['dr_b'] = str_replace(' ', '/', $form['dr_b']); if (!check_date($form['dr_b'])) { $obj->script("addClassId('dr_b','alerts');"); $obj->assign("dr_b_alerts", "innerHTML", "Błędnie podana data"); $blad = true; } $obj->assign("dr_b", "value", $form['dr_b']); } if (empty($form['dr_i'])) { $obj->script("addClassId('dr_i','alerts');"); $obj->assign("dr_i_alerts", "innerHTML", $inf); $blad = true; } else { $form['dr_i'] = str_replace('-', '/', $form['dr_i']); $form['dr_i'] = str_replace('.', '/', $form['dr_i']); $form['dr_i'] = str_replace(',', '/', $form['dr_i']); $form['dr_i'] = str_replace(' ', '/', $form['dr_i']); if (!check_date($form['dr_i'])) { $obj->script("addClassId('dr_i','alerts');"); $obj->assign("dr_i_alerts", "innerHTML", "Błędnie podana data"); $blad = true; } $obj->assign("dr_i", "value", $form['dr_i']); } if (!empty($form['dr_h'])) { $form['dr_h'] = str_replace('-', '/', $form['dr_h']); $form['dr_h'] = str_replace('.', '/', $form['dr_h']); $form['dr_h'] = str_replace(',', '/', $form['dr_h']); $form['dr_h'] = str_replace(' ', '/', $form['dr_h']); if (!check_date($form['dr_h'])) { $obj->script("addClassId('dr_h','alerts');"); $obj->assign("dr_h_alerts", "innerHTML", "Błędnie podana data"); $blad = true; } $obj->assign("dr_h", "value", $form['dr_h']); } if (!empty($form['dr_ladownosc'])) { $form['dr_ladownosc'] = round(str_replace(',', '.', $form['dr_ladownosc']), 0); if (!intval($form['dr_ladownosc'])) { $obj->script("addClassId('id_ladownosc','alets');"); $obj->assign("dr_ladownosc_alerts", "innerHTML", "Błędnie podano ładowność"); $blad = true; } else { $obj->assign("dr_ladownosc", "value", $form['dr_ladownosc']); } } if (!empty($form['dr_nacisk'])) { $form['dr_nacisk'] = str_replace(',', '.', $form['dr_nacisk']); if (!check_natural($form['dr_nacisk'])) { $obj->script("addClassId('id_nacisk','alets');"); $obj->assign("dr_nacisk_alerts", "innerHTML", "Błędnie podano nacisk na oś"); $blad = true; } else { $form['dr_nacisk'] = sprintf("%0.2f", $form['dr_nacisk']); $form['dr_nacisk'] = str_replace(',', '.', $form['dr_nacisk']); $obj->assign("dr_nacisk", "value", $form['dr_nacisk']); } } if (!empty($form['dr_f1'])) { $form['dr_f1'] = round(str_replace(',', '.', $form['dr_f1']), 0); if (!intval($form['dr_f1'])) { $obj->script("addClassid('dr_f1','alerts');"); $obj->assign("dr_f1_alerts", "innerHTML", "Błędnie podano masę"); $blad = true; } else { $obj->assign("dr_f1", "value", $form['dr_f1']); } } if (!empty($form['dr_f2'])) { $form['dr_f2'] = round(str_replace(',', '.', $form['dr_f2']), 0); if (!intval($form['dr_f2'])) { $obj->script("addClassid('dr_f2','alerts');"); $obj->assign("dr_f2_alerts", "innerHTML", "Błędnie podano masę"); $blad = true; } else { $obj->assign("dr_f2", "value", $form['dr_f2']); } } if (!empty($form['dr_f3'])) { $form['dr_f3'] = round(str_replace(',', '.', $form['dr_f3']), 0); if (!intval($form['dr_f3'])) { $obj->script("addClassid('dr_f3','alerts');"); $obj->assign("dr_f3_alerts", "innerHTML", "Błędnie podano masę"); $blad = true; } else { $obj->assign("dr_f3", "value", $form['dr_f3']); } } if (!empty($form['dr_g'])) { $form['dr_g'] = round(str_replace(',', '.', $form['dr_g']), 0); if (!intval($form['dr_g'])) { $obj->script("addClassid('dr_g','alerts');"); $obj->assign("dr_g_alerts", "innerHTML", "Błędnie podano masę"); $blad = true; } else { $obj->assign("dr_g", "value", $form['dr_g']); } } if (!empty($form['dr_l'])) { $form['dr_l'] = round(str_replace(',', '.', $form['dr_l']), 0); if (!intval($form['dr_l'])) { $obj->script("addClassid('dr_l','alerts');"); $obj->assign("dr_l_alerts", "innerHTML", "Błędnie podano liczbę osi"); $blad = true; } else { $obj->assign("dr_l", "value", $form['dr_l']); } } if (!empty($form['dr_o1'])) { $form['dr_o1'] = round(str_replace(',', '.', $form['dr_o1']), 0); if (!intval($form['dr_o1'])) { $obj->script("addClassid('dr_o1','alerts');"); $obj->assign("dr_o1_alerts", "innerHTML", "Błędnie podano masę"); $blad = true; } else { $obj->assign("dr_o1", "value", $form['dr_o1']); } } if (!empty($form['dr_o2'])) { $form['dr_o2'] = round(str_replace(',', '.', $form['dr_o2']), 0); if (!intval($form['dr_o2'])) { $obj->script("addClassid('dr_o2','alerts');"); $obj->assign("dr_o2_alerts", "innerHTML", "Błędnie podano masę"); $blad = true; } else { $obj->assign("dr_o2", "value", $form['dr_o2']); } } if (!empty($form['dr_p1'])) { $form['dr_p1'] = str_replace(',', '.', $form['dr_p1']); if (!check_natural($form['dr_p1'])) { $obj->script("addClassId('id_p1','alets');"); $obj->assign("dr_p1_alerts", "innerHTML", "Błędnie podano pojemność silnika"); $blad = true; } else { $form['dr_p1'] = sprintf("%0.2f", $form['dr_p1']); $form['dr_p1'] = str_replace(',', '.', $form['dr_p1']); $obj->assign("dr_p1", "value", $form['dr_p1']); } } if (!empty($form['dr_p2'])) { $form['dr_p2'] = str_replace(',', '.', $form['dr_p2']); if (!check_natural($form['dr_p2'])) { $obj->script("addClassId('id_p2','alets');"); $obj->assign("dr_p2_alerts", "innerHTML", "Błędnie podano moc silnika"); $blad = true; } else { $form['dr_p2'] = sprintf("%0.2f", $form['dr_p2']); $form['dr_p2'] = str_replace(',', '.', $form['dr_p2']); $obj->assign("dr_p2", "value", $form['dr_p2']); } } if (!empty($form['dr_p1']) && empty($form['dr_p3'])) { $blad = true; $obj->script("addClassId('dr_p3','alerts');"); $obj->assign("dr_p3_alerts", "innerHTML", "Proszę wybrać rodzaj paliwa"); } if (empty($form['dr_wydajacy'])) { $obj->script("addClassId('dr_wydajacy','alerts');"); $obj->assign("dr_wydajacy_alerts", "innerHTML", $inf); $blad = true; } if (empty($form['dr_c11'])) { $obj->script("addClassId('dr_c11','alerts');"); $obj->assign("dr_c11_alerts", "innerHTML", $inf); $blad = true; } if (empty($form['dr_c12'])) { $obj->script("addClassId('dr_c12','alerts');"); $obj->assign("dr_c12_alerts", "innerHTML", $inf); $blad - true; } elseif (!check_regon($form['dr_c12']) && !check_ssn($form['dr_c12'])) { $obj->script("addClassId('dr_c12','alerts');"); $obj->assign("dr_c12_alerts", "innerHTML", "Błędnie wprowadzone REGON lub PESEL"); $blad - true; } if (empty($form['dr_c13'])) { $obj->script("addClassId('dr_c13','alerts');"); $obj->assign("dr_c13_alerts", "innerHTML", $inf); $blad = true; } if (empty($form['dr_c21'])) { $obj->script("addClassId('dr_c21','alerts');"); $obj->assign("dr_c21_alerts", "innerHTML", $inf); $blad = true; } if (empty($form['dr_c22'])) { $obj->script("addClassId('dr_c22','alerts');"); $obj->assign("dr_c22_alerts", "innerHTML", $inf); $blad = true; } elseif (!check_regon($form['dr_c22']) && !check_ssn($form['dr_c22'])) { $obj->script("addClassId('dr_c22','alerts');"); $obj->assign("dr_c22_alerts", "innerHTML", "Błędnie wprowadzono REGON lub PESEL"); $blad = true; } if (empty($form['dr_c23'])) { $obj->script("addClassId('dr_c23','alerts');"); $obj->assign("dr_c23_alerts", "innerHTML", $inf); $blad = true; } if (!empty($form['dr_s1'])) { $form['dr_s1'] = round(str_replace(',', '.', $form['dr_s1']), 0); if (!intval($form['dr_s1']) || $form['dr_s1'] < 1) { $obj->script("addClassid('dr_s1','alerts');"); $obj->assign("dr_s1_alerts", "innerHTML", "Błędnie podano liczbę miejsc siedzących"); $blad = true; } else { $obj->assign("dr_s1", "value", $form['dr_s1']); } } if (!empty($form['dr_s2'])) { $form['dr_s2'] = round(str_replace(',', '.', $form['dr_s2']), 0); if (!intval($form['dr_s2'])) { $obj->script("addClassid('dr_s2','alerts');"); $obj->assign("dr_s2_alerts", "innerHTML", "Błędnie podano liczbę miejsc stojących"); $blad = true; } else { $obj->assign("dr_s2", "value", $form['dr_s2']); } } if (empty($form['dr_kartapojazdu'])) { $obj->script("addClassId('dr_kartapojazdu','alerts');"); $obj->assign("dr_kartapojazdu_alerts", "innerHTML", $inf); $blad = true; } else { $form['dr_kartapojazdu'] = strtoupper($form['dr_kartapojazdu']); $obj->assign("dr_kartapojazdu", "value", $form['dr_kartapojazdu']); } if (empty($form['dr_seriadr'])) { $obj->script("addClassId('dr_seriadr','alerts');"); $obj->assign("dr_seriadr_alerts", "innerHTML", $inf); $blad = true; } else { $form['dr_seriadr'] = strtoupper($form['dr_seriadr']); $obj->assign("dr_seriadr", "value", $form['dr_seriadr']); } if (empty($form['forma_nabycia'])) { $blad = true; $obj->script("addClassId('forma_nabycia','alerts');"); $obj->assign("forma_nabycia_alerts", "innerHTML", $inf); } if (!empty($form['datazakupu'])) { $form['datazakupu'] = str_replace('-', '/', $form['datazakupu']); $form['datazakupu'] = str_replace('.', '/', $form['datazakupu']); $form['datazakupu'] = str_replace(',', '/', $form['datazakupu']); $form['datazakupu'] = str_replace(' ', '/', $form['datazakupu']); if (!check_date($form['datazakupu'])) { $obj->script("addClassId('datazakupu','alerts');"); $obj->assign("datazakupu_alerts", "innerHTML", "Błędnie podana data"); $blad = true; } $obj->assign("datazakupu", "value", $form['datazakupu']); } if (!empty($form['stanlicznika'])) { $form['stanlicznika'] = round(str_replace(',', '.', $form['stanlicznika']), 0); if (!intval($form['stanlicznika'])) { $obj->script("addClassid('stanlicznika','alerts');"); $obj->assign("stanlicznika_alerts", "innerHTML", "Błędnie podano stan licznika"); $blad = true; } else { $obj->assign("stanlicznika", "value", $form['stanlicznika']); } } if (!empty($form['dr_p1']) && empty($form['zbiornik'])) { $blad = true; $obj->script("addClassId('zbiornik','alerts');"); $obj->assign("zbiornik_alerts", "innerHTML", $inf); } elseif (!empty($form['zbiornik'])) { $form['zbiornik'] = round(str_replace(',', '.', $form['zbiornik']), 0); if (!intval($form['zbiornik'])) { $obj->script("addClassid('zbiornik','alerts');"); $obj->assign("zbiornik_alerts", "innerHTML", "Błędnie podano pojemność zbiornika"); $blad = true; } else { $obj->assign("zbiornik", "value", $form['zbiornik']); } } if (!$blad) { if ($id) { $form['id'] = $id; $RE->updatecars($form); } else { $id = $RE->addcars($form); } if ($form['backto'] == 're_carinfo') { $obj->script("self.location.href='?m=re_carinfo&tuck=base&idc=" . $id . "';"); } else { $obj->script("self.location.href='?m=re_carlist';"); } } return $obj; }
function add_PO($forms) { global $DB, $LMS, $UKE; $obj = new xajaxResponse(); $form = $forms['poedit']; $blad = false; $obj->script("removeClassId('id_shortname','alerts');"); $obj->assign("id_shortname_alerts", "innerHTML", ""); $obj->script("removeClassId('id_name','alerts');"); $obj->assign("id_name_alerts", "innerHTML", ""); $obj->script("removeClassId('id_ten','alerts');"); $obj->assign("id_ten_alerts", "innerHTML", ""); $obj->script("removeClassId('id_regon','alerts');"); $obj->assign("id_regon_alerts", "innerHTML", ""); $obj->script("removeClassId('id_rpt','alerts');"); $obj->assign("id_rpt_alerts", "innerHTML", ""); $obj->script("removeClassId('location','alerts');"); $obj->script("removeClassId('id_states','alerts');"); $obj->script("removeClassId('id_districts','alerts');"); $obj->script("removeClassId('id_boroughs','alerts');"); $obj->script("removeClassId('id_city','alerts');"); $obj->script("removeClassId('id_street','alerts');"); $obj->script("removeClassId('id_location_house','alerts');"); $obj->script("removeClassId('id_zip','alerts');"); $obj->assign("id_zip_alerts", "innerHTML", ""); if (!$form['shortname']) { $obj->script("addClassId('id_shortname','alerts');"); $obj->assign("id_shortname_alets", "innerHTML", "Identyfikator jest wymagany"); $blad = true; } if (!$form['name']) { $obj->script("addClassId('id_name','alerts');"); $obj->assign("id_name_alets", "innerHTML", "Nazwa firmy jest wymagana"); $blad = true; } if (!$form['ten']) { $obj->script("addClassId('id_ten','alerts');"); $blad = true; } elseif (!check_ten($form['ten'])) { $obj->script("addClassId('id_ten','alerts');"); $obj->assign('id_ten_alerts', 'innerHTML', 'Błędny numer NIP'); $blad = true; } if (!$form['regon']) { $obj->script("addClassId('id_regon','alerts');"); $blad = true; } elseif (!check_regon($form['regon'])) { $obj->script("addClassId('id_regon','alerts');"); $obj->assign('id_regon_alerts', 'innerHTML', 'Błędny numer REGON'); $blad = true; } if (!$form['rpt']) { $obj->script("addClassId('id_rpt','alerts');"); $blad = true; } elseif (!is_natural($form['rpt'])) { $obj->script("addClassId('id_rpt','alerts');"); $obj->assign('id_rpt_alerts', 'innerHTML', 'Błednie podano numer RPT'); $blad = true; } if (!$form['teryt']) { if (!$form['states']) { $obj->script("addClassId('id_states','alerts');"); $blad = true; } if (!$form['districts']) { $obj->script("addClassId('id_districts','alerts');"); $blad = true; } if (!$form['boroughs']) { $obj->script("addClassId('id_boroughs','alerts');"); $blad = true; } if (!$form['city']) { $obj->script("addClassId('id_city','alerts');"); $blad = true; } } elseif (!$form['location']) { $obj->script("addClassId('location','alerts');"); $blad = true; } if (!$form['location_house']) { $obj->script("addClassId('id_location_house','alerts');"); $blad = true; } if (!$form['zip']) { $obj->script("addClassId('id_zip','alerts');"); $blad = true; } elseif (!check_zip($form['zip'])) { $obj->script("addClassId('id_zip','alerts');"); $obj->assign("id_zip_alerts", "innerHTML", "Błędny kod pocztowy"); $blad = true; } if (!$blad) { if ($form['teryt']) { $data = $LMS->GetTerytCode($form['location_city'], $form['location_street']); $form['states'] = $data['name_states']; $form['districts'] = $data['name_districts']; $form['boroughs'] = $data['name_boroughs']; $form['city'] = $data['name_city']; $form['street'] = $data['name_street']; $form['kod_terc'] = $data['kod_terc']; $form['kod_simc'] = $data['kod_simc']; $form['kod_ulic'] = $data['kod_ulic']; unset($data); } else { $form['kod_terc'] = $form['kod_simc'] = $form['kod_ulic'] = 0; $form['location_city'] = $form['location_street'] = NULL; } $data = array(); $data['id'] = $form['id']; $data['rapid'] = $form['idr']; $data['mark'] = 'PO'; $data['markid'] = $form['shortname']; $action = $form['action']; unset($form['id']); unset($form['action']); $data['data'] = serialize($form); if ($action == 'add') { $UKE->add_siis_data_po($data); $obj->script("loadAjax('id_data','?m=uke_siis_info&tuck=PO&idr=" . $data['rapid'] . "');"); } elseif ($action == 'edit') { $UKE->update_siis_data_po($data); $obj->script("loadAjax('id_data','?m=uke_siis_info&tuck=PO&idr=" . $data['rapid'] . "');"); } } return $obj; }