diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f0042f962bb..e9f50e77715 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -153,13 +153,13 @@ else if ($action == "add") { $book->label_operation= $label_operation; $book->debit = $debit; $book->credit = $credit; - $book->doc_date = GETPOST('doc_date'); - $book->doc_type = GETPOST('doc_type'); + $book->doc_date = GETPOST('doc_date','alpha'); + $book->doc_type = GETPOST('doc_type','alpha'); $book->piece_num = $piece_num; - $book->doc_ref = GETPOST('doc_ref'); - $book->code_journal = GETPOST('code_journal'); - $book->fk_doc = GETPOST('fk_doc'); - $book->fk_docdet = GETPOST('fk_docdet'); + $book->doc_ref = GETPOST('doc_ref','alpha'); + $book->code_journal = GETPOST('code_journal','alpha'); + $book->fk_doc = GETPOST('fk_doc','alpha'); + $book->fk_docdet = GETPOST('fk_docdet','alpha'); if (floatval($debit) != 0.0) { $book->montant = $debit; @@ -210,7 +210,7 @@ else if ($action == "confirm_create") { $book = new BookKeeping($db); - if (! GETPOST('code_journal') || GETPOST('code_journal') == '-1') { + if (! GETPOST('code_journal','alpha') || GETPOST('code_journal','alpha') == '-1') { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); $action='create'; $error++; @@ -226,11 +226,11 @@ else if ($action == "confirm_create") { $book->label_compte = ''; $book->debit = 0; $book->credit = 0; - $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear')); - $book->doc_type = GETPOST('doc_type'); - $book->piece_num = GETPOST('next_num_mvt'); - $book->doc_ref = GETPOST('doc_ref'); - $book->code_journal = GETPOST('code_journal'); + $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth','int'), GETPOST('doc_dateday','int'), GETPOST('doc_dateyear','int')); + $book->doc_type = GETPOST('doc_type','alpha'); + $book->piece_num = GETPOST('next_num_mvt','alpha'); + $book->doc_ref = GETPOST('doc_ref','alpha'); + $book->code_journal = GETPOST('code_journal','alpha'); $book->fk_doc = 0; $book->fk_docdet = 0; $book->montant = 0; @@ -265,8 +265,8 @@ if ($action == 'setdate') { } if ($action == 'setjournal') { - $journaldoc = trim(GETPOST('code_journal')); - $result = $object->updateByMvt($piece_num,'code_journal',$journaldoc,$mode); + $journaldoc = trim(GETPOST('code_journal','alpha')); + $result = $object->updateByMvt($piece_num, 'code_journal', $journaldoc, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -279,7 +279,7 @@ if ($action == 'setjournal') { } if ($action == 'setdocref') { - $refdoc = trim(GETPOST('doc_ref')); + $refdoc = trim(GETPOST('doc_ref','alpha')); $result = $object->updateByMvt($piece_num,'doc_ref',$refdoc,$mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -476,11 +476,11 @@ if ($action == 'create') print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; } else { - print $book->doc_ref ; + print $book->doc_ref ; } print ''; print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index d95f3b5b6b7..13b25599280 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -501,7 +501,7 @@ class BookKeeping extends CommonObject } if (! $error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element . $mode); if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you @@ -1254,7 +1254,7 @@ class BookKeeping extends CommonObject // first check if line not yet in bookkeeping $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - $sql .= " WHERE piece_num = " . $piecenum; + $sql .= " WHERE piece_num = " . (int) $piecenum; $sql .= " AND entity IN (" . getEntity('accountancy') . ")"; $resql = $this->db->query($sql); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 4f060d280e9..81757aab9e0 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -298,33 +298,33 @@ if (empty($reshook)) $object->oldcopy = clone $object; // Change values - $object->civility_id = trim($_POST["civility_id"]); - $object->firstname = trim($_POST["firstname"]); - $object->lastname = trim($_POST["lastname"]); - $object->login = trim($_POST["login"]); - $object->pass = trim($_POST["pass"]); + $object->civility_id = trim(GETPOST("civility_id",'alpha')); + $object->firstname = trim(GETPOST("firstname",'alpha')); + $object->lastname = trim(GETPOST("lastname",'alpha')); + $object->login = trim(GETPOST("login",'alpha')); + $object->pass = trim(GETPOST("pass",'alpha')); - $object->societe = trim($_POST["societe"]); - $object->company = trim($_POST["societe"]); + $object->societe = trim(GETPOST("societe",'alpha')); + $object->company = trim(GETPOST("societe",'alpha')); - $object->address = trim($_POST["address"]); - $object->zip = trim($_POST["zipcode"]); - $object->town = trim($_POST["town"]); - $object->state_id = $_POST["state_id"]; - $object->country_id = $_POST["country_id"]; + $object->address = trim(GETPOST("address",'alpha')); + $object->zip = trim(GETPOST("zipcode",'alpha')); + $object->town = trim(GETPOST("town",'alpha')); + $object->state_id = GETPOST("state_id",'int'); + $object->country_id = GETPOST("country_id",'int'); - $object->phone = trim($_POST["phone"]); - $object->phone_perso = trim($_POST["phone_perso"]); - $object->phone_mobile= trim($_POST["phone_mobile"]); - $object->email = trim($_POST["member_email"]); - $object->skype = trim($_POST["skype"]); + $object->phone = trim(GETPOST("phone",'alpha')); + $object->phone_perso = trim(GETPOST("phone_perso",'alpha')); + $object->phone_mobile= trim(GETPOST("phone_mobile",'alpha')); + $object->email = trim(GETPOST("member_email",'alpha')); + $object->skype = trim(GETPOST("skype",'alpha')); $object->birth = $birthdate; $object->typeid = GETPOST("typeid",'int'); - //$object->note = trim($_POST["comment"]); + //$object->note = trim(GETPOST("comment","alpha")); $object->morphy = GETPOST("morphy",'alpha'); - if (GETPOST('deletephoto')) $object->photo=''; + if (GETPOST('deletephoto','alpha')) $object->photo=''; elseif (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Get status and public property @@ -469,8 +469,8 @@ if (empty($reshook)) $subscription=GETPOST("subscription",'alpha'); $public=GETPOST("public",'alpha'); - $userid=$_POST["userid"]; - $socid=$_POST["socid"]; + $userid=GETPOST("userid",'int'); + $socid=GETPOST("socid",'int'); $object->civility_id = $civility_id; $object->firstname = $firstname; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 3247fdf31e4..913853f430f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -439,8 +439,8 @@ class Adherent extends CommonObject $sql.= ", note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); $sql.= ", public = '".$this->db->escape($this->public)."'"; - $sql.= ", statut = ".$this->statut; - $sql.= ", fk_adherent_type = ".$this->typeid; + $sql.= ", statut = ".$this->db->escape($this->statut); + $sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid); $sql.= ", morphy = '".$this->db->escape($this->morphy)."'"; $sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null"); if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 9d7d02882d3..64e515ac76f 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -341,18 +341,18 @@ if ($action == 'edit' || $action == 'updateedit') print '