Exemplo n.º 1
0
function formregister($forms)
{
    global $DB;
    $obj = new xajaxResponse();
    $blad = false;
    $form = $forms['register'];
    $obj->script("removeClassid('id_name','alerts');");
    $obj->assign("id_name_alerts", "innerHTML", "");
    $obj->script("removeClassid('id_zip','alerts');");
    $obj->assign("id_zip_alerts", "innerHTML", "");
    $obj->script("removeClassid('id_url','alerts');");
    $obj->assign("id_url_alerts", "innerHTML", "");
    $obj->script("removeClassid('id_email','alerts');");
    $obj->assign("id_email_alerts", "innerHTML", "");
    if (empty($form['name'])) {
        $blad = true;
        $obj->script("addClassId('id_name','alerts');");
        $obj->assign("id_name_alerts", "innerHTML", "Nazwa firmy jest wymagana");
    }
    if (!empty($form['zip']) && !check_zip($form['zip'])) {
        $blad = true;
        $obj->script("addClassId('id_zip','alerts');");
        $obj->assign("id_zip_alerts", "innerHTML", "Błędnie wprowadzono kod pocztowy");
    }
    if (!empty($form['email']) && !check_email($form['email'])) {
        $blad = true;
        //	$obj->script("addClassId('id_email','alerts');");
        $obj->assign("id_email_alerts", "innerHTML", "Błędnie wprowadzono adres skrzynki pocztowej");
    } elseif (!empty($form['newsletter']) && empty($form['email'])) {
        $blad = true;
        //	$obj->script("addClassId('id_email','alerts');");
        $obj->assign("id_email_alerts", "innerHTML", "Proszę wprowadzić adres skrzynki pocztowej");
    }
    if (!$blad) {
        $obj->assign("id_info", "innerHTML", "<br>Proszę czekać, dane są przesyłane<br>");
        $obj->script("xajax_sendregister(xajax.getFormValues('register'));");
    }
    return $obj;
}
Exemplo n.º 2
0
 }
 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!');
 }
 foreach ($customeradd['uid'] as $idx => $val) {
     $val = trim($val);
     switch ($idx) {
         case IM_GG:
             if ($val != '' && !check_gg($val)) {
                 $error['gg'] = trans('Incorrect IM uin!');
             }
Exemplo n.º 3
0
     $error['name'] = trans('Division long name is required!');
 }
 if ($division['shortname'] == '') {
     $error['shortname'] = trans('Division short name is required!');
 } elseif ($DB->GetOne('SELECT 1 FROM divisions WHERE shortname = ?', array($division['shortname']))) {
     $error['shortname'] = trans('Division with specified name already exists!');
 }
 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;
 }
Exemplo n.º 4
0
 }
 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);
     switch ($idx) {
         case IM_GG:
             if ($val != '' && !check_gg($val)) {
                 $error['gg'] = trans('Incorrect IM uin!');
             }
             break;
         case IM_YAHOO:
Exemplo n.º 5
0
 }
 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['invoice_zip'] != '' && !check_zip($customeradd['invoice_zip']) && !isset($customeradd['invoice_zipwarning'])) {
     $error['invoice_zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.');
     $customeradd['invoice_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 ($customeradd['email'] != '' && !check_email($customeradd['email'])) {
     $error['email'] = trans('Incorrect email!');
 }
 foreach ($customeradd['uid'] as $idx => $val) {
     $val = trim($val);
     switch ($idx) {
         case IM_GG:
Exemplo n.º 6
0
function validate_networknode($forms)
{
    global $DB;
    $blad = false;
    $warn = false;
    $obj = new xajaxResponse();
    $form = $forms['networknode'];
    $form['name'] = $forms['name'];
    $form['id'] = $forms['networknodeid'];
    $obj->script("removeClassId('id_name','alerts');");
    $obj->assign("id_name_alerts", "innerHTML", "");
    $obj->script("removeClassId('location','alerts');");
    $obj->assign("id_location_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_location_house','alerts');");
    $obj->assign("id_location_house_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_zip','alerts');");
    $obj->assign("id_zip_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_states','alerts');");
    $obj->assign("id_states_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_districts','alerts');");
    $obj->assign("id_districts_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_boroughs','alerts');");
    $obj->assign("id_boroughs_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_city','alerts');");
    $obj->assign("id_city_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_street','alerts');");
    $obj->assign("id_street_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_cadastral_parcel','alerts');");
    $obj->assign("id_cadastral_parcel_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_latitude','alerts');");
    $obj->assign("id_latitude_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_longitude','alerts');");
    $obj->assign("id_longitude_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_buildingtype','alerts');");
    $obj->assign("id_buildingtype_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_total_bandwidth','alerts');");
    $obj->assign("id_total_bandwidth_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_bandwidth_broadband','alerts');");
    $obj->assign("id_bandwidth_broadband_alerts", "innerHTML", "");
    $obj->script("removeClassId('id_invprojectid','alerts');");
    $obj->assign("id_invprojectid_alerts", "innerHTML", "");
    if (empty($form['name'])) {
        $blad = true;
        $obj->script("addClassId('id_name','alerts');");
        $obj->assign("id_name_alerts", "innerHTML", "Pole wymagane");
    } else {
        if (!empty($form['id'])) {
            if ($DB->GetOne('SELECT 1 FROM networknode WHERE UPPER(name) = ? AND id != ? ' . $DB->Limit(1) . ' ;', array(strtoupper($form['name']), $form['id']))) {
                $blad = true;
                $obj->script("addClassid('id_name','alerts');");
                $obj->assign("id_name_alerts", "innerHTML", "Podana nazwa już istnieje");
            }
        } else {
            if ($DB->GetOne('SELECT 1 FROM networknode WHERE UPPER(name) = ? ' . $DB->Limit(1) . ' ;', array(strtoupper($form['name'])))) {
                $blad = true;
                $obj->script("addClassid('id_name','alerts');");
                $obj->assign("id_name_alerts", "innerHTML", "Podana nazwa już istnieje");
            }
        }
    }
    if ($forms['teryt']) {
        if (empty($form['location']) || empty($form['location_city'])) {
            $blad = true;
            $obj->script("addClassId('location','alerts');");
            $obj->assign("id_location_alerts", "innerHTML", "Pole wymagane");
        }
        if (empty($form['location_house'])) {
            $blad = true;
            $obj->script("addClassId('id_location_house','alerts');");
            $obj->assign("id_location_house_alerts", "innerHTML", "Pole wymagane");
        }
        if (empty($form['latitude'])) {
            $warn = true;
            $obj->script("document.getElementById('id_latitude_alerts').style.color='blue';");
            $obj->assign("id_latitude_alerts", "innerHTML", "Zalecane podanie szerokości");
        }
        if (empty($form['longitude'])) {
            $warn = true;
            $obj->script("document.getElementById('id_longitude_alerts').style.color='blue';");
            $obj->assign("id_longitude_alerts", "innerHTML", "Zalecane podanie długości");
        }
    } else {
        if (empty($form['states'])) {
            $blad = true;
            $obj->script("addClassId('id_states','alerts');");
            $obj->assign("id_states_alerts", "innerHTML", "Pole wymagane");
        }
        if (empty($form['districts'])) {
            $blad = true;
            $obj->script("addClassId('id_districts','alerts');");
            $obj->assign("id_districts_alerts", "innerHTML", "Pole wymagane");
        }
        if (empty($form['boroughs'])) {
            $blad = true;
            $obj->script("addClassId('id_boroughs','alerts');");
            $obj->assign("id_boroughs_alerts", "innerHTML", "Pole wymagane");
        }
        if (empty($form['city'])) {
            $blad = true;
            $obj->script("addClassId('id_city','alerts');");
            $obj->assign("id_city_alerts", "innerHTML", "Pole wymagane");
        }
        if (empty($form['street']) || empty($form['location_house'])) {
            $warn = true;
            $obj->assign("id_cadastral_parcel_alerts", "innerHTML", "Zalecane jest podanie nr. działki");
            if (empty($form['latitude'])) {
                $blad = true;
                $obj->script("addClassId('id_latitude','alerts');");
                $obj->script("document.getElementById('id_latitude_alerts').style.color='red';");
                $obj->assign("id_latitude_alerts", "innerHTML", "Pole wymagane");
            }
            if (empty($form['longitude'])) {
                $blad = true;
                $obj->script("addClassId('id_longitude','alerts');");
                $obj->script("document.getElementById('id_longitude_alerts').style.color='red';");
                $obj->assign("id_longitude_alerts", "innerHTML", "Pole wymagane");
            }
        } else {
            if (empty($form['latitude'])) {
                $warn = true;
                $obj->script("document.getElementById('id_latitude_alerts').style.color='blue';");
                $obj->assign("id_latitude_alerts", "innerHTML", "Zalecane podanie szerokości");
            }
            if (empty($form['longitude'])) {
                $warn = true;
                $obj->script("document.getElementById('id_longitude_alerts').style.color='blue';");
                $obj->assign("id_longitude_alerts", "innerHTML", "Zalecane podanie długości");
            }
        }
    }
    if (empty($form['zip'])) {
        $blad = true;
        $obj->script("addClassId('id_zip','alerts');");
        $obj->assign("id_zip_alerts", "innerHTML", "Pole wymagane");
    } elseif (!check_zip($form['zip'])) {
        $blad = true;
        $obj->script("addClassId('id_zip','alerts');");
        $obj->assign("id_zip_alerts", "innerHTML", "Błędny kod pocztowy");
    }
    if (empty($form['buildingtype'])) {
        $blad = true;
        $obj->script("addClassId('id_buildingtype','alerts');");
        $obj->assign("id_buildingtype_alerts", "innerHTML", "Pole wymagane");
    }
    if (!empty($form['total_bandwidth']) && !is_numeric($form['total_bandwidth'])) {
        $blad = true;
        $obj->script("addClassId('id_total_bandwidth','alerts');");
        $obj->script("document.getElementById('id_total_bandwidth_alerts').style.color='red';");
        $obj->assign("id_total_bandwidth_alerts", "innerHTML", "Błędnie podana wartość");
    }
    if (empty($form['bandwidth_broadband'])) {
        $warn = true;
        $obj->script("document.getElementById('id_bandwidth_broadband_alerts').style.color='blue';");
        $obj->assign("id_bandwidth_broadband_alerts", "innerHTML", "Podaj przepustowość dla Internetu");
    } elseif (!is_numeric($form['bandwidth_broadband'])) {
        $blad = true;
        $obj->script("addClassId('id_bandwidth_broadband','alerts');");
        $obj->script("document.getElementById('id_bandwidth_broadband_alerts').style.color='red';");
        $obj->assign("id_bandwidth_broadband_alerts", "innerHTML", "Błędnie podana wartość");
    } elseif (!empty($form['bandwidth_broadband']) && empty($form['total_bandwidth'])) {
        $obj->script("document.getElementById('id_total_bandwidth').value = document.getElementById('id_bandwidth_broadband').value;");
    }
    if (empty($form['total_bandwidth']) && empty($form['bandwidth_broadband'])) {
        $warn = true;
        $obj->script("document.getElementById('id_total_bandwidth_alerts').style.color='blue';");
        $obj->assign("id_total_bandwidth_alerts", "innerHTML", "Podaj całkowitą przepustowość węzła");
    }
    if (!empty($form['total_bandwidth']) && !empty($form['bandwidth_broadband']) && $form['bandwidth_broadband'] > $form['total_bandwidth']) {
        $blad = true;
        $obj->script("addClassId('id_bandwidth_broadband','alerts');");
        $obj->script("document.getElementById('id_bandwidth_broadband_alerts').style.color='red';");
        $obj->assign("id_bandwidth_broadband_alerts", "innerHTML", "Przepustowość jest wyższa dla całkowitej przepustowości");
    }
    if ($form['eu'] && !$form['invprojectid']) {
        $blad = true;
        $obj->script("addClassId('id_invprojectid','alerts');");
        $obj->assign("id_invprojectid_alerts", "innerHTML", "Proszę wybrać projekt");
    }
    if ($warn) {
        $str = "<input type='checkbox' name='networknode[notwarn]' value='1' id='id_notwarn'";
        if ($form['notwarn']) {
            $str .= " checked";
        }
        $str .= "><label for='id_notwarn' style='color:blue;'><b>Ignoruj ostrzeżenia</b></label>";
        $obj->assign("id_warn_view", "innerHTML", $str);
    } else {
        $obj->assign("id_warn_view", "innerHTML", "");
    }
    if (!$blad) {
        if ($warn && !$form['notwarn']) {
            $blad = true;
        }
    }
    if (!$blad) {
        $obj->script("document.networknode.submit();");
    }
    return $obj;
}
Exemplo n.º 7
0
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;
}