2 require_once($path_to_root.'/'.'includes/date_functions.inc');
4 class OrderXtraConfig {
5 // Location code of the default or main location
6 static $default_location = "";
8 // Array location => { delivery, parent }
9 // Location not listed are excluded
10 static $locations= array();
11 // control how many days before are holded item 'visible'
12 static $pre_hold_offset=7;
14 // Return delivery date for a give location
15 static function delivery($location) {
16 if(isset(self::$locations[$location])) {
17 $parameters = self::$locations[$location];
18 return @$parameters['delivery'];
25 // True if the date before hold_until_date
26 static function early($hold_until_date, $date=null) {
27 if(!$date) $date = Today();
28 return date_diff2($hold_until_date, $date, 'd') > OrderXtraConfig::$pre_hold_offset;
31 static function sql_held_condition($date=null) {
32 if(!$date) $date = Today();
33 $sql_date = date2sql(add_days($date, + OrderXtraConfig::$pre_hold_offset));
34 return 'hold_until_date > '.db_escape($sql_date);