Skip to content
Snippets Groups Projects
Commit 3a373cd8 authored by goujonpa's avatar goujonpa
Browse files

fix + pricefields

parent 98eb8c88
No related branches found
No related tags found
No related merge requests found
<?php
class DateField extends Field
{
public function html() {
$html = '<div class = "form-group">
<label for = "form'.$this->name.'">
<input type = "date" name = "'.$this->name.'" value ="'.$this->value.'"> '.$this->label.'
</label>
// Todo, if isset($_POST[$this->name]) && !$this->validate() => Show a error msg explanation for this line.
$html = '<div class="form-group">
<label for="form'.$this->name.'">'.$this->label.'</label>
<input type="number" class="form-control" name="'.$this->name.'" value="'.$this->value.'">
</div>';
return $html;
}
......@@ -12,16 +14,20 @@
public function validate()
{
/*if (isset($_POST[$this->name]))
if (isset($_POST[$this->name]))
{
$_POST[$this->name] = htmlspecialchars($_POST[$this->name]);
if (preg_match("#^0[1-68]([-. ]?[0-9]{2}){4}$#", $_POST[$this->name]))
{
$this->value = $_POST[$this->name];
return true;
}
*/
$this->value = $_POST[$this->name];
if ($this->value > -1) {
return true;
}
}
return false;
}
public function show() {
$prix = $this->value;
$html = (string)$prix;
$html .= "€";
return $html;
}
}
......@@ -5,6 +5,18 @@ class Espece extends Objet
protected $id;
protected $nom;
protected $prix_consultation;
public $_specialFields = array(
"id" => array(
"i" => 1
),
"nom" => array(
"i" => 2
),
"prix_consultation" => array(
"i" => 3,
"label" => "Prix de la consultation",
"t" => "PriceField"
));
public function id()
{
......
......@@ -30,7 +30,8 @@ class Facture extends Objet
),
"prix_total" => array(
"label" => "Prix total",
"i" => 9
"i" => 9,
"t" => "PriceField"
));
public function id()
......
......@@ -22,7 +22,8 @@ class Ordonnance extends Objet
"t" => "ForeignField"
),
"prix" => array(
"i" => 5
"i" => 5,
"t" => "PriceField"
));
public function id()
......
......@@ -17,7 +17,8 @@ class Prestation extends Objet
"i" => 1
)
"prix" => array(
"i" => 4
"i" => 4,
"t" => "PriceField"
));
public function id()
......
......@@ -20,6 +20,7 @@ class Produit extends Objet
),
"prix" => array(
"i" => 4,
"t" => "PriceField"
));
public function id()
......
......@@ -20,7 +20,8 @@ class Race extends Objet
),
"prix_intervention" => array(
"label" => "Prix de l'intervetion",
"i" => 4
"i" => 4,
"t" => "PriceField"
));
public function id()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment