Пример #1
0
 function save()
 {
     $errors = $this->validate();
     if (count($errors)) {
         return $errors;
     }
     //
     // Update record in database
     //
     // Record data in database
     $ol = "name='" . clean_input($this->getDataString('name')) . "', " . "court_reg='" . clean_input($this->getDataString('court_reg')) . "', " . "tax_number='" . clean_input($this->getDataString('tax_number')) . "', " . "stat_number='" . clean_input($this->getDataString('stat_number')) . "', " . "notes='" . clean_input($this->getDataString('notes')) . "'";
     if ($this->getDataInt('id_org') > 0) {
         $q = "UPDATE lcm_org SET date_update=NOW(),{$ol} WHERE id_org = " . $this->getDataInt('id_org');
         $result = lcm_query($q);
     } else {
         $q = "INSERT INTO lcm_org SET date_update = NOW(), date_creation = NOW(), {$ol}";
         $result = lcm_query($q);
         $this->setDataInt('id_org', lcm_insert_id('lcm_org', 'id_org'));
         // Just by precaution
         $_SESSION['form_data']['id_org'] = $this->getDataInt('id_org');
         // If there is an error (ex: in contacts), we should send back to 'org_det.php?org=XX'
         // not to 'org_det.php?org=0'.
         $ref_upd_org = 'edit_org.php?org=' . $this->getDataInt('id_org');
     }
     // Keywords
     update_keywords_request('org', $this->getDataInt('id_org'));
     if ($_SESSION['errors']) {
         $errors = array_merge($_SESSION['errors'], $errors);
     }
     // Insert/update client contacts
     include_lcm('inc_contacts');
     update_contacts_request('org', $this->getDataInt('id_org'));
     if ($_SESSION['errors']) {
         $errors = array_merge($_SESSION['errors'], $errors);
     }
     return $errors;
 }
Пример #2
0
 function save()
 {
     $errors = $this->validate();
     if (count($errors)) {
         return $errors;
     }
     //
     // Update record in database
     //
     $cl = "name_first = '" . clean_input($this->getDataString('name_first')) . "',\n\t\t\t   name_middle = '" . clean_input($this->getDataString('name_middle')) . "',\n\t\t\t   name_last = '" . clean_input($this->getDataString('name_last')) . "',\n\t\t\t   gender = '" . clean_input($this->getDataString('gender')) . "',\n\t\t\t   notes = '" . clean_input($this->getDataString('notes')) . "'";
     // ,
     if ($this->getDataString('date_birth')) {
         $cl .= ", date_birth = '" . $this->getDataString('date_birth') . "'";
     }
     $cl .= ", citizen_number = '" . clean_input($this->getDataString('citizen_number')) . "'";
     $cl .= ", civil_status = '" . clean_input($this->getDataString('civil_status')) . "'";
     $cl .= ", income = '" . clean_input($this->getDataString('income')) . "'";
     if ($this->getDataInt('id_client') > 0) {
         $q = "UPDATE lcm_client\n\t\t\t\tSET date_update = NOW(), \n\t\t\t\t\t{$cl} \n\t\t\t\tWHERE id_client = " . $this->getDataInt('id_client', '__ASSERT__');
         lcm_query($q);
     } else {
         $q = "INSERT INTO lcm_client\n\t\t\t\t\tSET date_creation = NOW(),\n\t\t\t\t\t\tdate_update = NOW(),\n\t\t\t\t\t\t{$cl}";
         $result = lcm_query($q);
         $this->data['id_client'] = lcm_insert_id('lcm_client', 'id_client');
     }
     // Keywords
     update_keywords_request('client', $this->getDataInt('id_client'));
     if ($_SESSION['errors']) {
         $errors = array_merge($_SESSION['errors'], $errors);
     }
     // Insert/update client contacts
     include_lcm('inc_contacts');
     update_contacts_request('client', $this->getDataInt('id_client'));
     if ($_SESSION['errors']) {
         $errors = array_merge($_SESSION['errors'], $errors);
     }
     return $errors;
 }
Пример #3
0
//
// Change password (if requested)
//
if (_session('usr_new_passwd') || !_session('username_old')) {
    change_password();
}
//
// Change username
//
if (_session('username') != _session('username_old') || !_session('username_old')) {
    change_username(_session('id_author'), _session('username_old'), _session('username'));
}
//
// Insert/update author contacts
//
include_lcm('inc_contacts');
update_contacts_request('author', _session('id_author'));
if (count($_SESSION['errors'])) {
    lcm_header("Location: edit_author.php?author=" . _session('id_author'));
    exit;
}
$dest_link = new Link('author_det.php');
$dest_link->addVar('author', _session('id_author'));
// [ML] Not used at the moment, but could be useful eventually to send user
// back to where he was (but as a choice, not automatically, see author_det.php).
if (_session('ref_edit_author')) {
    $dest_link->addVar('ref', _session('ref_edit_author'));
}
// Delete session (of form data will become ghosts)
$_SESSION['form_data'] = array();
lcm_header('Location: ' . $dest_link->getUrlForHeader());