BulkUpdater work.
[order_line_extra.git] / includes / sql_set.inc
1 <?php
2 require_once($path_to_root.'/'.'includes/date_functions.inc');
3 class SqlSet {
4         protected $pairs;
5         function __construct($set=null) {
6                 $this->pairs = $set ?  array_merge($set->pairs) : array();
7         }
8
9         function add($value, $field, $quote=true) {
10                 if($value !=null)  {
11                         if($value == ' ') $value = '';
12                         array_push($this->pairs, $quote ? "$field = '$value'" : "$field = $value");
13                 }
14
15                 return $this;
16         }
17
18         function addDate($date, $field) {
19                 return $this->add(date2sql($date), $field);
20         }
21
22         function addDatetime($date, $time, $field) {
23                 if(!$date)  return $this;
24                 return $this->add(date2sql($date)." $time", $field);
25         }
26
27         function toString() {
28                 return implode(', ', $this->pairs);
29         }
30         
31 }
32
33 class OrderAction {
34         public $detail_ids = array() ;
35
36         public function __construct(array $data) {
37                 $this->detail_ids = array();
38                 foreach($data['detail'] as $detail_id => $detail) {
39                         array_push($this->detail_ids, $detail_id);
40                 }
41         }
42 }