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 <?php
class DateField extends Field
{ {
public function html() { public function html() {
$html = '<div class = "form-group"> // Todo, if isset($_POST[$this->name]) && !$this->validate() => Show a error msg explanation for this line.
<label for = "form'.$this->name.'"> $html = '<div class="form-group">
<input type = "date" name = "'.$this->name.'" value ="'.$this->value.'"> '.$this->label.' <label for="form'.$this->name.'">'.$this->label.'</label>
</label> <input type="number" class="form-control" name="'.$this->name.'" value="'.$this->value.'">
</div>'; </div>';
return $html; return $html;
} }
...@@ -12,16 +14,20 @@ ...@@ -12,16 +14,20 @@
public function validate() public function validate()
{ {
/*if (isset($_POST[$this->name])) if (isset($_POST[$this->name]))
{ {
$_POST[$this->name] = htmlspecialchars($_POST[$this->name]); $this->value = $_POST[$this->name];
if (preg_match("#^0[1-68]([-. ]?[0-9]{2}){4}$#", $_POST[$this->name])) if ($this->value > -1) {
{ return true;
$this->value = $_POST[$this->name]; }
return true; }
}
*/
return false; return false;
} }
public function show() {
$prix = $this->value;
$html = (string)$prix;
$html .= "€";
return $html;
}
} }
...@@ -5,6 +5,18 @@ class Espece extends Objet ...@@ -5,6 +5,18 @@ class Espece extends Objet
protected $id; protected $id;
protected $nom; protected $nom;
protected $prix_consultation; 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() public function id()
{ {
......
...@@ -30,7 +30,8 @@ class Facture extends Objet ...@@ -30,7 +30,8 @@ class Facture extends Objet
), ),
"prix_total" => array( "prix_total" => array(
"label" => "Prix total", "label" => "Prix total",
"i" => 9 "i" => 9,
"t" => "PriceField"
)); ));
public function id() public function id()
......
...@@ -22,7 +22,8 @@ class Ordonnance extends Objet ...@@ -22,7 +22,8 @@ class Ordonnance extends Objet
"t" => "ForeignField" "t" => "ForeignField"
), ),
"prix" => array( "prix" => array(
"i" => 5 "i" => 5,
"t" => "PriceField"
)); ));
public function id() public function id()
......
...@@ -17,7 +17,8 @@ class Prestation extends Objet ...@@ -17,7 +17,8 @@ class Prestation extends Objet
"i" => 1 "i" => 1
) )
"prix" => array( "prix" => array(
"i" => 4 "i" => 4,
"t" => "PriceField"
)); ));
public function id() public function id()
......
...@@ -20,6 +20,7 @@ class Produit extends Objet ...@@ -20,6 +20,7 @@ class Produit extends Objet
), ),
"prix" => array( "prix" => array(
"i" => 4, "i" => 4,
"t" => "PriceField"
)); ));
public function id() public function id()
......
...@@ -20,7 +20,8 @@ class Race extends Objet ...@@ -20,7 +20,8 @@ class Race extends Objet
), ),
"prix_intervention" => array( "prix_intervention" => array(
"label" => "Prix de l'intervetion", "label" => "Prix de l'intervetion",
"i" => 4 "i" => 4,
"t" => "PriceField"
)); ));
public function id() 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