示例#1
0
     $error['street'] = trans('Street name required!');
 }
 if ($customeradd['apartment'] != '' && $customeradd['building'] == '') {
     $error['building'] = trans('Building number required!');
 }
 if ($customeradd['post_building'] != '' && $customeradd['post_street'] == '') {
     $error['post_street'] = trans('Street name required!');
 }
 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.');
示例#2
0
     switch ($ten_existence_check) {
         case 'warning':
             if (!isset($customerdata['tenexistencewarning']) && $ten_exists) {
                 $error['ten'] = trans('Customer with specified Tax Exempt Number already exists! If you are sure you want to accept it, then click "Submit" again.');
                 $tenexistencewarning = 1;
             }
             break;
         case 'error':
             if ($ten_exists) {
                 $error['ten'] = trans('Customer with specified Tax Exempt Number already exists!');
             }
             break;
     }
 }
 if ($customerdata['ssn'] != '') {
     if (!isset($customerdata['ssnwarning']) && !check_ssn($customerdata['ssn'])) {
         $error['ssn'] = trans('Incorrect Social Security Number! If you are sure you want to accept it, then click "Submit" again.');
         $ssnwarning = 1;
     }
     $ssn_existence_check = ConfigHelper::getConfig('phpui.customer_ssn_existence_check', 'none');
     $ssn_exists = $DB->GetOne("SELECT id FROM customers WHERE id <> ? AND REPLACE(REPLACE(ssn, '-', ''), ' ', '') = ?", array($_GET['id'], preg_replace('/- /', '', $customerdata['ssn']))) > 0;
     switch ($ssn_existence_check) {
         case 'warning':
             if (!isset($customerdata['ssnexistencewarning']) && $ssn_exists) {
                 $error['ssn'] = trans('Customer with specified Social Security Number already exists! If you are sure you want to accept it, then click "Submit" again.');
                 $ssnexistencewarning = 1;
             }
             break;
         case 'error':
             if ($ssn_exists) {
                 $error['ssn'] = trans('Customer with specified Social Security Number already exists!');
示例#3
0
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;
}
示例#4
0
function module_updateusersave()
{
    global $LMS, $SMARTY, $SESSION, $rights, $error;
    $userinfo = $LMS->GetCustomer($SESSION->id);
    $userinfo['im'] = isset($userinfo['messengers'][IM_GG]) ? $userinfo['messengers'][IM_GG]['uid'] : '';
    $userinfo['yahoo'] = isset($userinfo['messengers'][IM_YAHOO]) ? $userinfo['messengers'][IM_YAHOO]['uid'] : '';
    $userinfo['skype'] = isset($userinfo['messengers'][IM_SKYPE]) ? $userinfo['messengers'][IM_SKYPE]['uid'] : '';
    $userdata = $_POST['userdata'];
    $right = $rights['info'];
    $id = $SESSION->id;
    $error = NULL;
    if (isset($right['edit_addr']) || isset($right['edit_addr_ack']) || isset($right['edit_contact']) || isset($right['edit_contact_ack'])) {
        foreach (array_diff_assoc($userdata, $userinfo) as $field => $val) {
            if ($field == 'phone' || $field == 'email') {
                $type = $field == 'phone' ? 'contacts' : 'emails';
                foreach ($val as $i => $v) {
                    $v = trim(htmlspecialchars($v, ENT_NOQUOTES));
                    if (isset($right['edit_contact'])) {
                        if (isset($userinfo[$type][$i]) && $userinfo[$type][$i][$field] != $v) {
                            if ($v) {
                                $LMS->DB->Execute('UPDATE customercontacts SET contact = ? WHERE id = ? AND customerid = ?', array($v, $i, $id));
                            } else {
                                $LMS->DB->Execute('DELETE FROM customercontacts WHERE id = ? AND customerid = ?', array($i, $id));
                            }
                        } elseif (!isset($userinfo[$type][$i]) && $v) {
                            $LMS->DB->Execute('INSERT INTO customercontacts (customerid, contact, type) VALUES (?, ?, ?)', array($id, $v, CONTACT_LANDLINE));
                        }
                        $userinfo[$type][$i][$field] = $v;
                    } elseif (isset($right['edit_contact_ack']) && ($v || isset($userinfo['contacts'][$i]))) {
                        if (!isset($userinfo[$type][$i]) || $userinfo[$type][$i][$field] != $v) {
                            $LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue) 
						VALUES(?, ?, ?)', array($id, $field . $i, $v));
                        }
                    }
                }
                continue;
            } else {
                $val = trim(htmlspecialchars($val, ENT_NOQUOTES));
            }
            switch ($field) {
                case 'name':
                case 'lastname':
                case 'street':
                case 'building':
                case 'apartment':
                case 'zip':
                case 'city':
                    if (isset($right['edit_addr'])) {
                        $userinfo[$field] = $val;
                        $needupdate = 1;
                    } elseif (isset($right['edit_addr_ack'])) {
                        $LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue) 
					VALUES(?, ?, ?)', array($id, $field, $val));
                    }
                    break;
                case 'email':
                    if ($val != '' && !check_email($val)) {
                        $error['email'] = 1;
                    } else {
                        if (isset($right['edit_contact'])) {
                            $userinfo[$field] = $val;
                            $needupdate = 1;
                        } elseif (isset($right['edit_contact_ack'])) {
                            $LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue) 
						VALUES(?, ?, ?)', array($id, $field, $val));
                        }
                    }
                    break;
                case 'ten':
                    if ($val != '' && !check_ten($val)) {
                        $error['ten'] = 1;
                    } else {
                        if (isset($right['edit_addr'])) {
                            $userinfo[$field] = $val;
                            $needupdate = 1;
                        } elseif (isset($right['edit_addr_ack'])) {
                            $LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue) 
						VALUES(?, ?, ?)', array($id, $field, $val));
                        }
                    }
                    break;
                case 'ssn':
                    if ($val != '' && !check_ssn($val)) {
                        $error['ssn'] = 1;
                    } else {
                        if (isset($right['edit_addr'])) {
                            $userinfo[$field] = $val;
                            $needupdate = 1;
                        } elseif (isset($right['edit_addr_ack'])) {
                            $LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue) 
						VALUES(?, ?, ?)', array($id, $field, $val));
                        }
                    }
                    break;
                case 'im':
                    if (isset($right['edit_contact'])) {
                        $LMS->DB->Execute('DELETE FROM imessengers WHERE customerid = ? AND type = ?', array($id, IM_GG));
                        if ($val) {
                            $LMS->DB->Execute('INSERT INTO imessengers (customerid, uid, type) VALUES (?,?,?)', array($id, $val, IM_GG));
                        }
                    } elseif (isset($right['edit_contact_ack'])) {
                        $LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue) 
					VALUES(?, ?, ?)', array($id, $field, $val));
                    }
                    break;
                case 'yahoo':
                    if (isset($right['edit_contact'])) {
                        $LMS->DB->Execute('DELETE FROM imessengers WHERE customerid = ? AND type = ?', array($id, IM_YAHOO));
                        if ($val) {
                            $LMS->DB->Execute('INSERT INTO imessengers (customerid, uid, type) VALUES (?,?,?)', array($id, $val, IM_YAHOO));
                        }
                    } elseif (isset($right['edit_contact_ack'])) {
                        $LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue) 
					VALUES(?, ?, ?)', array($id, $field, $val));
                    }
                    break;
                case 'skype':
                    if (isset($right['edit_contact'])) {
                        $LMS->DB->Execute('DELETE FROM imessengers WHERE customerid = ? AND type = ?', array($id, IM_SKYPE));
                        if ($val) {
                            $LMS->DB->Execute('INSERT INTO imessengers (customerid, uid, type) VALUES (?,?,?)', array($id, $val, IM_SKYPE));
                        }
                    } elseif (isset($right['edit_contact_ack'])) {
                        $LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue) 
					VALUES(?, ?, ?)', array($id, $field, $val));
                    }
                    break;
                default:
                    break;
            }
        }
    }
    if (isset($error)) {
        $usernodes = $LMS->GetCustomerNodes($SESSION->id);
        $usernodes['ownerid'] = $SESSION->id;
        $SMARTY->assign('userinfo', $userinfo);
        $SMARTY->assign('usernodes', $usernodes);
        $SMARTY->assign('error', $error);
        $SMARTY->display('module:updateuser.html');
    } else {
        if (isset($needupdate)) {
            $LMS->CustomerUpdate($userinfo);
        }
        header('Location: ?m=info');
    }
}
示例#5
0
 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['invoice_ten'] != '' && !check_ten($customerdata['invoice_ten']) && !isset($customerdata['invoice_tenwarning'])) {
     $error['invoice_ten'] = trans('Incorrect Tax Exempt Number! If you are sure you want to accept it, then click "Submit" again.');
     $invoice_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['invoice_ssn'] != '' && !check_ssn($customerdata['invoice_ssn']) && !isset($customerdata['invoice_ssnwarning'])) {
     $error['invoice_ssn'] = trans('Incorrect Social Security Number! If you are sure you want to accept it, then click "Submit" again.');
     $invoice_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.');