Fix 0 quantity not displayed
[order_line_extra.git] / includes / order_xtra_config.inc
1 <?php
2 require_once($path_to_root.'/'.'includes/date_functions.inc');
3
4 class OrderXtraConfig {
5         // Location code of the default or main location
6         static $default_location = "";
7         static $autopick_null = true;
8         
9         // Array location => { delivery, parent }
10         // Location not listed are excluded
11         static $locations= array();
12         //  control how many days before are holded item 'visible'
13         static $pre_hold_offset=7;
14
15         // Return delivery date for a give location
16         static function delivery($location) {
17                         if(isset(self::$locations[$location])) {
18                         $parameters = self::$locations[$location];
19                                 return @$parameters['delivery'];
20                         }
21                         else {
22                                 return null;
23                         }
24                 }
25
26         // True if the date before hold_until_date
27         static function early($hold_until_date, $date=null) {
28                 if(!$date) $date = Today();
29                 return date_diff2($hold_until_date, $date, 'd') > OrderXtraConfig::$pre_hold_offset;
30         }
31
32         static function sql_held_condition($date=null) {
33                 if(!$date) $date = Today();
34                 $sql_date = date2sql(add_days($date, + OrderXtraConfig::$pre_hold_offset));
35                 return 'hold_until_date > '.db_escape($sql_date);
36         }
37 }
38 ?>